Aspire Connectivity
Developer

Database Workspace

Current Prisma and PostgreSQL boundary in packages/db.

Database Workspace

packages/db is the shared database package used by both Admin and Resident.

It contains:

  • prisma/schema.prisma with the PostgreSQL datasource, Prisma Client generator, and neutral SystemRecord convention model.
  • prisma7.config.ts, which loads the root Neon-managed DATABASE_URL.
  • src/index.ts, which exports the server-only db client from @aspire/db.
  • src/verify.ts, which uses that shared client for a read-only connection query.

Commands

npm run db:generate --workspace=@aspire/db
npm run db:migrate --workspace=@aspire/db # local development only
npm run db:deploy --workspace=@aspire/db  # production migration deployment
npm run db:status --workspace=@aspire/db
npm run db:verify --workspace=@aspire/db

The initial 20260918000000_init_system_record migration is checked in and has been applied to a clean configured database. Use db:migrate when creating a reviewed development migration. Use db:deploy in production; never use a database reset to apply this foundation.

Persisted-entity convention

SystemRecord verifies the shared database conventions without introducing a business-domain model or an application query:

model SystemRecord {
  id        String   @id @default(uuid()) @db.Uuid
  createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
  updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(6)
}

Future persisted entities use an Aspire-controlled UUID id; external provider identifiers are separate fields and never primary keys. TypeScript-facing fields use camel case, while PostgreSQL columns use created_at and updated_at. Timestamps are timezone-aware PostgreSQL values.

The initial migration proves the shared infrastructure conventions only. A future feature must specify each domain model and its migration behavior before it is added.

Environment separation

Local Prisma commands and db:verify read the root ignored .env file. Production uses a separate DATABASE_URL configured in Vercel. The value changes by environment; the schema, migration history, and commands do not. Never commit a connection string.

On this page