Project structure
Project structure
After scaffolding with create-crouton, your project has three key directories:
src/
βββ resources/
β βββ book/
β βββ resource.json # drives the API, table, form, and filters
β βββ schema.ts # re-exports the generated Zod schema
β βββ hooks.ts # optional lifecycle hooks
βββ data-sources/
β βββ default/
β βββ data-source.json # connection config + codegen paths
β βββ index.ts # exports the PrismaClient
crouton.json # project-wide paths and settings
crouton.enums.json # shared enum option listsFor Nx monorepos the structure is the same, but under apps/backend/src/app/.
resources/
Each subdirectory is one resource. The directory name is just a folder convention β the resource's identity is its name field in resource.json, not the directory name.
| File | Required | Description |
|---|---|---|
resource.json | yes | All configuration: columns, operations, sidebar, actions, layout |
schema.ts | yes (prisma) | Default-exports the Zod schema. Re-export from the generated types. |
hooks.ts | no | Default-exports a hooks object with lifecycle hooks |
repository.ts | for kind: "custom" | Default-exports a CustomRepository object for hand-written data access |
Subdirectories of a resource directory are sub-resources, discovered automatically when a relation column points at them. A resource.json in a subdirectory that nothing points at is ignored.
data-sources/
Each subdirectory is one data source. Multiple data sources are supported β each with its own Prisma schema and generated output.
See Data sources for the full configuration reference.
crouton.json
Project-wide paths and settings. The CLI reads it from the project root (or workspace root for Nx). The backend also reads it for the enum registry.
See crouton.json reference for all fields.
Generated files
| Directory | Contents |
|---|---|
generated/default/types/ | Zod schemas generated by crouton-prisma from your Prisma schema |
generated/default/client/ | Prisma client generated by prisma generate |
These are generated artefacts β do not edit them by hand. Add them to .gitignore or commit them, depending on your CI setup. If you commit them, re-run crouton update resources after schema changes to keep them in sync.