create-prisma 0.7.2 → 0.8.0-pr.56.216.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.
Files changed (131) hide show
  1. package/README.md +35 -159
  2. package/dist/cli.mjs +9 -3
  3. package/dist/create-BeMLn0T7.mjs +1409 -0
  4. package/dist/index.d.mts +43 -62
  5. package/dist/index.mjs +35 -2
  6. package/package.json +24 -19
  7. package/templates/create/_shared/.gitattributes.hbs +11 -0
  8. package/templates/create/_shared/README.md.hbs +39 -0
  9. package/templates/create/_shared/module.ts.hbs +28 -0
  10. package/templates/create/_shared/pnpm-workspace.yaml.hbs +16 -0
  11. package/templates/create/_shared/prisma-composer.config.ts.hbs +11 -0
  12. package/templates/create/_shared/prisma.config.ts.hbs +17 -0
  13. package/templates/create/_shared/service.ts.hbs +42 -0
  14. package/templates/create/_shared/src/prisma/composer.ts.hbs +8 -0
  15. package/templates/create/_shared/src/prisma/db.ts.hbs +51 -0
  16. package/templates/create/_shared/src/prisma/seed.ts.hbs +36 -0
  17. package/templates/create/_shared/src/prisma/users.ts.hbs +35 -0
  18. package/templates/create/astro/{astro.config.mjs.hbs → astro.config.mjs} +1 -2
  19. package/templates/create/astro/package.json.hbs +5 -5
  20. package/templates/create/astro/src/pages/api/users.ts.hbs +6 -23
  21. package/templates/create/astro/src/pages/index.astro.hbs +19 -56
  22. package/templates/create/astro/tsconfig.json +3 -0
  23. package/templates/create/elysia/package.json.hbs +6 -7
  24. package/templates/create/elysia/src/index.ts.hbs +18 -27
  25. package/templates/create/elysia/tsconfig.json +3 -1
  26. package/templates/create/hono/package.json.hbs +6 -7
  27. package/templates/create/hono/src/index.ts.hbs +11 -15
  28. package/templates/create/hono/tsconfig.json +3 -1
  29. package/templates/create/minimal/.yarnrc.yml.hbs +3 -0
  30. package/templates/create/minimal/package.json.hbs +15 -0
  31. package/templates/create/minimal/src/index.ts.hbs +19 -0
  32. package/templates/create/{turborepo/apps/api → minimal}/tsconfig.json +2 -2
  33. package/templates/create/nest/package.json.hbs +7 -7
  34. package/templates/create/nest/src/app.module.ts.hbs +9 -10
  35. package/templates/create/nest/src/main.ts.hbs +3 -10
  36. package/templates/create/nest/src/prisma.service.ts.hbs +6 -5
  37. package/templates/create/nest/src/users.controller.ts.hbs +3 -5
  38. package/templates/create/nest/src/users.service.ts.hbs +4 -11
  39. package/templates/create/nest/tsconfig.json +3 -2
  40. package/templates/create/next/eslint.config.mjs +8 -1
  41. package/templates/create/next/package.json.hbs +10 -10
  42. package/templates/create/next/src/app/page.tsx.hbs +17 -56
  43. package/templates/create/next/tsconfig.json +1 -0
  44. package/templates/create/nuxt/app/pages/index.vue.hbs +12 -45
  45. package/templates/create/nuxt/package.json.hbs +8 -7
  46. package/templates/create/nuxt/server/api/users.get.ts.hbs +3 -15
  47. package/templates/create/nuxt/tsconfig.json +3 -0
  48. package/templates/create/svelte/package.json.hbs +9 -11
  49. package/templates/create/svelte/src/routes/+page.server.ts.hbs +4 -16
  50. package/templates/create/svelte/src/routes/+page.svelte.hbs +14 -164
  51. package/templates/create/svelte/svelte.config.js +1 -4
  52. package/templates/create/svelte/tsconfig.json +2 -1
  53. package/templates/create/svelte/vite.config.ts +3 -0
  54. package/templates/create/tanstack-start/package.json.hbs +14 -14
  55. package/templates/create/tanstack-start/src/routes/__root.tsx.hbs +2 -3
  56. package/templates/create/tanstack-start/src/routes/index.tsx.hbs +27 -78
  57. package/templates/create/tanstack-start/tsconfig.json +4 -2
  58. package/templates/create/tanstack-start/vite.config.ts +2 -4
  59. package/dist/src-B3hRLZ0U.mjs +0 -2527
  60. package/templates/create/astro/README.md.hbs +0 -47
  61. package/templates/create/astro/deno.json.hbs +0 -5
  62. package/templates/create/astro/prisma/schema.prisma.hbs +0 -21
  63. package/templates/create/astro/prisma/seed.ts.hbs +0 -38
  64. package/templates/create/astro/prisma.compute.ts.hbs +0 -10
  65. package/templates/create/astro/prisma.config.ts.hbs +0 -15
  66. package/templates/create/astro/src/lib/prisma.ts.hbs +0 -55
  67. package/templates/create/elysia/README.md.hbs +0 -43
  68. package/templates/create/elysia/deno.json.hbs +0 -5
  69. package/templates/create/elysia/prisma/schema.prisma.hbs +0 -25
  70. package/templates/create/elysia/prisma/seed.ts.hbs +0 -38
  71. package/templates/create/elysia/prisma.compute.ts.hbs +0 -11
  72. package/templates/create/elysia/prisma.config.ts.hbs +0 -15
  73. package/templates/create/elysia/src/lib/prisma.ts.hbs +0 -56
  74. package/templates/create/hono/README.md.hbs +0 -43
  75. package/templates/create/hono/deno.json.hbs +0 -5
  76. package/templates/create/hono/prisma/schema.prisma.hbs +0 -25
  77. package/templates/create/hono/prisma/seed.ts.hbs +0 -38
  78. package/templates/create/hono/prisma.compute.ts.hbs +0 -10
  79. package/templates/create/hono/prisma.config.ts.hbs +0 -15
  80. package/templates/create/hono/src/lib/prisma.ts.hbs +0 -56
  81. package/templates/create/nest/README.md.hbs +0 -43
  82. package/templates/create/nest/deno.json.hbs +0 -5
  83. package/templates/create/nest/prisma/schema.prisma.hbs +0 -25
  84. package/templates/create/nest/prisma/seed.ts.hbs +0 -40
  85. package/templates/create/nest/prisma.compute.ts.hbs +0 -10
  86. package/templates/create/nest/prisma.config.ts.hbs +0 -15
  87. package/templates/create/nest/src/lib/prisma.ts.hbs +0 -58
  88. package/templates/create/next/README.md.hbs +0 -42
  89. package/templates/create/next/deno.json.hbs +0 -12
  90. package/templates/create/next/prisma/schema.prisma.hbs +0 -21
  91. package/templates/create/next/prisma/seed.ts.hbs +0 -38
  92. package/templates/create/next/prisma.compute.ts.hbs +0 -9
  93. package/templates/create/next/prisma.config.ts.hbs +0 -15
  94. package/templates/create/next/src/lib/prisma.ts.hbs +0 -56
  95. package/templates/create/nuxt/README.md.hbs +0 -44
  96. package/templates/create/nuxt/deno.json.hbs +0 -5
  97. package/templates/create/nuxt/prisma/schema.prisma.hbs +0 -21
  98. package/templates/create/nuxt/prisma/seed.ts.hbs +0 -38
  99. package/templates/create/nuxt/prisma.compute.ts.hbs +0 -9
  100. package/templates/create/nuxt/prisma.config.ts.hbs +0 -15
  101. package/templates/create/nuxt/server/utils/prisma.ts.hbs +0 -56
  102. package/templates/create/svelte/README.md.hbs +0 -45
  103. package/templates/create/svelte/deno.json.hbs +0 -5
  104. package/templates/create/svelte/prisma/schema.prisma.hbs +0 -21
  105. package/templates/create/svelte/prisma/seed.ts.hbs +0 -38
  106. package/templates/create/svelte/prisma.config.ts.hbs +0 -15
  107. package/templates/create/svelte/src/lib/server/prisma.ts.hbs +0 -53
  108. package/templates/create/tanstack-start/README.md.hbs +0 -43
  109. package/templates/create/tanstack-start/deno.json.hbs +0 -13
  110. package/templates/create/tanstack-start/prisma/schema.prisma.hbs +0 -21
  111. package/templates/create/tanstack-start/prisma/seed.ts.hbs +0 -38
  112. package/templates/create/tanstack-start/prisma.compute.ts.hbs +0 -9
  113. package/templates/create/tanstack-start/prisma.config.ts.hbs +0 -15
  114. package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +0 -56
  115. package/templates/create/turborepo/README.md.hbs +0 -42
  116. package/templates/create/turborepo/apps/api/package.json.hbs +0 -26
  117. package/templates/create/turborepo/apps/api/src/index.ts.hbs +0 -55
  118. package/templates/create/turborepo/deno.json.hbs +0 -5
  119. package/templates/create/turborepo/package.json.hbs +0 -30
  120. package/templates/create/turborepo/packages/db/package.json.hbs +0 -22
  121. package/templates/create/turborepo/packages/db/prisma/schema.prisma.hbs +0 -21
  122. package/templates/create/turborepo/packages/db/prisma/seed.ts.hbs +0 -38
  123. package/templates/create/turborepo/packages/db/prisma.config.ts.hbs +0 -15
  124. package/templates/create/turborepo/packages/db/src/client.ts.hbs +0 -63
  125. package/templates/create/turborepo/packages/db/src/index.ts +0 -2
  126. package/templates/create/turborepo/packages/db/tsconfig.json +0 -15
  127. package/templates/create/turborepo/pnpm-workspace.yaml +0 -3
  128. package/templates/create/turborepo/prisma.compute.ts.hbs +0 -14
  129. package/templates/create/turborepo/turbo.json +0 -28
  130. /package/templates/create/{turborepo → elysia}/.yarnrc.yml.hbs +0 -0
  131. /package/templates/create/next/{next.config.ts.hbs → next.config.ts} +0 -0
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import * as _orpc_server0 from "@orpc/server";
3
+ import * as trpc_cli0 from "trpc-cli";
2
4
  import { z } from "zod";
3
5
 
4
6
  //#region node_modules/@orpc/client/dist/index.d.mts
@@ -173,25 +175,24 @@ type ErrorMap = { [key in ORPCErrorCode]?: ErrorMapItem<AnySchema> };
173
175
  type MergedErrorMap<T1 extends ErrorMap, T2 extends ErrorMap> = Omit<T1, keyof T2> & T2;
174
176
  //#endregion
175
177
  //#region src/types.d.ts
176
- declare const DatabaseProviderSchema: z.ZodEnum<{
178
+ declare const DatabaseProviderSchema: z.ZodPipe<z.ZodEnum<{
179
+ postgres: "postgres";
177
180
  postgresql: "postgresql";
178
- mysql: "mysql";
179
- sqlite: "sqlite";
180
- sqlserver: "sqlserver";
181
- cockroachdb: "cockroachdb";
182
- }>;
181
+ mongo: "mongo";
182
+ mongodb: "mongodb";
183
+ }>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>;
183
184
  declare const PackageManagerSchema: z.ZodEnum<{
184
185
  npm: "npm";
185
186
  pnpm: "pnpm";
186
187
  yarn: "yarn";
187
188
  bun: "bun";
188
- deno: "deno";
189
189
  }>;
190
- declare const SchemaPresetSchema: z.ZodEnum<{
191
- empty: "empty";
192
- basic: "basic";
190
+ declare const AuthoringStyleSchema: z.ZodEnum<{
191
+ psl: "psl";
192
+ typescript: "typescript";
193
193
  }>;
194
194
  declare const CreateTemplateSchema: z.ZodEnum<{
195
+ minimal: "minimal";
195
196
  hono: "hono";
196
197
  elysia: "elysia";
197
198
  nest: "nest";
@@ -200,37 +201,31 @@ declare const CreateTemplateSchema: z.ZodEnum<{
200
201
  astro: "astro";
201
202
  nuxt: "nuxt";
202
203
  "tanstack-start": "tanstack-start";
203
- turborepo: "turborepo";
204
204
  }>;
205
- declare const DatabaseUrlSchema: z.ZodString;
206
205
  declare const CreateCommandInputSchema: z.ZodObject<{
207
206
  yes: z.ZodOptional<z.ZodBoolean>;
208
207
  verbose: z.ZodOptional<z.ZodBoolean>;
209
- provider: z.ZodOptional<z.ZodEnum<{
208
+ provider: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
209
+ postgres: "postgres";
210
210
  postgresql: "postgresql";
211
- mysql: "mysql";
212
- sqlite: "sqlite";
213
- sqlserver: "sqlserver";
214
- cockroachdb: "cockroachdb";
211
+ mongo: "mongo";
212
+ mongodb: "mongodb";
213
+ }>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>>;
214
+ authoring: z.ZodOptional<z.ZodEnum<{
215
+ psl: "psl";
216
+ typescript: "typescript";
215
217
  }>>;
216
218
  packageManager: z.ZodOptional<z.ZodEnum<{
217
219
  npm: "npm";
218
220
  pnpm: "pnpm";
219
221
  yarn: "yarn";
220
222
  bun: "bun";
221
- deno: "deno";
222
- }>>;
223
- prismaPostgres: z.ZodOptional<z.ZodBoolean>;
224
- databaseUrl: z.ZodOptional<z.ZodString>;
225
- install: z.ZodOptional<z.ZodBoolean>;
226
- generate: z.ZodOptional<z.ZodBoolean>;
227
- migrateAndSeed: z.ZodOptional<z.ZodBoolean>;
228
- schemaPreset: z.ZodOptional<z.ZodEnum<{
229
- empty: "empty";
230
- basic: "basic";
231
223
  }>>;
224
+ deploy: z.ZodOptional<z.ZodBoolean>;
225
+ workspace: z.ZodOptional<z.ZodString>;
232
226
  name: z.ZodOptional<z.ZodString>;
233
227
  template: z.ZodOptional<z.ZodEnum<{
228
+ minimal: "minimal";
234
229
  hono: "hono";
235
230
  elysia: "elysia";
236
231
  nest: "nest";
@@ -239,46 +234,37 @@ declare const CreateCommandInputSchema: z.ZodObject<{
239
234
  astro: "astro";
240
235
  nuxt: "nuxt";
241
236
  "tanstack-start": "tanstack-start";
242
- turborepo: "turborepo";
243
237
  }>>;
244
- skills: z.ZodOptional<z.ZodBoolean>;
245
- mcp: z.ZodOptional<z.ZodBoolean>;
246
- extension: z.ZodOptional<z.ZodBoolean>;
247
- deploy: z.ZodOptional<z.ZodBoolean>;
248
238
  force: z.ZodOptional<z.ZodBoolean>;
249
239
  }, z.core.$strip>;
250
240
  type CreateCommandInput = z.infer<typeof CreateCommandInputSchema>;
251
241
  //#endregion
252
242
  //#region src/index.d.ts
253
243
  declare const router: {
254
- create: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, import("zod").ZodOptional<import("zod").ZodObject<{
255
- yes: import("zod").ZodOptional<import("zod").ZodBoolean>;
256
- verbose: import("zod").ZodOptional<import("zod").ZodBoolean>;
257
- provider: import("zod").ZodOptional<import("zod").ZodEnum<{
244
+ create: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, z.ZodTuple<[z.ZodOptional<z.ZodString>, z.ZodObject<{
245
+ yes: z.ZodOptional<z.ZodBoolean>;
246
+ verbose: z.ZodOptional<z.ZodBoolean>;
247
+ provider: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
248
+ postgres: "postgres";
258
249
  postgresql: "postgresql";
259
- mysql: "mysql";
260
- sqlite: "sqlite";
261
- sqlserver: "sqlserver";
262
- cockroachdb: "cockroachdb";
250
+ mongo: "mongo";
251
+ mongodb: "mongodb";
252
+ }>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>>;
253
+ authoring: z.ZodOptional<z.ZodEnum<{
254
+ psl: "psl";
255
+ typescript: "typescript";
263
256
  }>>;
264
- packageManager: import("zod").ZodOptional<import("zod").ZodEnum<{
257
+ packageManager: z.ZodOptional<z.ZodEnum<{
265
258
  npm: "npm";
266
259
  pnpm: "pnpm";
267
260
  yarn: "yarn";
268
261
  bun: "bun";
269
- deno: "deno";
270
- }>>;
271
- prismaPostgres: import("zod").ZodOptional<import("zod").ZodBoolean>;
272
- databaseUrl: import("zod").ZodOptional<import("zod").ZodString>;
273
- install: import("zod").ZodOptional<import("zod").ZodBoolean>;
274
- generate: import("zod").ZodOptional<import("zod").ZodBoolean>;
275
- migrateAndSeed: import("zod").ZodOptional<import("zod").ZodBoolean>;
276
- schemaPreset: import("zod").ZodOptional<import("zod").ZodEnum<{
277
- empty: "empty";
278
- basic: "basic";
279
262
  }>>;
280
- name: import("zod").ZodOptional<import("zod").ZodString>;
281
- template: import("zod").ZodOptional<import("zod").ZodEnum<{
263
+ deploy: z.ZodOptional<z.ZodBoolean>;
264
+ workspace: z.ZodOptional<z.ZodString>;
265
+ name: z.ZodOptional<z.ZodString>;
266
+ template: z.ZodOptional<z.ZodEnum<{
267
+ minimal: "minimal";
282
268
  hono: "hono";
283
269
  elysia: "elysia";
284
270
  nest: "nest";
@@ -287,16 +273,11 @@ declare const router: {
287
273
  astro: "astro";
288
274
  nuxt: "nuxt";
289
275
  "tanstack-start": "tanstack-start";
290
- turborepo: "turborepo";
291
276
  }>>;
292
- skills: import("zod").ZodOptional<import("zod").ZodBoolean>;
293
- mcp: import("zod").ZodOptional<import("zod").ZodBoolean>;
294
- extension: import("zod").ZodOptional<import("zod").ZodBoolean>;
295
- deploy: import("zod").ZodOptional<import("zod").ZodBoolean>;
296
- force: import("zod").ZodOptional<import("zod").ZodBoolean>;
297
- }, import("zod/v4/core").$strip>>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
277
+ force: z.ZodOptional<z.ZodBoolean>;
278
+ }, z.core.$strip>], null>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
298
279
  };
299
- declare function createCreatePrismaCli(): import("trpc-cli").TrpcCli;
280
+ declare function createCreatePrismaCli(): trpc_cli0.TrpcCli;
300
281
  declare function create(input?: CreateCommandInput): Promise<void>;
301
282
  //#endregion
302
- export { type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, SchemaPresetSchema, create, createCreatePrismaCli, router };
283
+ export { AuthoringStyleSchema, type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
package/dist/index.mjs CHANGED
@@ -1,3 +1,36 @@
1
1
  #!/usr/bin/env node
2
- import { a as CreateTemplateSchema, c as PackageManagerSchema, i as CreateCommandInputSchema, l as SchemaPresetSchema, n as createCreatePrismaCli, o as DatabaseProviderSchema, r as router, s as DatabaseUrlSchema, t as create } from "./src-B3hRLZ0U.mjs";
3
- export { CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, SchemaPresetSchema, create, createCreatePrismaCli, router };
2
+ import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-BeMLn0T7.mjs";
3
+ import { os } from "@orpc/server";
4
+ import { createCli } from "trpc-cli";
5
+ import { z } from "zod";
6
+
7
+ //#region src/index.ts
8
+ const CLI_VERSION = "0.8.0-pr.56.216.1";
9
+ const CreateCliInputSchema = z.tuple([z.string().trim().min(1, "Please enter a valid project name").optional().describe("Project name / directory"), CreateCommandInputSchema]);
10
+ function normalizeCreateCliInput(input) {
11
+ const [projectName, options] = input;
12
+ return {
13
+ ...options,
14
+ name: options.name ?? projectName
15
+ };
16
+ }
17
+ const router = os.router({ create: os.meta({
18
+ description: "Create a new project with Prisma setup",
19
+ default: true,
20
+ negateBooleans: true
21
+ }).input(CreateCliInputSchema).handler(async ({ input }) => {
22
+ await runCreateCommand(normalizeCreateCliInput(input));
23
+ }) });
24
+ function createCreatePrismaCli() {
25
+ return createCli({
26
+ router,
27
+ name: "create-prisma",
28
+ version: CLI_VERSION
29
+ });
30
+ }
31
+ async function create(input = {}) {
32
+ await runCreateCommand(input);
33
+ }
34
+
35
+ //#endregion
36
+ export { AuthoringStyleSchema, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.7.2",
3
+ "version": "0.8.0-pr.56.216.1",
4
4
  "private": false,
5
- "description": "Create Prisma 7 projects with first-party templates and great DX.",
5
+ "description": "Create Prisma 8 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
7
7
  "bugs": {
8
8
  "url": "https://github.com/prisma/create-prisma/issues"
@@ -33,9 +33,12 @@
33
33
  }
34
34
  },
35
35
  "scripts": {
36
- "build": "tsdown --config-loader native",
37
- "dev": "tsdown --config-loader native --watch",
36
+ "build": "tsdown",
37
+ "dev": "tsdown --watch",
38
38
  "start": "bun run ./dist/cli.mjs",
39
+ "test": "bun run test:unit && bun run test:e2e",
40
+ "test:unit": "bun test ./tests/dependencies.test.ts ./tests/deploy-with-composer.test.ts ./tests/install.test.ts ./tests/node-version.test.ts ./tests/setup-prisma.test.ts ./tests/telemetry.test.ts",
41
+ "test:e2e": "bun test --timeout 180000 ./tests/e2e/create-prisma.e2e.test.ts",
39
42
  "check": "bun run format:check && bun run lint",
40
43
  "lint": "oxlint . --deny-warnings",
41
44
  "lint:fix": "oxlint . --fix",
@@ -47,28 +50,30 @@
47
50
  "release-notes": "bunx changelogithub"
48
51
  },
49
52
  "dependencies": {
50
- "@clack/prompts": "^1.6.0",
51
- "@orpc/server": "^1.14.6",
53
+ "@clack/prompts": "^1.7.0",
54
+ "@orpc/server": "^1.13.5",
52
55
  "execa": "^9.6.1",
53
- "fs-extra": "^11.3.5",
54
- "handlebars": "^4.7.9",
55
- "posthog-node": "^5.38.2",
56
- "trpc-cli": "^0.15.1",
57
- "zod": "^4.4.3"
56
+ "fs-extra": "^11.3.3",
57
+ "handlebars": "^4.7.8",
58
+ "posthog-node": "^5.28.2",
59
+ "trpc-cli": "^0.12.4",
60
+ "zod": "^4.3.6"
58
61
  },
59
62
  "devDependencies": {
60
- "@types/bun": "^1.3.14",
63
+ "@prisma/dev": "0.24.7",
64
+ "@types/bun": "^1.3.9",
61
65
  "@types/fs-extra": "^11.0.4",
62
- "@types/node": "^26.0.0",
66
+ "@types/node": "^25.3.0",
63
67
  "changelogithub": "^14.0.0",
64
- "oxfmt": "^0.56.0",
65
- "oxlint": "^1.71.0",
66
- "tsdown": "^0.22.3",
67
- "typescript": "^6.0.3"
68
+ "mongodb-memory-server": "11.1.0",
69
+ "oxfmt": "^0.37.0",
70
+ "oxlint": "^1.52.0",
71
+ "tsdown": "^0.20.3",
72
+ "typescript": "^5.9.3"
68
73
  },
69
74
  "engines": {
70
75
  "bun": ">=1.3.0",
71
- "node": ">=18.0.0"
76
+ "node": ">=22.18.0"
72
77
  },
73
- "packageManager": "bun@1.3.14"
78
+ "packageManager": "bun@1.3.9"
74
79
  }
@@ -0,0 +1,11 @@
1
+ {{#if (eq authoring "typescript")}}
2
+ src/prisma/generated/contract.json linguist-generated
3
+ src/prisma/generated/contract.d.ts linguist-generated
4
+ {{else}}
5
+ src/prisma/contract.json linguist-generated
6
+ src/prisma/contract.d.ts linguist-generated
7
+ {{/if}}
8
+ src/prisma/ops.json linguist-generated
9
+ src/prisma/migration.json linguist-generated
10
+ migrations/snapshots/**/contract.json linguist-generated
11
+ migrations/snapshots/**/contract.d.ts linguist-generated
@@ -0,0 +1,39 @@
1
+ # {{projectName}}
2
+
3
+ A minimal {{template}} app with Prisma 8 and Prisma Composer.
4
+
5
+ ## Run locally
6
+
7
+ ```bash
8
+ {{runScriptCommand packageManager "dev:composer"}}
9
+ ```
10
+
11
+ This builds the app and starts it with Composer. PostgreSQL projects get a local Prisma Postgres database and apply the contract automatically.
12
+
13
+ ## Deploy
14
+
15
+ ```bash
16
+ {{runScriptCommand packageManager "deploy"}}
17
+ ```
18
+
19
+ The deploy script builds the framework output, provisions Prisma Postgres when selected, applies migrations, and deploys the app to Prisma Compute.
20
+
21
+ The starter users are inserted idempotently from `src/prisma/seed.ts` on the first database query through the Composer service binding.
22
+
23
+ {{#if (eq provider "mongo")}}
24
+ MongoDB is not provisioned by Composer. Set `MONGODB_URL` before running Composer locally or deploying.
25
+ {{/if}}
26
+
27
+ ## Prisma
28
+
29
+ - Contract: `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
30
+ - Prisma and Composer config: `prisma.config.ts`
31
+ - Composer app: `module.ts` and `service.ts`
32
+
33
+ After changing the contract, run:
34
+
35
+ ```bash
36
+ {{runScriptCommand packageManager "contract:emit"}}
37
+ ```
38
+
39
+ To use the framework's development server directly, run `{{runScriptCommand packageManager "dev"}}`. This direct mode requires `DATABASE_URL`.
@@ -0,0 +1,28 @@
1
+ import { module } from "@prisma/composer";
2
+ {{#if (eq provider "postgres")}}
3
+ import { pnPostgres } from "@prisma/composer-prisma-cloud/prisma-next";
4
+
5
+ import { appContract } from "./src/prisma/composer.ts";
6
+ {{else}}
7
+ import { envSecret } from "@prisma/composer-prisma-cloud";
8
+ {{/if}}
9
+ import app from "./service.ts";
10
+
11
+ export default module("{{projectName}}", ({ provision }) => {
12
+ {{#if (eq provider "postgres")}}
13
+ const database = provision(
14
+ pnPostgres({
15
+ name: "database",
16
+ contract: appContract,
17
+ config: "./prisma.config.ts",
18
+ }),
19
+ { id: "database" },
20
+ );
21
+
22
+ provision(app, { deps: { database } });
23
+ {{else}}
24
+ provision(app, {
25
+ input: { databaseUrl: envSecret("MONGODB_URL") },
26
+ });
27
+ {{/if}}
28
+ });
@@ -0,0 +1,16 @@
1
+ {{#if (eq packageManager "pnpm")}}
2
+ allowBuilds:
3
+ esbuild: true
4
+ msgpackr-extract: true
5
+ {{#if (eq template "next")}}
6
+ sharp: true
7
+ unrs-resolver: true
8
+ {{else if (eq template "astro")}}
9
+ sharp: true
10
+ {{/if}}
11
+ workerd: true
12
+ minimumReleaseAgeExclude:
13
+ - "@prisma/*"
14
+ overrides:
15
+ effect: "4.0.0-beta.103"
16
+ {{/if}}
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "@prisma/composer/config";
2
+ import { nodeBuild } from "@prisma/composer/node/control";
3
+ {{#if (eq template "next")}}
4
+ import { nextjsBuild } from "@prisma/composer/nextjs/control";
5
+ {{/if}}
6
+ import { prismaCloud, prismaState } from "@prisma/composer-prisma-cloud/control";
7
+
8
+ export default defineConfig({
9
+ extensions: [prismaCloud(), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
10
+ state: prismaState(),
11
+ });
@@ -0,0 +1,17 @@
1
+ import { definePrismaConfig } from "@prisma/cli-engine";
2
+ import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
3
+
4
+ export default definePrismaConfig({
5
+ orm: ormConfig({
6
+ contract: "./src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}",
7
+ {{#if (eq authoring "typescript")}}
8
+ output: "./src/prisma/generated",
9
+ {{/if}}
10
+ db: {
11
+ connection: process.env.{{#if (eq provider "postgres")}}DATABASE_URL{{else}}MONGODB_URL{{/if}}!,
12
+ },
13
+ }),
14
+ composer: {
15
+ configPath: "./prisma-composer.config.ts",
16
+ },
17
+ });
@@ -0,0 +1,42 @@
1
+ {{#if (eq template "next")}}
2
+ import nextjs from "@prisma/composer/nextjs";
3
+ {{else}}
4
+ import node from "@prisma/composer/node";
5
+ {{/if}}
6
+ {{#if (eq provider "mongo")}}
7
+ import { secretString } from "@prisma/composer/arktype";
8
+ import { type } from "arktype";
9
+ {{/if}}
10
+ import { compute } from "@prisma/composer-prisma-cloud";
11
+ {{#if (eq provider "postgres")}}
12
+ import { pnPostgres } from "@prisma/composer-prisma-cloud/prisma-next";
13
+
14
+ import { appContract } from "./src/prisma/composer.ts";
15
+ {{/if}}
16
+
17
+ export default compute({
18
+ name: "app",
19
+ deps: {
20
+ {{#if (eq provider "postgres")}}
21
+ database: pnPostgres(appContract),
22
+ {{/if}}
23
+ },
24
+ {{#if (eq provider "mongo")}}
25
+ input: type({
26
+ databaseUrl: secretString(),
27
+ }),
28
+ {{/if}}
29
+ {{#if (eq template "next")}}
30
+ build: nextjs({ module: import.meta.url, appDir: "." }),
31
+ {{else if (eq template "svelte")}}
32
+ build: node({ module: import.meta.url, dir: "./build", entry: "index.js" }),
33
+ {{else if (eq template "astro")}}
34
+ build: node({ module: import.meta.url, dir: "./dist", entry: "server/entry.mjs" }),
35
+ {{else if (eq template "nuxt")}}
36
+ build: node({ module: import.meta.url, dir: "./.output", entry: "server/index.mjs" }),
37
+ {{else if (eq template "tanstack-start")}}
38
+ build: node({ module: import.meta.url, dir: "./.output", entry: "server/index.mjs" }),
39
+ {{else}}
40
+ build: node({ module: import.meta.url, entry: "./dist/server.mjs" }),
41
+ {{/if}}
42
+ });
@@ -0,0 +1,8 @@
1
+ {{#if (eq provider "postgres")}}
2
+ import { pnContract } from "@prisma/composer-prisma-cloud/prisma-next";
3
+
4
+ import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
5
+ import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
6
+
7
+ export const appContract = pnContract<Contract>(contractJson);
8
+ {{/if}}
@@ -0,0 +1,51 @@
1
+ {{#if (eq provider "postgres")}}
2
+ import postgres from "@prisma/orm-postgres/runtime";
3
+
4
+ import service from "../../service.ts";
5
+ import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
6
+ import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
7
+
8
+ function loadComposerDatabase() {
9
+ try {
10
+ return service.load().database.client;
11
+ } catch {
12
+ return undefined;
13
+ }
14
+ }
15
+
16
+ export const db =
17
+ loadComposerDatabase() ??
18
+ (process.env.DATABASE_URL
19
+ ? postgres<Contract>({ contractJson, url: process.env.DATABASE_URL })
20
+ : postgres<Contract>({ contractJson }));
21
+ {{else}}
22
+ import mongo from "@prisma/orm-mongo/runtime";
23
+
24
+ import service from "../../service.ts";
25
+ import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
26
+ import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
27
+
28
+ function getDatabaseUrl(): string | undefined {
29
+ try {
30
+ return service.input().databaseUrl.expose();
31
+ } catch {
32
+ return process.env.DATABASE_URL;
33
+ }
34
+ }
35
+
36
+ const databaseUrl = getDatabaseUrl();
37
+
38
+ export const db = databaseUrl
39
+ ? mongo<Contract>({ contractJson, url: databaseUrl })
40
+ : mongo<Contract>({ contractJson });
41
+ {{/if}}
42
+
43
+ let connection: Promise<void> | undefined;
44
+
45
+ export function connectDatabase(): Promise<void> {
46
+ connection ??= db.connect().then(() => undefined).catch((error: unknown) => {
47
+ connection = undefined;
48
+ throw error;
49
+ });
50
+ return connection;
51
+ }
@@ -0,0 +1,36 @@
1
+ import { connectDatabase, db } from "./db.ts";
2
+
3
+ const users = [
4
+ { email: "alice@prisma.io", username: "alice", name: "Alice" },
5
+ { email: "bob@prisma.io", username: "bob", name: "Bob" },
6
+ { email: "carol@prisma.io", username: "carol", name: "Carol" },
7
+ ];
8
+
9
+ let pendingSeed: Promise<void> | undefined;
10
+
11
+ async function runSeed(): Promise<void> {
12
+ await connectDatabase();
13
+
14
+ {{#if (eq provider "mongo")}}
15
+ for (const user of users) {
16
+ const existingUser = await db.orm.users.where({ email: user.email }).first();
17
+ if (!existingUser) await db.orm.users.create(user);
18
+ }
19
+ {{else}}
20
+ for (const user of users) {
21
+ await db.orm.public.User.upsert({
22
+ create: user,
23
+ update: {},
24
+ conflictOn: { email: user.email },
25
+ });
26
+ }
27
+ {{/if}}
28
+ }
29
+
30
+ export function seed(): Promise<void> {
31
+ pendingSeed ??= runSeed().catch((error: unknown) => {
32
+ pendingSeed = undefined;
33
+ throw error;
34
+ });
35
+ return pendingSeed;
36
+ }
@@ -0,0 +1,35 @@
1
+ import { db } from "./db.ts";
2
+ import { seed } from "./seed.ts";
3
+
4
+ export { db };
5
+
6
+ export async function listUsers(limit = 10) {
7
+ await seed();
8
+ {{#if (eq provider "mongo")}}
9
+ const users = [];
10
+
11
+ for await (const user of db.orm.users.select("_id", "email", "username", "name").take(limit).all()) {
12
+ users.push({
13
+ id: String(user._id),
14
+ email: user.email,
15
+ username: user.username ?? null,
16
+ name: user.name ?? null,
17
+ createdAt: null as Date | null,
18
+ });
19
+ }
20
+
21
+ return users;
22
+ {{else}}
23
+ const users = await db.orm.public.User.select("id", "email", "username", "name", "createdAt").take(limit).all();
24
+
25
+ return users.map((user) => ({
26
+ id: String(user.id),
27
+ email: user.email,
28
+ username: user.username ?? null,
29
+ name: user.name ?? null,
30
+ createdAt: user.createdAt,
31
+ }));
32
+ {{/if}}
33
+ }
34
+
35
+ export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
@@ -1,10 +1,9 @@
1
1
  // @ts-check
2
- import { defineConfig } from "astro/config";
3
2
  import node from "@astrojs/node";
3
+ import { defineConfig } from "astro/config";
4
4
 
5
5
  // https://astro.build/config
6
6
  export default defineConfig({
7
7
  output: "server",
8
8
  adapter: node({ mode: "standalone" }),
9
- server: { host: true },
10
9
  });
@@ -12,12 +12,12 @@
12
12
  "astro": "astro"
13
13
  },
14
14
  "dependencies": {
15
- "@astrojs/node": "^11.0.0",
16
- "astro": "^7.0.0"
15
+ "astro": "^6.3.3"
17
16
  },
18
17
  "devDependencies": {
19
- "@types/node": "^26.0.0",
20
- "tsx": "^4.22.4",
21
- "typescript": "^6.0.3"
18
+ "@types/node": "^24.3.0",
19
+ "tsx": "^4.7.1",
20
+ "typescript": "^5.9.3",
21
+ "vite": "^8.1.2"
22
22
  }
23
23
  }