Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.14.0"
node-version: "24"
registry-url: "https://registry.npmjs.org"

- name: Compute preview metadata
Expand Down Expand Up @@ -86,6 +86,9 @@ jobs:
- name: Typecheck
run: bun run typecheck

- name: Test
run: bun run test

- name: Build
run: bun run build

Expand All @@ -111,7 +114,6 @@ jobs:
`- Run with npm: \`npx create-prisma@${process.env.DIST_TAG}\``,
`- Run with Yarn: \`yarn dlx create-prisma@${process.env.DIST_TAG}\``,
`- Run with pnpm: \`pnpm dlx create-prisma@${process.env.DIST_TAG}\``,
`- Run with Deno: \`deno run -A npm:create-prisma@${process.env.DIST_TAG}\``,
`- Workflow run: ${process.env.RUN_URL}`,
].join("\n");

Expand Down Expand Up @@ -153,7 +155,6 @@ jobs:
echo "- Run with npm: \`npx create-prisma@${{ steps.preview.outputs.dist_tag }}\`" >> "$GITHUB_STEP_SUMMARY"
echo "- Run with Yarn: \`yarn dlx create-prisma@${{ steps.preview.outputs.dist_tag }}\`" >> "$GITHUB_STEP_SUMMARY"
echo "- Run with pnpm: \`pnpm dlx create-prisma@${{ steps.preview.outputs.dist_tag }}\`" >> "$GITHUB_STEP_SUMMARY"
echo "- Run with Deno: \`deno run -A npm:create-prisma@${{ steps.preview.outputs.dist_tag }}\`" >> "$GITHUB_STEP_SUMMARY"

release:
name: Release to npm
Expand All @@ -175,7 +176,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.14.0"
node-version: "24"
registry-url: "https://registry.npmjs.org"

- name: Extract version from commit message
Expand Down Expand Up @@ -239,6 +240,10 @@ jobs:
if: steps.check-version.outputs.exists == 'false'
run: bun run typecheck

- name: Test
if: steps.check-version.outputs.exists == 'false'
run: bun run test

- name: Build
if: steps.check-version.outputs.exists == 'false'
run: bun run build
Expand Down
44 changes: 19 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Scaffold a new app with Prisma already wired up.

- creates a new app from a supported template
- adds Prisma 7 dependencies for your database
- scaffolds `prisma/schema.prisma`, `prisma/seed.ts`, `prisma.config.ts`, and Compute deploy defaults for Compute-ready templates
- scaffolds `prisma/schema.prisma`, `prisma/seed.ts`, `prisma.config.ts`, and a Composer application graph for supported templates
- writes a Prisma client singleton in the right place for the selected template
- adds `db:generate`, `db:migrate`, and `db:seed` scripts
- creates or updates the template env file with `DATABASE_URL`
- can install dependencies and run `prisma generate` for you
- can deploy the finished app to Prisma Compute and return a live URL
- adds `db:generate`, `db:migrate`, `db:migrate:deploy`, and `db:seed` scripts
- creates an env example for databases managed outside Composer
- installs dependencies when requested, then generates Prisma Client and an initial migration automatically
- can deploy the finished app and its Prisma Postgres database with Prisma Composer

## Quick Start

