Prisma models by file. Module-owned files are removed from downloads that do not include the module.
schema.prisma
The generator (prisma-client, output ../src/generated/prisma) and the datasource, which lists the Postgres schemas. Models live in the other files.
user.prisma (core)
| Model | Purpose |
|---|
User | Name, email, image, role (user, admin, guest), ban fields, access tier, creditsTotal (default 20) and creditsUsed |
Account | Credentials and OAuth accounts linked to a user (providerId, tokens, hashed password) |
Session | Session token, expiry, IP, user agent, impersonatedBy, and activeOrganizationId with Organizations |
Verification | Email verification and password reset tokens |
jwks | Key storage used by Better Auth |
Invitation | Admin invitations for invite-only sign-up (PENDING, ACCEPTED, REVOKED) |
AppSetting | Key-value settings such as registration_mode |
billing.prisma (core)
| Model | Purpose |
|---|
Transaction | One row per successful payment: user, gateway event ID, unique checkoutSessionId (the idempotency key), receipt URL, description, amount and currency |
cms.prisma (core)
| Model | Purpose |
|---|
LandingPage | One row per product, keyed by title = NEXT_PUBLIC_SAAS_NAME: logos, hero text, section headings, footer and legal fields |
HeroImage, Feature, Testimonial, PricingPlan, FAQ, FooterLink | Section items, each linked to a landing page |
Documentation | Docs pages: unique slug, title, type (category), order, Markdown content, lastUpdated |
org.prisma (Organizations module)
| Model | Purpose |
|---|
Organization | Workspace name, unique slug, logo, metadata |
Member | User membership with a role: owner, admin, member or viewer |
OrganizationInvitation | Pending workspace invitations with role, inviter and expiry |
ai.prisma (AI Platform module)
| Model | Purpose |
|---|
AiPrompt, AiPromptVersion | Named prompts (for example chat.assistant) with versioned content, provider and model, and one active version |
AiConversation, AiMessage | Chat history per user |
AiUsageEvent | Tokens and credits charged per request |
AiSpeechConfig | Text-to-speech and speech-to-text provider settings |
AiWebhookConfig | n8n webhook settings for routing chat to a workflow |
ai-agents.prisma (AI Agents module)
| Model | Purpose |
|---|
AiJobRun, AiJobEvent | Background agent runs and their event stream |
AiCollection, AiDocument, AiDocumentChunk | RAG collections, ingested documents and their embedded chunks (pgvector) |
api-keys.prisma (API Keys module)
| Model | Purpose |
|---|
ApiKey | Label, unique keyPrefix, SHA-256 keyHash, scopes, status, last use, expiry and revocation |
scaffold.prisma (open-source repository only)
ProjectConfig (saved projects), ScaffoldJob (the download and upgrade ledger with charge, build key, refund), ReleaseEmailSubscription and ReleaseEmail. These power the SaaS Forge download platform and never ship in a download.
Changing the schema
- Edit the relevant
.prisma file. Put a new feature's models in a new file.
- If the model needs a new Postgres schema, add it to
schemas in schema.prisma and use @@schema("…") on each model.
- Run
pnpm migrate, give the migration a name, and read the generated SQL before committing.
- Commit the
.prisma changes and the new folder under prisma/migrations together.
See Migrations & Seeding.