create-prisma 0.4.2-next.37.91.1 → 0.4.2-next.37.93.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ Scaffold a new app with Prisma Next already wired up.
10
10
  - adds Prisma Next dependencies for PostgreSQL or MongoDB
11
11
  - runs `prisma-next init --no-install` to scaffold `prisma/contract.*`, `prisma-next.config.ts`, `prisma/db.ts`, `prisma-next.md`, `.env.example`, and the Prisma Next agent skill
12
12
  - writes a template-specific Prisma Next runtime helper
13
- - adds `contract:emit`, `db:init`, `db:update`, `db:verify`, `db:seed`, `migration:plan`, `migration:apply`, `migration:status`, and `migration:show` scripts
13
+ - adds `contract:emit`, `db:init`, `db:update`, `db:verify`, `db:seed`, `migration:plan`, `migrate`, `migration:status`, and `migration:show` scripts
14
14
  - adds `db:up` / `db:down` and `docker-compose.yml` for default MongoDB projects
15
15
  - creates or updates `.env` with `DATABASE_URL`
16
16
  - can install dependencies and run `prisma-next contract emit`
@@ -57,6 +57,12 @@ Create a project interactively:
57
57
  create-prisma
58
58
  ```
59
59
 
60
+ Create a Minimal project non-interactively:
61
+
62
+ ```bash
63
+ create-prisma --name my-script --template minimal --provider postgres
64
+ ```
65
+
60
66
  Create a Hono app non-interactively:
61
67
 
62
68
  ```bash
@@ -89,14 +95,15 @@ create-prisma --name my-app --template nest --provider postgres --prisma-postgre
89
95
 
90
96
  ## Supported Templates
91
97
 
92
- - `hono`
93
- - `elysia`
94
- - `nest`
95
- - `next`
96
- - `svelte`
97
- - `astro`
98
- - `nuxt`
99
- - `tanstack-start`
98
+ - `minimal` - script-first Prisma Next starter with no web framework
99
+ - `hono` - lightweight TypeScript API server
100
+ - `elysia` - Bun-friendly TypeScript API server
101
+ - `nest` - structured Node API with controllers and services
102
+ - `next` - full-stack React app with App Router
103
+ - `svelte` - full-stack Svelte 5 app with Vite
104
+ - `astro` - content-oriented web app with server routes
105
+ - `nuxt` - full-stack Vue app with Nitro server routes
106
+ - `tanstack-start` - React app with file routes and server functions
100
107
 
101
108
  ## Supported Databases
102
109
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-Bd-xQ87g.mjs";
2
+ import "./create-DGDCo1EV.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -49,7 +49,7 @@ async function getAnonymousId() {
49
49
  }
