4.0 KiB
automation-create-prisma
create-prisma scaffolds a new Prisma 8 project that is already a Composer app, and can deploy it once.
Priority
MEDIUM
Why It Matters
create-prisma writes a working Composer app in one command, but only for new projects, and its --json mode deploys by default. Older versions generated prisma.compute.ts and a compute:deploy script; current versions generate module.ts, service.ts, and a composer section instead.
Verified with create-prisma 0.14.1.
Commands
npx create-prisma@latest --help
| Flag | Meaning |
|---|---|
[project-name], --name |
Project directory and root module name |
--template |
minimal, hono, elysia, nest, next, turborepo, svelte, astro, nuxt, tanstack-start |
--provider |
postgres or mongo |
--authoring |
psl or typescript for the data contract |
--package-manager |
npm, pnpm, yarn, bun, deno |
--deploy |
Build and deploy after scaffolding |
--workspace |
Workspace id or name to deploy into |
--skills |
Agents to install package skills for (claude,cursor,agents,devin), or none |
--yes |
Accept defaults; does not deploy |
--json |
One JSON result, non-interactive; deploys unless --no-deploy |
When to deploy:
| Invocation | Deploys |
|---|---|
--deploy |
Yes |
--json without --no-deploy |
Yes |
--yes without --deploy or --json |
No |
| Interactive | Asks |
--package-manager deno |
Never; no Composer files are generated |
For an unattended scaffold with no deploy, pass both:
npx create-prisma@latest my-api --template hono --provider postgres --yes --json --no-deploy
What It Generates
module.tsprovisioning one service namedapp. With--provider postgres, it also provisionspostgres({ name: "database", contract, config: "./prisma.config.ts" })from@prisma/composer-prisma-cloud/orm, so the deploy applies the generated migrations. With--provider mongo, it bindsenvSecret("MONGODB_URL")to the service input.service.tswith the build adapter for the template; seeapp-framework-builds.md.prisma.config.tswithorm,skills, andcomposersections. Thecomposersection usesprismaCloud({ region: "us-east-1" }); change the region before the first deploy if the app belongs elsewhere.- Scripts:
composer:dev(prisma dev module.ts),composer:deploy(prisma deploy module.ts),dev:composer(build, thencomposer:dev), anddeploy(build, thencomposer:deploy). Thedeployscript targets production; pass a stage withnpx prisma deploy module.ts --stage <name>instead. /.prisma-composerin.gitignore.
Deploy Flow
With deploy enabled, create-prisma runs prisma auth whoami, selects the workspace, checks that no project already has the app's name, runs the build script, and runs prisma deploy module.ts --report <tmp>. Without a session it signs in interactively in a terminal; in --json mode or without a TTY it stops with not_authenticated, keeps the scaffold, and tells the user to sign in and run the deploy script.
Rules
- Do not run
create-prismainside an existing app to deploy it. Port the app (app-composer-setup.md) and useprisma deploy. - Use the scripts the scaffold actually wrote; read
package.jsonrather than reconstructing them. - A scaffold's first deploy is production. Ask the user before using
--deployor--jsonwithout--no-deploy.
Bad
npx create-prisma@latest my-api --template hono --yes --json
This deploys to production without anyone deciding to.
Good
npx create-prisma@latest my-api --template hono --provider postgres --yes --json --no-deploy
cd my-api
npm run dev:composer
Verify locally, then deploy a stage with npm run build && npx prisma deploy module.ts --stage preview.