User Guide
Database Configuration
Multi-dialect setup for PostgreSQL / SQLite / Cloudflare D1
TinyShip supports multi-dialect database setup, switched by DB_DIALECT without changing business logic.
Supported Dialects
| Dialect | DB_DIALECT | Notes |
|---|---|---|
| PostgreSQL | pg (default) | Recommended and most fully validated |
| SQLite | sqlite | Local file database for local dev |
| Cloudflare D1 | d1 | Managed SQLite on Workers |
Quick Switch
# PostgreSQL (default)
DB_DIALECT="pg"
DATABASE_URL="postgresql://username:password@localhost:5432/tinyship"
# SQLite
DB_DIALECT="sqlite"
# SQLITE_DB_PATH="./data/local.sqlite"
# D1 (Workers)
DB_DIALECT="d1"Common Commands
| Action | PostgreSQL | SQLite |
|---|---|---|
| Check connection | pnpm db:check | pnpm db:check:sqlite |
| Push schema | pnpm db:push | pnpm db:push:sqlite |
| Seed data | pnpm db:seed | pnpm db:seed:sqlite |
| Open studio | pnpm db:studio | pnpm db:studio:sqlite |
D1 Notes
- D1 and SQLite share the same schema set
- D1 migrations use Wrangler CLI:
wrangler d1 migrations apply - D1 is only for Cloudflare Workers deployment path
If Next/Nuxt/TanStack should share one database, prefer PostgreSQL (pg).