Your database, your choice.
PostgreSQL, MySQL, or SQLite, all powered by Drizzle ORM. Pick the database that fits your project and switch adapters without changing your application code.
What it does
Nextly uses a database adapter pattern that abstracts the database layer behind a common interface. All three adapters extend a sharedDrizzleAdapterbase class from@revnixhq/adapter-drizzle, which provides CRUD operations, query building, and transaction management through Drizzle ORM.
Each adapter handles database-specific details: PostgreSQL uses the pg driver with connection pooling and supports JSONB, arrays, and full-text search. MySQL uses mysql2 with connection pooling and workarounds for the missing RETURNING clause. SQLite uses better-sqlite3 with synchronous operations wrapped for async compatibility, WAL mode, and RETURNING clause support (SQLite 3.35+).
You configure your database adapter innextly.config.tsand Nextly handles the rest: schema creation, migrations, and runtime query execution all go through the adapter.
Three Databases
PostgreSQL for production with JSONB, arrays, and full-text search. MySQL for full feature sets. SQLite for development and testing.
Drizzle ORM
All adapters extend a shared DrizzleAdapter base class. Type-safe queries, schema management, and relational access via the Drizzle instance.
Connection Pooling
PostgreSQL and MySQL adapters include connection pooling with configurable min/max connections, idle timeouts, and connection timeouts.
Transaction Support
Full ACID transactions with configurable isolation levels. Automatic retry for serialization failures and deadlocks.
Capabilities by database
| Capability | PostgreSQL | MySQL | SQLite |
|---|---|---|---|
| JSONB | ✓ | — (JSON only) | — (JSON only) |
| Array types | ✓ | — | — |
| Full-text search | ✓ | ✓ (FULLTEXT) | ✓ (FTS5) |
| RETURNING clause | ✓ | — | ✓ (3.35+) |
| Connection pooling | ✓ (pg.Pool) | ✓ (mysql2) | N/A (single file) |
| Savepoints | ✓ | — (disabled) | ✓ |
| ON CONFLICT / upsert | ✓ | ✓ (DUPLICATE KEY) | ✓ |
| Auto retry | Serialization + deadlock | Deadlock | — |
| Best for | Production | Production | Development / testing |
One package per database
PostgreSQL
Full features: JSONB, arrays, full-text search, RETURNING, savepoints, connection pooling.
MySQL
Full feature set with workarounds for missing RETURNING clause. Connection pooling and deadlock retry.
SQLite
File-based or in-memory. WAL mode for concurrency. RETURNING clause support (3.35+). Great for development.
Database adapter configuration
PostgreSQL
import { defineConfig } from"@revnixhq/nextly/config";
import { createPostgresAdapter } from"@revnixhq/adapter-postgres";
export default defineConfig({
database: {
adapter: createPostgresAdapter({
url: process.env.DATABASE_URL!,
pool: {
min: 0,
max: 5,
idleTimeoutMs: 30000,
},
}),
},
});MySQL
import { defineConfig } from"@revnixhq/nextly/config";
import { createMySqlAdapter } from"@revnixhq/adapter-mysql";
export default defineConfig({
database: {
adapter: createMySqlAdapter({
url: process.env.DATABASE_URL!,
pool: {
max: 10,
idleTimeoutMs: 30000,
},
}),
},
});SQLite
import { defineConfig } from"@revnixhq/nextly/config";
import { createSqliteAdapter } from"@revnixhq/adapter-sqlite";
export default defineConfig({
database: {
adapter: createSqliteAdapter({
url:"file:./data/app.db",
wal: true,
foreignKeys: true,
}),
},
});Start building with Nextly
Free, open source, and yours to own. No sign-up required.
npx create-nextly-app@latest