Expand All @@ -35,10 +35,6 @@ yarn dlx create-prisma@latest
bunx create-prisma@latest
```

```bash
deno run -A npm:create-prisma@latest
```

If you already have it available locally:

```bash
Expand Down Expand Up @@ -71,19 +67,19 @@ Create a monorepo with a shared Prisma package:
create-prisma --name my-monorepo --template turborepo --provider postgresql
```

Use Prisma Postgres auto-provisioning:
Use Prisma Postgres auto-provisioning, which is the PostgreSQL default:

```bash
create-prisma --name my-app --template nest --provider postgresql --prisma-postgres
create-prisma --name my-app --template nest --provider postgresql
```

Deploy a supported app to Prisma Compute:
Deploy a supported app with Prisma Composer:

```bash
create-prisma --name my-api --template hono --provider postgresql --deploy
```

With PostgreSQL and no `--database-url`, the Compute flow asks whether to use Prisma Postgres. If accepted, or if `--prisma-postgres` is passed, it creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to the template env file, and deploys the app with the env file configured in `prisma.compute.ts`. Pass `--no-prisma-postgres` to deploy without provisioning a database.
PostgreSQL always includes Prisma Postgres in the Composer application graph. The generated deploy script provisions it with the app, applies the generated migration with `prisma migrate deploy`, seeds it, and removes the temporary direct connection used for setup.

## Supported Templates

Expand All @@ -97,12 +93,13 @@ With PostgreSQL and no `--database-url`, the Compute flow asks whether to use Pr
- `tanstack-start`
- `turborepo`

Prisma Compute deployment is currently supported for:
Prisma Composer files are included by default, and deployment is supported for:
Comment thread
AmanVarshney01 marked this conversation as resolved.

- `hono`
- `elysia`
- `nest`
- `next`
- `svelte`
- `astro`
- `nuxt`
- `tanstack-start`
Expand All @@ -122,20 +119,18 @@ Prisma Compute deployment is currently supported for:
- `pnpm`
- `yarn`
- `bun`
- `deno`

Every package manager receives the same Composer-ready templates and deploy scripts.

## Useful Flags

- `--name` project name or relative path
- `--template` choose the template
- `--provider` choose the database provider
- `--package-manager` choose the package manager/runtime
- `--schema-preset empty|basic`
- `--deploy` deploy supported templates to Prisma Compute
- `--deploy` deploy supported templates with Prisma Composer
- `--yes` accept defaults and skip prompts
- `--no-install` scaffold only
- `--no-generate` skip `prisma generate`
- `--prisma-postgres` provision Prisma Postgres for PostgreSQL
- `--skills --mcp --extension` enable optional add-ons
- `--force` allow scaffolding into a non-empty directory
- `--verbose` print full command output
Expand All @@ -149,23 +144,22 @@ Prisma Compute deployment is currently supported for:
- Prisma IDE extension install

These can be selected interactively or enabled with flags.
When Prisma Compute deploy is selected, the skills add-on recommends the `prisma-compute` skill too.

## Deploy to Prisma Compute
## Deploy with Prisma Composer

After scaffolding, `create-prisma` can deploy your app to [Prisma Compute](https://www.prisma.io/docs/compute), the serverless hosting for TypeScript apps that runs next to your Prisma Postgres database. It is offered for the templates the Prisma CLI can deploy today: `hono`, `elysia`, `nest`, `next`, `astro`, `nuxt`, `tanstack-start`, and `turborepo`.
Supported templates include Composer by default: `module.ts` declares the application graph, `service.ts` declares the Compute service and its dependencies, and `prisma-composer.config.ts` selects the Prisma Cloud target. The generated project is ready to deploy whether or not you deploy during creation.

Accept the deploy prompt when it appears, or pass the flag:

```bash
create-prisma --name my-api --template hono --provider postgresql --deploy
```

The deploy step signs you in with the Prisma CLI if you are not signed in yet. With PostgreSQL and no `--database-url`, create-prisma asks whether to use Prisma Postgres. If accepted, or if `--prisma-postgres` is passed, setup creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to the template env file, runs the requested Prisma setup, then deploys the app with the env file configured in `prisma.compute.ts`. Pass `--no-prisma-postgres` to deploy without provisioning a database.
Deployment runs through `@prisma/cli@next` and reuses either your active Prisma browser-login session or `PRISMA_SERVICE_TOKEN` in CI. If you are not signed in, create-prisma opens the Prisma login flow before deploying from an interactive terminal. You can also sign in ahead of time with `npx @prisma/cli@next auth login`. PostgreSQL always provisions Prisma Postgres and passes its connection through `service.load()`. For other providers, copy `.env.example` to `.env`, set `DATABASE_URL`, and Composer will pass it to the application as a secret input.

A `prisma.compute.ts` file is generated with the app framework, runtime port, target, and env-file defaults. When deployment is selected, a `compute:deploy` script is added to the generated project so you can redeploy app changes later. That script runs `@prisma/cli@latest app deploy` using `prisma.compute.ts`; it does not create a new project, create a new database, run migrations, or seed data.
A `deploy` script is generated for every supported package manager. It builds and deploys the Composer application. For PostgreSQL it then resolves the Composer-managed database, applies the committed migration with `prisma migrate deploy`, seeds the database, and removes the temporary direct connection. No database URL is written back to the project.

The deploy prompt is skipped in `--yes` runs unless you pass `--deploy`. Browser sign-in may still need a person at the keyboard if no Prisma CLI session exists.
The only Composer-specific prompt asks whether to deploy immediately. It is skipped in `--yes` runs unless you pass `--deploy`; the Composer files are still generated. Prisma Client generation is automatic, and PostgreSQL uses Prisma Postgres by default without additional prompts.

## Local Development

Expand Down
1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"lint:fix": "oxlint . --fix",
"format": "oxfmt --write .",
"format:check": "oxfmt --check .",
"test": "bun test",
"typecheck": "tsc --noEmit",
"bump": "bun run scripts/bump-version.ts",
"release": "bun run bump",
Expand All @@ -54,6 +55,7 @@
"handlebars": "^4.7.9",
"posthog-node": "^5.38.2",
"trpc-cli": "^0.15.1",
"yaml": "^2.8.2",
"zod": "^4.4.3"
},
"devDependencies": {
Expand All @@ -68,7 +70,7 @@
},
"engines": {
"bun": ">=1.3.0",
"node": ">=18.0.0"
"node": ">=24.0.0"
},
"packageManager": "bun@1.3.14"
}
10 changes: 9 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { createCreatePrismaCli } from "./index";
import { getNodeVersionCompatibilityError } from "./utils/node-version";

const nodeVersionError = getNodeVersionCompatibilityError(process.versions.node);
if (nodeVersionError) {
process.stderr.write(`${nodeVersionError}\n`);
process.exit(1);
}

const { createCreatePrismaCli } = await import("./index");

await createCreatePrismaCli().run({
formatError: (error: unknown) => (error instanceof Error ? error.message : String(error)),
Expand Down
Loading
Loading