Skip to content
atarashi
Documentation menu

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

PromptFlagTypeDefault
db.name--db-nameinput"{{ project.slug }}"
db.pool--db-poolconfirmtrue

Files it writes

  • src/db/client.ts|js (when !has('orm/prisma'))
  • docker-compose.yml (when has('infra/docker-compose'))

Dependencies

  • pg@^8.16.3 (when !has('orm/prisma'))

Development only:

  • @types/pg@^8.15.5 (when provides('language:typescript') && !has('orm/prisma'))

Environment

VariableRequiredDescription
DATABASE_URLyesPostgreSQL connection string

What it contributes to other files

FileSlotLine
src/config/env.ts|jsenv-schemaDATABASE_URL: z.string().min(1),
src/index.ts|jsimportsimport { checkDatabaseConnection } from './db/client.js';
src/index.ts|jsbootstrapawait 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.