Skip to content

Open source CapCut alternative.

TypeScript

Group Prisma schema models

David Le1b086cb1df96
diff --git a/AGENTS.md b/AGENTS.md
index eef2f48f..61f1237a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -24,6 +24,7 @@ Before changing `site/` UI, routes, API handlers, or data access patterns:
- Read the relevant Next.js guide in `site/node_modules/next/dist/docs/`; this version may differ from your training data.
- Read the applicable site guidance in `docs/guides/`.
- Do not run database migrations, including `prisma migrate`, `prisma db push`, or any command that applies schema changes to Supabase or another database.
+- Keep Prisma table/model definitions out of `site/prisma/schema.prisma`. Put tables in logically grouped sibling `.prisma` files under `site/prisma/`; reserve `schema.prisma` for shared Prisma configuration such as generator and datasource blocks.
- Treat `/prototype`, "the prototype route", or route-shaped prototype requests as work on the Next.js route under `site/`, not as a repository-root `prototype/` directory.
## Working Rules
diff --git a/docs/guides/backend-apis.md b/docs/guides/backend-apis.md
index d2e087a8..02d143bc 100644
--- a/docs/guides/backend-apis.md
+++ b/docs/guides/backend-apis.md
@@ -24,6 +24,10 @@ Backend APIs live in `site/src/app/api/**/route.ts`.
- Verify resource ownership before reading or mutating scoped data.
- Return explicit `NextResponse.json(...)` responses with the intended status code.
- Keep Prisma access server-only through `@/lib/prisma`.
+- Keep Prisma table/model definitions in logically grouped sibling `.prisma`
+ files under `site/prisma/`. Never put table/model definitions in
+ `site/prisma/schema.prisma`; reserve that file for shared Prisma
+ configuration such as generator and datasource blocks.
- Do not run database migrations as part of normal API work.
## Inference Gateway
diff --git a/docs/guides/frontend-nextjs-guidelines.md b/docs/guides/frontend-nextjs-guidelines.md
index 4e57a0f1..ecfa23f5 100644
--- a/docs/guides/frontend-nextjs-guidelines.md
+++ b/docs/guides/frontend-nextjs-guidelines.md
@@ -21,7 +21,7 @@ This app is the `site` Next.js project. It is intended to run the public site an
- Keep route-specific experiences in a dedicated component folder near the route, such as `src/app/_components/landing` for the home landing page.
- Split route-specific UI into focused component files rather than placing every section, primitive, hook, and data object into one large component file.
- Keep server-only helpers in `src/lib`, such as `src/lib/prisma.ts`.
-- Keep generated Prisma files out of hand edits. Update `prisma/schema.prisma`, then run `npm run db:generate`.
+- Keep generated Prisma files out of hand edits. Follow the backend guide for Prisma schema layout.
- Use absolute imports through the `@/*` alias. Avoid barrel `index.ts` files unless a package-level public API truly needs one.
## Server and Client Components
diff --git a/site/prisma/Inference.prisma b/site/prisma/Inference.prisma
new file mode 100644
index 00000000..bfcbcdb7
--- /dev/null
+++ b/site/prisma/Inference.prisma
@@ -0,0 +1,25 @@
+model InferenceGeneration {
+ id String @id @default(cuid())
+ clientId String
+ kind String
+ status String @default("pending")
+ provider String
+ model String
+ providerJobId String?
+ providerGenerationId String?
+ providerPollingUrl String?
+ promptPreview String
+ requestHash String
+ request Json
+ outputs Json?
+ usage Json?
+ error Json?
+ metadata Json @default("{}")
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ completedAt DateTime?
+
+ @@index([clientId, createdAt])
+ @@index([provider, providerJobId])
+ @@index([status, updatedAt])
+}
diff --git a/site/prisma/Waitlist.prisma b/site/prisma/Waitlist.prisma
new file mode 100644
index 00000000..3ec1de1e
--- /dev/null
+++ b/site/prisma/Waitlist.prisma
@@ -0,0 +1,8 @@
+model WaitlistEntry {
+ id String @id @default(cuid())
+ email String @unique
+ name String?
+ source String?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+}
diff --git a/site/prisma/schema.prisma b/site/prisma/schema.prisma
index 141cf633..b01b77dc 100644
--- a/site/prisma/schema.prisma
+++ b/site/prisma/schema.prisma
@@ -10,38 +10,3 @@ generator client {
datasource db {
provider = "postgresql"
}
-
-model WaitlistEntry {
- id String @id @default(cuid())
- email String @unique
- name String?
- source String?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-
-model InferenceGeneration {
- id String @id @default(cuid())
- clientId String
- kind String
- status String @default("pending")
- provider String
- model String
- providerJobId String?
- providerGenerationId String?
- providerPollingUrl String?
- promptPreview String
- requestHash String
- request Json
- outputs Json?
- usage Json?
- error Json?
- metadata Json @default("{}")
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- completedAt DateTime?
-
- @@index([clientId, createdAt])
- @@index([provider, providerJobId])
- @@index([status, updatedAt])
-}