db/postgres
PostgreSQL connection pool with a startup health check and a Compose service.
Provides: database, database:sql, database:postgres
Requires: runtime:node, config:env
Conflicts with: database
Options
| Prompt | Flag | Type | Default |
|---|---|---|---|
db.name | --db-name | input | "{{ project.slug }}" |
db.pool | --db-pool | confirm | true |
Files it writes
src/db/client.ts|js(when!has('orm/prisma'))docker-compose.yml(whenhas('infra/docker-compose'))
Dependencies
pg@^8.16.3(when!has('orm/prisma'))
Development only:
@types/pg@^8.15.5(whenprovides('language:typescript') && !has('orm/prisma'))
Environment
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | yes | PostgreSQL connection string |
What it contributes to other files
| File | Slot | Line |
|---|---|---|
src/config/env.ts|js | env-schema | DATABASE_URL: z.string().min(1), |
src/index.ts|js | imports | import { checkDatabaseConnection } from './db/client.js'; |
src/index.ts|js | bootstrap | await checkDatabaseConnection(); |
Use it
atarashi new my-app --add db/postgres
atarashi add db/postgres
Version 1.0.0. Format reference: Authoring blueprints.
Part of the atarashi documentation, written and maintained by Gautam Suthar.