Appearance
Database Package (@ce-sdr/db)
Located at packages/db/, this package is the single source of truth for the database schema, Prisma client, and generated types.
Stack
- Database: MongoDB Atlas
- ORM: Prisma (v6+)
- Schema:
packages/db/schema.prisma - Generated client:
packages/db/generated/client/ - Generated Zod types:
packages/db/src/lib/zod/(viazod-prisma-types)
Commands
bash
pnpm db:generate # Re-generate Prisma client + Zod types (run after every schema change)
pnpm db:push # Push schema to MongoDB (no migration files — MongoDB is schemaless)
pnpm db:seed # Run seed scripts
pnpm db:studio # Open Prisma Studio web UIMongoDB with Prisma uses
db pushrather than migration files. There is nomigrate dev/migrate deployworkflow.
Exports
Everything is re-exported from packages/db/src/index.ts:
- Prisma client —
import { prisma } from "@ce-sdr/db" - Zod schemas —
import { CampaignsSchema, ContactsSchema, ... } from "@ce-sdr/db" - Enums —
import { CampaignStatus, StepType, ... } from "@ce-sdr/db"
Schema Overview
See Database Schema for the full ERD and field definitions.