@nextlyhq/adapter-postgres 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +97 -0
- package/dist/index.cjs +679 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +328 -0
- package/dist/index.d.ts +328 -0
- package/dist/index.mjs +674 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NextlyHQ <info@nextlyhq.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @nextlyhq/adapter-postgres
|
|
2
|
+
|
|
3
|
+
PostgreSQL database adapter for Nextly. Built on `pg` (node-postgres) with connection pooling, transactions, JSONB, and array support.
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@nextlyhq/adapter-postgres"><img alt="npm" src="https://img.shields.io/npm/v/@nextlyhq/adapter-postgres?style=flat-square&label=npm&color=cb3837" /></a>
|
|
7
|
+
<a href="https://github.com/nextlyhq/nextly/blob/main/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/nextlyhq/nextly?style=flat-square&color=blue" /></a>
|
|
8
|
+
<a href="https://nextlyhq.com/docs"><img alt="Status" src="https://img.shields.io/badge/status-alpha-orange?style=flat-square" /></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
> [!IMPORTANT]
|
|
12
|
+
> Nextly is in alpha. APIs may change before 1.0. Pin exact versions in production.
|
|
13
|
+
|
|
14
|
+
## What it is
|
|
15
|
+
|
|
16
|
+
The PostgreSQL adapter for Nextly. Use this if your database is PostgreSQL or any PG-compatible cloud (Neon, Supabase, RDS, Aurora PG, Railway, Cloud SQL).
|
|
17
|
+
|
|
18
|
+
> [!TIP]
|
|
19
|
+
> **PostgreSQL is the recommended production database for Nextly.** It has the full feature set (JSONB, arrays, native ILIKE, savepoints, `RETURNING`, full-text search via `tsvector`) and the fewest behavioural workarounds. Pick this dialect for any new project unless you have a strong reason to choose MySQL or SQLite.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @nextlyhq/adapter-postgres pg
|
|
25
|
+
pnpm add -D @types/pg
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick usage
|
|
29
|
+
|
|
30
|
+
Nextly selects the adapter from your `.env` file. Install the package and set:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
DB_DIALECT=postgresql
|
|
34
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
That is it. Nextly's runtime instantiates the adapter on boot.
|
|
38
|
+
|
|
39
|
+
## Required environment variables
|
|
40
|
+
|
|
41
|
+
| Variable | Required? | Default | Notes |
|
|
42
|
+
| -------------- | ----------- | ------------------------ | --------------------------------------- |
|
|
43
|
+
| `DATABASE_URL` | yes | (none) | Standard `postgresql://...` URL. |
|
|
44
|
+
| `DB_DIALECT` | recommended | (auto-detected from URL) | One of `postgresql`, `mysql`, `sqlite`. |
|
|
45
|
+
|
|
46
|
+
For SSL on managed providers (Neon, Supabase, RDS), append `?sslmode=require` to the URL or set `PGSSLMODE=require`.
|
|
47
|
+
|
|
48
|
+
## Programmatic usage (advanced)
|
|
49
|
+
|
|
50
|
+
For custom bootstrap such as test harnesses or scripts, import the factory:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { createPostgresAdapter } from "@nextlyhq/adapter-postgres";
|
|
54
|
+
|
|
55
|
+
const adapter = createPostgresAdapter({
|
|
56
|
+
url: process.env.DATABASE_URL!,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await adapter.connect();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Most users do not need this. The framework's runtime does it automatically.
|
|
63
|
+
|
|
64
|
+
## Supported PostgreSQL versions
|
|
65
|
+
|
|
66
|
+
- PostgreSQL 15.0 or newer required
|
|
67
|
+
- Tested against PostgreSQL 15, 16, 17
|
|
68
|
+
- Cloud providers: Neon (also reachable via Vercel Marketplace), Supabase, AWS RDS, Aurora PG, Railway, Google Cloud SQL
|
|
69
|
+
|
|
70
|
+
## Main exports
|
|
71
|
+
|
|
72
|
+
- `PostgresAdapter`: the adapter class
|
|
73
|
+
- `createPostgresAdapter`: factory for programmatic use
|
|
74
|
+
- `isPostgresAdapter`: type guard
|
|
75
|
+
- Type exports: `PostgresAdapterConfig`
|
|
76
|
+
|
|
77
|
+
## Compatibility
|
|
78
|
+
|
|
79
|
+
| Tool | Version |
|
|
80
|
+
| -------- | ------- |
|
|
81
|
+
| Node.js | 20+ |
|
|
82
|
+
| `pg` | 8.10+ |
|
|
83
|
+
| `nextly` | 0.0.x |
|
|
84
|
+
|
|
85
|
+
## Documentation
|
|
86
|
+
|
|
87
|
+
- [**PostgreSQL adapter docs**](https://nextlyhq.com/docs/database/postgres)
|
|
88
|
+
- [**Database support and version policy**](https://nextlyhq.com/docs/database/support)
|
|
89
|
+
|
|
90
|
+
## Related packages
|
|
91
|
+
|
|
92
|
+
- [`@nextlyhq/adapter-mysql`](../adapter-mysql)
|
|
93
|
+
- [`@nextlyhq/adapter-sqlite`](../adapter-sqlite)
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
[MIT](../../LICENSE.md)
|