50
50
  function getCommonProperties() {
51
51
  return {
52
- "cli-version": "0.4.2-next.37.91.1",
52
+ "cli-version": "0.4.2-next.37.93.1",
53
53
  "node-version": process.version,
54
54
  platform: process.platform,
55
55
  arch: process.arch
@@ -150,30 +150,22 @@ function requiresDotenvConfigImport(packageManager) {
150
150
  //#region src/constants/dependencies.ts
151
151
  const dependencyVersionMap = {
152
152
  "@elysiajs/node": "^1.4.5",
153
- "@prisma-next/agent-skill": "0.0.1",
154
- "@prisma-next/adapter-mongo": "0.8.0",
155
- "@prisma-next/adapter-postgres": "0.8.0",
156
- "@prisma-next/cli": "0.8.0",
157
- "@prisma-next/contract": "0.8.0",
158
- "@prisma-next/family-mongo": "0.8.0",
159
- "@prisma-next/family-sql": "0.8.0",
160
- "@prisma-next/mongo": "0.8.0",
161
- "@prisma-next/mongo-contract": "0.8.0",
162
- "@prisma-next/mongo-contract-ts": "0.8.0",
163
- "@prisma-next/mongo-orm": "0.8.0",
164
- "@prisma-next/postgres": "0.8.0",
165
- "@prisma-next/sql-contract": "0.8.0",
166
- "@prisma-next/sql-contract-ts": "0.8.0",
167
- "@prisma-next/sql-orm-client": "0.8.0",
168
- "@prisma-next/target-mongo": "0.8.0",
169
- "@prisma-next/target-postgres": "0.8.0",
170
- "@prisma-next/vite-plugin-contract-emit": "0.8.0",
171
153
  "@types/node": "^25.6.2",
172
154
  dotenv: "^17.4.2",
173
- "prisma-next": "0.8.0",
174
155
  skills: "1.5.7",
175
156
  tsx: "^4.21.0"
176
157
  };
158
+ const PRISMA_NEXT_PACKAGE_VERSION = "latest";
159
+ function isPrismaNextPackage(packageName) {
160
+ return packageName === "prisma-next" || packageName.startsWith("@prisma-next/");
161
+ }
162
+ function getPrismaNextPackageSpecifier(packageName) {
163
+ return `${packageName}@${PRISMA_NEXT_PACKAGE_VERSION}`;
164
+ }
165
+ function getDependencyVersion(packageName) {
166
+ if (isPrismaNextPackage(packageName)) return PRISMA_NEXT_PACKAGE_VERSION;
167
+ return dependencyVersionMap[packageName];
168
+ }
177
169
  function usesViteDevServer(template) {
178
170
  return template === "astro" || template === "nuxt" || template === "svelte" || template === "tanstack-start";
179
171
  }
@@ -184,7 +176,7 @@ function getCreateTemplateDependencies(template, packageManager) {
184
176
  dependencies: [],
185
177
  devDependencies: ["@prisma-next/vite-plugin-contract-emit"]
186
178
  });
187
- if (template === "hono" || template === "elysia" || template === "nest") {
179
+ if (template === "minimal" || template === "hono" || template === "elysia" || template === "nest") {
188
180
  const runtimeDevDependencies = usesNodeStyleRuntime(packageManager) ? ["tsx"] : [];
189
181
  if (template === "elysia" && packageManager !== "deno") targets.push({
190
182
  packageJsonPath: "package.json",
@@ -217,6 +209,7 @@ const packageManagers = [
217
209
  ];
218
210
  const authoringStyles = ["psl", "typescript"];
219
211
  const createTemplates = [
212
+ "minimal",
220
213
  "hono",
221
214
  "elysia",
222
215
  "nest",
@@ -338,9 +331,9 @@ function getPackageManagerManifestValue(packageManager) {
338
331
  }
339
332
  function getDenoAllowedScriptSpecifiers() {
340
333
  return [
341
- `npm:prisma-next@${dependencyVersionMap["prisma-next"]}`,
342
- `npm:@prisma-next/postgres@${dependencyVersionMap["@prisma-next/postgres"]}`,
343
- `npm:@prisma-next/mongo@${dependencyVersionMap["@prisma-next/mongo"]}`
334
+ `npm:${getPrismaNextPackageSpecifier("prisma-next")}`,
335
+ `npm:${getPrismaNextPackageSpecifier("@prisma-next/postgres")}`,
336
+ `npm:${getPrismaNextPackageSpecifier("@prisma-next/mongo")}`
344
337
  ].join(",");
345
338
  }
346
339
  function getInstallCommand(packageManager) {
@@ -611,7 +604,7 @@ function getDbPackages(provider, _packageManager) {
611
604
  function getPrismaNextScriptMap(packageManager) {
612
605
  const skillsSyncCommand = packageManager === "deno" ? `deno run -A npm:skills@${dependencyVersionMap.skills} experimental_sync --agent "*" -y` : "skills experimental_sync --agent \"*\" -y";
613
606
  if (packageManager === "deno") {
614
- const prismaNextCli = `deno run -A --env-file=.env npm:prisma-next@${dependencyVersionMap["prisma-next"]}`;
607
+ const prismaNextCli = `deno run -A --env-file=.env npm:${getPrismaNextPackageSpecifier("prisma-next")}`;
615
608
  return {
616
609
  "contract:emit": `${prismaNextCli} contract emit`,
617
610
  "db:init": `${prismaNextCli} db init`,
@@ -619,7 +612,7 @@ function getPrismaNextScriptMap(packageManager) {
619
612
  "db:verify": `${prismaNextCli} db verify`,
620
613
  "db:seed": "deno run -A --env-file=.env prisma/seed.ts",
621
614
  "migration:plan": `${prismaNextCli} migration plan`,
622
- "migration:apply": `${prismaNextCli} migration apply`,
615
+ migrate: `${prismaNextCli} migrate`,
623
616
  "migration:status": `${prismaNextCli} migration status`,
624
617
  "migration:show": `${prismaNextCli} migration show`,
625
618
  "skills:sync": skillsSyncCommand
@@ -634,7 +627,7 @@ function getPrismaNextScriptMap(packageManager) {
634
627
  "db:verify": `${prismaNextCli} db verify`,
635
628
  "db:seed": "bun prisma/seed.ts",
636
629
  "migration:plan": `${prismaNextCli} migration plan`,
637
- "migration:apply": `${prismaNextCli} migration apply`,
630
+ migrate: `${prismaNextCli} migrate`,
638
631
  "migration:status": `${prismaNextCli} migration status`,
639
632
  "migration:show": `${prismaNextCli} migration show`,
640
633
  "skills:sync": skillsSyncCommand
@@ -647,15 +640,12 @@ function getPrismaNextScriptMap(packageManager) {
647
640
  "db:verify": "prisma-next db verify",
648
641
  "db:seed": "tsx prisma/seed.ts",
649
642
  "migration:plan": "prisma-next migration plan",
650
- "migration:apply": "prisma-next migration apply",
643
+ migrate: "prisma-next migrate",
651
644
  "migration:status": "prisma-next migration status",
652
645
  "migration:show": "prisma-next migration show",
653
646
  "skills:sync": skillsSyncCommand
654
647
  };
655
648
  }
656
- function getVersion(packageName) {
657
- return dependencyVersionMap[packageName];
658
- }
659
649
  function unique(items) {
660
650
  return [...new Set(items)];
661
651
  }
@@ -705,12 +695,12 @@ async function addPackageDependency(opts) {
705
695
  if (!pkgJson.devDependencies) pkgJson.devDependencies = {};
706
696
  if (!pkgJson.scripts) pkgJson.scripts = {};
707
697
  for (const pkgName of unique(dependencies)) {
708
- const version = getVersion(pkgName);
698
+ const version = getDependencyVersion(pkgName);
709
699
  if (version) pkgJson.dependencies[pkgName] = version;
710
700
  else console.warn(`Warning: Dependency ${pkgName} not found in version map.`);
711
701
  }
712
702
  for (const pkgName of unique(devDependencies)) {
713
- const version = getVersion(pkgName);
703
+ const version = getDependencyVersion(pkgName);
714
704
  if (version) pkgJson.devDependencies[pkgName] = version;
715
705
  else console.warn(`Warning: Dev dependency ${pkgName} not found in version map.`);
716
706
  }
@@ -1194,8 +1184,8 @@ async function writeDependenciesForContext(context, projectDir) {
1194
1184
  return false;
1195
1185
  }
1196
1186
  }
1197
- function getPrismaNextPackageSpecifier() {
1198
- return `prisma-next@${dependencyVersionMap["prisma-next"]}`;
1187
+ function getPrismaNextCliPackageSpecifier() {
1188
+ return getPrismaNextPackageSpecifier("prisma-next");
1199
1189
  }
1200
1190
  function getPrismaNextInitTarget(provider) {
1201
1191
  return provider === "mongo" ? "mongodb" : "postgres";
@@ -1205,13 +1195,13 @@ function getPrismaNextInitCliArgs(packageManager, prismaNextArgs) {
1205
1195
  command: "npx",
1206
1196
  args: [
1207
1197
  "--yes",
1208
- getPrismaNextPackageSpecifier(),
1198
+ getPrismaNextCliPackageSpecifier(),
1209
1199
  "init",
1210
1200
  ...prismaNextArgs
1211
1201
  ]
1212
1202
  };
1213
1203
  return getPackageExecutionArgs(packageManager, [
1214
- getPrismaNextPackageSpecifier(),
1204
+ getPrismaNextCliPackageSpecifier(),
1215
1205
  "init",
1216
1206
  ...prismaNextArgs
1217
1207
  ]);
@@ -1352,7 +1342,7 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
1352
1342
  }
1353
1343
  }
1354
1344
  function getPrismaNextCliCommand(packageManager, prismaNextArgs) {
1355
- if (packageManager === "deno") return `deno run -A --env-file=.env npm:prisma-next@${dependencyVersionMap["prisma-next"]} ${prismaNextArgs.join(" ")}`;
1345
+ if (packageManager === "deno") return `deno run -A --env-file=.env npm:${getPrismaNextCliPackageSpecifier()} ${prismaNextArgs.join(" ")}`;
1356
1346
  return getLocalPackageBinaryCommand(packageManager, "prisma-next", prismaNextArgs);
1357
1347
  }
1358
1348
  function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
@@ -1362,7 +1352,7 @@ function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
1362
1352
  "run",
1363
1353
  "-A",
1364
1354
  "--env-file=.env",
1365
- `npm:prisma-next@${dependencyVersionMap["prisma-next"]}`,
1355
+ `npm:${getPrismaNextCliPackageSpecifier()}`,
1366
1356
  ...prismaNextArgs
1367
1357
  ]
1368
1358
  };
@@ -1427,7 +1417,7 @@ function buildNextStepsForContext(opts) {
1427
1417
  description: "Compare the contract to the database and write a migration plan."
1428
1418
  });
1429
1419
  nextSteps.push({
1430
- command: getRunScriptCommand(context.packageManager, "migration:apply"),
1420
+ command: getRunScriptCommand(context.packageManager, "migrate"),
1431
1421
  description: "Apply the planned migration to the database."
1432
1422
  });
1433
1423
  nextSteps.push({
@@ -1518,7 +1508,7 @@ function getCreatePrismaIntro() {
1518
1508
  //#endregion
1519
1509
  //#region src/commands/create.ts
1520
1510
  const DEFAULT_PROJECT_NAME = "my-app";
1521
- const DEFAULT_TEMPLATE = "hono";
1511
+ const DEFAULT_TEMPLATE = "minimal";
1522
1512
  function toPackageName(projectName) {
1523
1513
  return projectName.toLowerCase().replace(/[^a-z0-9._-]/g, "-").replace(/^-+/, "").replace(/-+$/, "") || "app";
1524
1514
  }
@@ -1549,45 +1539,50 @@ async function promptForCreateTemplate() {
1549
1539
  message: "Select template",
1550
1540
  initialValue: DEFAULT_TEMPLATE,
1551
1541
  options: [
1542
+ {
1543
+ value: "minimal",
1544
+ label: "Minimal",
1545
+ hint: "Script-first Prisma Next starter with no web framework"
1546
+ },
1552
1547
  {
1553
1548
  value: "hono",
1554
1549
  label: "Hono",
1555
- hint: "Default TypeScript API starter"
1550
+ hint: "Lightweight TypeScript API server"
1556
1551
  },
1557
1552
  {
1558
1553
  value: "elysia",
1559
1554
  label: "Elysia",
1560
- hint: "TypeScript API starter with Elysia's Node adapter"
1555
+ hint: "Bun-friendly TypeScript API server"
1561
1556
  },
1562
1557
  {
1563
1558
  value: "nest",
1564
1559
  label: "NestJS",
1565
- hint: "Official Nest-style API starter with a Prisma service"
1560
+ hint: "Structured Node API with controllers and services"
1566
1561
  },
1567
1562
  {
1568
1563
  value: "next",
1569
1564
  label: "Next.js",
1570
- hint: "App Router + TypeScript starter"
1565
+ hint: "Full-stack React app with App Router"
1571
1566
  },
1572
1567
  {
1573
1568
  value: "svelte",
1574
1569
  label: "SvelteKit",
1575
- hint: "Official minimal SvelteKit + TypeScript starter"
1570
+ hint: "Full-stack Svelte 5 app with Vite"
1576
1571
  },
1577
1572
  {
1578
1573
  value: "astro",
1579
1574
  label: "Astro",
1580
- hint: "Official minimal Astro starter with API route example"
1575
+ hint: "Content-oriented web app with server routes"
1581
1576
  },
1582
1577
  {
1583
1578
  value: "nuxt",
1584
1579
  label: "Nuxt",
1585
- hint: "Official minimal Nuxt starter with Nitro API route example"
1580
+ hint: "Full-stack Vue app with Nitro server routes"
1586
1581
  },
1587
1582
  {
1588
1583
  value: "tanstack-start",
1589
1584
  label: "TanStack Start",
1590
- hint: "TanStack Start React app with file routes and server functions"
1585
+ hint: "React app with file routes and server functions"
1591
1586
  }
1592
1587
  ]
1593
1588
  });
package/dist/index.d.mts CHANGED
@@ -195,6 +195,7 @@ declare const AuthoringStyleSchema: z.ZodEnum<{
195
195
  typescript: "typescript";
196
196
  }>;
197
197
  declare const CreateTemplateSchema: z.ZodEnum<{
198
+ minimal: "minimal";
198
199
  hono: "hono";
199
200
  elysia: "elysia";
200
201
  nest: "nest";
@@ -231,6 +232,7 @@ declare const CreateCommandInputSchema: z.ZodObject<{
231
232
  emit: z.ZodOptional<z.ZodBoolean>;
232
233
  name: z.ZodOptional<z.ZodString>;
233
234
  template: z.ZodOptional<z.ZodEnum<{
235
+ minimal: "minimal";
234
236
  hono: "hono";
235
237
  elysia: "elysia";
236
238
  nest: "nest";
@@ -272,6 +274,7 @@ declare const router: {
272
274
  emit: zod.ZodOptional<zod.ZodBoolean>;
273
275
  name: zod.ZodOptional<zod.ZodString>;
274
276
  template: zod.ZodOptional<zod.ZodEnum<{
277
+ minimal: "minimal";
275
278
  hono: "hono";
276
279
  elysia: "elysia";
277
280
  nest: "nest";
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-Bd-xQ87g.mjs";
2
+ import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-DGDCo1EV.mjs";
3
3
  import { os } from "@orpc/server";
4
4
  import { createCli } from "trpc-cli";
5
5
 
6
6
  //#region src/index.ts
7
- const CLI_VERSION = "0.4.2-next.37.91.1";
7
+ const CLI_VERSION = "0.4.2-next.37.93.1";
8
8
  const router = os.router({ create: os.meta({
9
9
  description: "Create a new project with Prisma setup",
10
10
  default: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.4.2-next.37.91.1",
3
+ "version": "0.4.2-next.37.93.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma Next projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -25,12 +25,12 @@ Database helper scripts are added to `package.json`:
25
25
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
26
26
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
27
27
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
28
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
28
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
29
29
  {{else}}
30
30
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
31
31
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
32
32
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
33
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
33
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
34
34
  {{/if}}
35
35
 
36
36
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -23,12 +23,12 @@ Database helper scripts are added to `package.json`:
23
23
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
24
24
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
25
25
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
26
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
26
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
27
27
  {{else}}
28
28
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
29
29
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
30
30
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
31
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
31
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
32
32
  {{/if}}
33
33
 
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -23,12 +23,12 @@ Database helper scripts are added to `package.json`:
23
23
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
24
24
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
25
25
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
26
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
26
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
27
27
  {{else}}
28
28
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
29
29
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
30
30
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
31
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
31
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
32
32
  {{/if}}
33
33
 
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -0,0 +1,3 @@
1
+ {{#if (eq packageManager "yarn")}}
2
+ nodeLinker: node-modules
3
+ {{/if}}
@@ -0,0 +1,38 @@
1
+ # {{projectName}}
2
+
3
+ Generated by `create-prisma` with the Minimal template.
4
+
5
+ ## Scripts
6
+
7
+ - `{{runScriptCommand packageManager "dev"}}` - run the Prisma Next sample script
8
+
9
+ ## Prisma Next
10
+
11
+ Prisma Next setup is scaffolded in:
12
+
13
+ - `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
14
+ - `prisma-next.config.ts`
15
+ - `prisma/db.ts`
16
+ - `src/lib/prisma.ts`
17
+
18
+ Database helper scripts are added to `package.json`:
19
+
20
+ - `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
21
+ {{#if (eq provider "mongo")}}
22
+ - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
23
+ - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
24
+ - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
25
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
26
+ {{else}}
27
+ - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
28
+ - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
29
+ - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
30
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
31
+ {{/if}}
32
+ - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
33
+
34
+ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Agent-specific project guidance starts in `.agents/skills/prisma-next/SKILL.md`.
35
+
36
+ Node-based Prisma Next projects expect Node.js 24 LTS or newer.
37
+
38
+ Run the migration and seed scripts first, then `{{runScriptCommand packageManager "dev"}}` runs a small write/read round trip from `src/index.ts`.
@@ -0,0 +1,5 @@
1
+ {{#if (eq packageManager "deno")}}
2
+ {
3
+ "nodeModulesDir": "manual"
4
+ }
5
+ {{/if}}
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ {{#if (packageManagerManifestValue packageManager)}}
5
+ "packageManager": "{{packageManagerManifestValue packageManager}}",
6
+ {{/if}}
7
+ "type": "module",
8
+ "scripts": {
9
+ "dev": "{{runtimeScript packageManager "start" "src/index.ts" ""}}"
10
+ },
11
+ "dependencies": {},
12
+ "devDependencies": {}
13
+ }
@@ -0,0 +1,42 @@
1
+ import { db, listUsers } from "./lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
2
+
3
+ const sampleUser = {
4
+ email: "first.user@prisma.io",
5
+ name: "First User",
6
+ };
7
+
8
+ async function main() {
9
+ {{#if (eq provider "mongo")}}
10
+ const existingUser = await db.orm.users.where({ email: sampleUser.email }).first();
11
+ if (!existingUser) {
12
+ await db.orm.users.createCount([sampleUser]);
13
+ }
14
+
15
+ const user = await db.orm.users.where({ email: sampleUser.email }).first();
16
+ {{else}}
17
+ const existingUser = await db.orm.User.where({ email: sampleUser.email }).first();
18
+ if (!existingUser) {
19
+ await db.orm.User.createCount([sampleUser]);
20
+ }
21
+
22
+ const user = await db.orm.User.where({ email: sampleUser.email }).first();
23
+ {{/if}}
24
+ const users = await listUsers();
25
+
26
+ console.log(`Prisma Next is ready. Found ${users.length} user${users.length === 1 ? "" : "s"}.`);
27
+ console.log(user);
28
+ }
29
+
30
+ try {
31
+ await main();
32
+ } catch (error) {
33
+ console.error("Prisma Next query failed.");
34
+ console.error("Emit the contract, set DATABASE_URL, then apply migrations before running this script.");
35
+ throw error;
36
+ } finally {
37
+ {{#if (eq provider "mongo")}}
38
+ await db.close();
39
+ {{else}}
40
+ await db.runtime().close();
41
+ {{/if}}
42
+ }
@@ -0,0 +1,71 @@
1
+ import "dotenv/config";
2
+ {{#if (eq provider "mongo")}}
3
+ import mongo from "@prisma-next/mongo/runtime";
4
+ {{else}}
5
+ import postgres from "@prisma-next/postgres/runtime";
6
+ {{/if}}
7
+
8
+ {{#if (eq provider "mongo")}}
9
+ import type { DefaultModelRow } from "@prisma-next/mongo-orm";
10
+ {{else}}
11
+ import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
12
+ {{/if}}
13
+
14
+ import type { Contract } from "../../prisma/contract.d";
15
+ import contractJson from "../../prisma/contract.json" with { type: "json" };
16
+
17
+ {{#if (eq provider "mongo")}}
18
+ export const db = mongo<Contract>({
19
+ contractJson,
20
+ url: process.env["DATABASE_URL"],
21
+ });
22
+ {{else}}
23
+ export const db = postgres<Contract>({
24
+ contractJson,
25
+ url: process.env["DATABASE_URL"],
26
+ });
27
+ {{/if}}
28
+
29
+ type UserRow = DefaultModelRow<Contract, "User">;
30
+
31
+ {{#if (eq provider "mongo")}}
32
+ function toStarterUser(user: Pick<UserRow, "_id" | "email" | "name">) {
33
+ return {
34
+ id: String(user._id),
35
+ email: user.email,
36
+ name: user.name ?? null,
37
+ createdAt: null as Date | null,
38
+ };
39
+ }
40
+ {{else}}
41
+ function toStarterUser(user: Pick<UserRow, "id" | "email" | "name" | "createdAt">) {
42
+ return {
43
+ id: String(user.id),
44
+ email: user.email,
45
+ name: user.name ?? null,
46
+ createdAt: user.createdAt,
47
+ };
48
+ }
49
+ {{/if}}
50
+
51
+ export async function listUsers(limit = 10) {
52
+
53
+ {{#if (eq provider "mongo")}}
54
+ const users: ReturnType<typeof toStarterUser>[] = [];
55
+
56
+ for await (const user of db.orm.users.select("_id", "email", "name").take(limit).all()) {
57
+ users.push(toStarterUser(user));
58
+ }
59
+
60
+ return users;
61
+ {{else}}
62
+ const users = await db.orm.User.select("id", "email", "name", "createdAt").take(limit).all();
63
+
64
+ return users.map(toStarterUser);
65
+ {{/if}}
66
+
67
+ }
68
+
69
+ export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
70
+
71
+ export default db;
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "resolveJsonModule": true,
7
+ "verbatimModuleSyntax": true,
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["src/**/*.ts", "prisma/**/*.ts"]
14
+ }
@@ -24,12 +24,12 @@ Database helper scripts are added to `package.json`:
24
24
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
25
25
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
26
26
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
27
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
27
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
28
28
  {{else}}
29
29
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
30
30
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
31
31
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
32
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
32
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
33
33
  {{/if}}
34
34
 
35
35
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -23,12 +23,12 @@ Database helper scripts are added to `package.json`:
23
23
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
24
24
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
25
25
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
26
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
26
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
27
27
  {{else}}
28
28
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
29
29
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
30
30
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
31
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
31
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
32
32
  {{/if}}
33
33
 
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -25,12 +25,12 @@ Database helper scripts are added to `package.json`:
25
25
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
26
26
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
27
27
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
28
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
28
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
29
29
  {{else}}
30
30
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
31
31
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
32
32
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
33
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
33
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
34
34
  {{/if}}
35
35
 
36
36
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -24,12 +24,12 @@ Database helper scripts are added to `package.json`:
24
24
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
25
25
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
26
26
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
27
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
27
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
28
28
  {{else}}
29
29
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
30
30
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
31
31
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
32
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
32
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
33
33
  {{/if}}
34
34
 
35
35
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
@@ -24,12 +24,12 @@ Database helper scripts are added to `package.json`:
24
24
  - `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
25
25
  - `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB replica set
26
26
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
27
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply the planned MongoDB migration
27
+ - `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
28
28
  {{else}}
29
29
  - `{{runScriptCommand packageManager "db:init"}}` - initialize database state manually
30
30
  - `{{runScriptCommand packageManager "db:update"}}` - update database state manually
31
31
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
32
- - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
32
+ - `{{runScriptCommand packageManager "migrate"}}` - apply a planned migration
33
33
  {{/if}}
34
34
 
35
35
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually