Skip to content

feat: add create-prisma next support#37

Draft
AmanVarshney01 wants to merge 40 commits into
mainfrom
aman/create-prisma-next
Draft

feat: add create-prisma next support#37
AmanVarshney01 wants to merge 40 commits into
mainfrom
aman/create-prisma-next

Conversation

@AmanVarshney01
Copy link
Copy Markdown
Member

@AmanVarshney01 AmanVarshney01 commented May 11, 2026

Summary

  • Adds the Prisma Next create flow using prisma-next@latest init --no-install as the source of truth for Prisma Next files and starter contracts.
  • Supports PostgreSQL and MongoDB across minimal, hono, elysia, nest, next, svelte, astro, nuxt, and tanstack-start.
  • Makes minimal the default template and adds per-template descriptions in the interactive picker.
  • Supports PSL and TypeScript contract authoring, with PostgreSQL defaulting to Prisma Postgres in interactive mode and --yes staying non-provisioning.
  • Keeps db:init, migrations, and seed manual only. No generated path auto-runs database setup under prompts or --yes.
  • Resolves Prisma Next packages from latest at scaffold time instead of hard-pinning framework versions in create-prisma.
  • Installs Prisma Next packages, provider runtime packages, generated contract/type packages, and the Vite contract emit plugin where relevant.
  • Removes create-prisma ownership of Prisma Next skills sync: no @prisma-next/agent-skill, no skills dependency, no skills:sync script, and no experimental_sync invocation.
  • Adds MongoDB Docker Compose helpers for default local MongoDB projects.
  • Removes the turborepo template from the Prisma Next create path.
  • Simplifies the Clack completion output and adds an agent prompt pointing users to prisma-next.md and the upstream Prisma Next skills/ directory.
  • Adds Prisma Next-specific telemetry event names, scoped to create-prisma@next releases.

Validation

  • bun run format:check
  • bun run typecheck
  • bun run lint
  • bun run build
  • bun run test:unit
  • bun run test:e2e
  • Full Minimal Postgres flow: install, emit, db:init, db:verify, migration plan/apply, seed, and query script.
  • Full Minimal MongoDB flow: install, emit, migration plan/apply, seed, and query script.
  • Existing e2e covers Hono Postgres and Hono MongoDB through migrations, seed, generated queries, and build.
  • Package-manager smoke for bun, npm, pnpm, and deno verifies generated Minimal projects do not include skills, @prisma-next/agent-skill, or skills:sync.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8c0f4540-3d1a-491b-89fa-0f4e032db4b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aman/create-prisma-next
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch aman/create-prisma-next

Comment @coderabbitai help to get the list of available commands and usage tips.

@AmanVarshney01 AmanVarshney01 added the release:next Publish this PR preview to the npm next dist-tag label May 11, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

@next preview published

  • Version: 0.4.2-next.37.106.1
  • Tag: next
  • Trigger: PR has the release:next label, so this is available as create-prisma@next
  • Run with Bun: bunx create-prisma@next
  • Run with npm: npx create-prisma@next
  • Run with Yarn: yarn dlx create-prisma@next
  • Run with pnpm: pnpm dlx create-prisma@next
  • Run with Deno: deno run -A npm:create-prisma@next
  • Workflow run: https://github.com/prisma/create-prisma/actions/runs/26623181499

AmanVarshney01 and others added 13 commits May 18, 2026 00:31
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
* feat: use mongodb-memory-server for local mongo dev

Replace the docker-compose helper with a generated scripts/start-mongo.ts
that runs mongodb-memory-server, so `db:up` works without Docker. When
mongo is selected without --database-url, the helper now writes the
start script, pins mongodb-memory-server@^11.1.0 as a devDependency,
and sets a package-manager-aware `db:up` script
(bun / deno run -A / tsx). No more docker-compose.yml, no db:down.

The e2e suite is parameterized across hono + next for both providers
(4 tests). Mongo cases scaffold without a databaseUrl, start the
generated db:up in the background on a free port, and exercise
migrate / seed / verify / build against the in-memory server — so the
generated script is itself under test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: persist mongo dev data across db:up restarts

The generated scripts/start-mongo.ts now writes the replica set's data
to a real directory (default .mongo-data/, overridable via MONGO_DB_PATH)
instead of mongodb-memory-server's temp dir, so seeded users and
applied migrations survive between Ctrl+C cycles. The setup helper
gitignores .mongo-data, and each template README explains the
"delete the folder for a clean slate" escape hatch.

E2E tests stay ephemeral by construction: each test scaffolds a fresh
project, so its .mongo-data is a fresh directory too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: detach db:up and add db:down + db:reset

Replace scripts/start-mongo.ts with a scripts/mongo.ts CLI that exposes
three subcommands: up (detached child that exits once the replica set
prints "ready", PID written to .mongo-data/mongo.pid, logs in
.mongo-data/mongo.log), down (SIGTERM the recorded PID, SIGKILL after
10s, idempotent on stale PIDs), and reset (down plus wipe of
.mongo-data/). The CLI re-exec's itself with the right runner — bun,
deno run -A, or tsx — so it stays correct across the package managers
we ship.

Cleanup is now an obvious one-liner: db:reset stops mongo and removes
the data directory. db:down leaves data in place.

The e2e suite is correspondingly simpler: the test just calls
`bun run db:up` (returns when ready, MONGO_PORT passed in for
collision-free parallelism) and `bun run db:down` in the finally, with
no in-test background process management.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: harden local mongo scaffold

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>

* fix: clean up mongo helper data paths

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>

---------

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
* refactor: model Prisma Next version as a resolved spec

Introduce ResolvedPrismaNextSpec + parsePrismaNextVersionSpec so the
target Prisma Next version is no longer a module-level constant. The
parser recognises pkg-pr-new:<ref> specs alongside npm versions and
dist-tags; getPrismaNextPackageSpecifier and getDependencyVersion now
accept the resolved spec and emit either name@<spec> or the
https://pkg.pr.new/prisma/prisma-next/<name>@<ref> URL form that
package managers accept directly.

No call sites pass a non-default spec yet; the new shape is what the
upcoming --prisma-next-version flag will thread through.

* feat: thread --prisma-next-version through scaffolding

Add the --prisma-next-version flag and plumb the resolved Prisma Next
spec into PrismaSetupContext, writePrismaDependencies,
writeCreateTemplateDependencies, and the prisma-next init invocation.
Every @prisma-next/* and prisma-next dependency written into
package.json — and the npx/dlx/bunx prisma-next@<spec> init command —
now honours the spec. With no flag, behaviour is unchanged (latest).

Supported specs:
- a published npm version (0.10.0, 0.11.0-dev.9, …) for regression /
  bisect work against the exact version a user filed an issue on;
- an npm dist-tag (latest, dev, next, …) for smoke-testing release
  candidates before they get the latest tag;
- pkg-pr-new:<sha|branch|pr-number> for dogfooding open PRs end-to-end
  through the canonical scaffold path — substitutes the
  https://pkg.pr.new/prisma/prisma-next/<package>@<ref> URL specifier
  for every Prisma Next install. Package managers accept URL specifiers
  in both install argv and package.json, so no special-casing per
  package manager is needed.

The pkg.pr.new path doesn't yet derive a matching skills ref (the
upstream prisma-next CLI needs a PRISMA_NEXT_SKILLS_REF override before
this is fully wired up); cases 1+2 work end-to-end today and unblock
the onboarding-audit regression workflows.

* feat: report Prisma Next version spec in create telemetry

Add prisma-next-version-kind (default | npm-tag | npm-version |
pkg-pr-new) and prisma-next-version-spec to the create command's
completion / failure events. The kind is the low-cardinality signal
the onboarding audit needs to see which escape hatch users reach for;
the spec round-trips the exact string for the long tail of dist-tags,
prereleases, and PR refs that can't be summarised by the kind alone.
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:next Publish this PR preview to the npm next dist-tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants