create-prisma 0.7.1-pr.52.181.1 → 0.7.2

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 (129) hide show
  1. package/README.md +25 -19
  2. package/dist/cli.mjs +2 -32
  3. package/dist/index.d.mts +25 -1
  4. package/dist/index.mjs +2 -2290
  5. package/dist/src-B3hRLZ0U.mjs +2527 -0
  6. package/package.json +2 -4
  7. package/templates/create/astro/README.md.hbs +14 -7
  8. package/templates/create/astro/astro.config.mjs.hbs +0 -11
  9. package/templates/create/astro/deno.json.hbs +5 -0
  10. package/templates/create/astro/prisma/schema.prisma.hbs +5 -0
  11. package/templates/create/astro/prisma/seed.ts.hbs +5 -1
  12. package/templates/create/astro/prisma.compute.ts.hbs +10 -0
  13. package/templates/create/astro/src/lib/prisma.ts.hbs +4 -18
  14. package/templates/create/astro/src/pages/api/users.ts.hbs +11 -1
  15. package/templates/create/astro/src/pages/index.astro.hbs +176 -36
  16. package/templates/create/elysia/README.md.hbs +13 -7
  17. package/templates/create/elysia/deno.json.hbs +5 -0
  18. package/templates/create/elysia/package.json.hbs +3 -4
  19. package/templates/create/elysia/prisma/schema.prisma.hbs +6 -0
  20. package/templates/create/elysia/prisma/seed.ts.hbs +5 -1
  21. package/templates/create/elysia/prisma.compute.ts.hbs +11 -0
  22. package/templates/create/elysia/src/index.ts.hbs +17 -13
  23. package/templates/create/elysia/src/lib/prisma.ts.hbs +4 -18
  24. package/templates/create/elysia/tsconfig.json +0 -1
  25. package/templates/create/hono/README.md.hbs +13 -7
  26. package/templates/create/hono/deno.json.hbs +5 -0
  27. package/templates/create/hono/package.json.hbs +2 -2
  28. package/templates/create/hono/prisma/schema.prisma.hbs +6 -0
  29. package/templates/create/hono/prisma/seed.ts.hbs +5 -1
  30. package/templates/create/hono/prisma.compute.ts.hbs +10 -0
  31. package/templates/create/hono/src/index.ts.hbs +7 -9
  32. package/templates/create/hono/src/lib/prisma.ts.hbs +4 -18
  33. package/templates/create/hono/tsconfig.json +0 -1
  34. package/templates/create/nest/README.md.hbs +12 -6
  35. package/templates/create/nest/deno.json.hbs +5 -0
  36. package/templates/create/nest/package.json.hbs +2 -2
  37. package/templates/create/nest/prisma/schema.prisma.hbs +6 -0
  38. package/templates/create/nest/prisma/seed.ts.hbs +5 -1
  39. package/templates/create/nest/prisma.compute.ts.hbs +10 -0
  40. package/templates/create/nest/src/app.controller.ts.hbs +1 -6
  41. package/templates/create/nest/src/app.module.ts.hbs +14 -7
  42. package/templates/create/nest/src/lib/prisma.ts.hbs +4 -17
  43. package/templates/create/nest/src/main.ts.hbs +6 -2
  44. package/templates/create/nest/src/prisma.service.ts.hbs +2 -2
  45. package/templates/create/nest/src/users.controller.ts.hbs +3 -1
  46. package/templates/create/nest/src/users.service.ts.hbs +3 -1
  47. package/templates/create/nest/tsconfig.json +0 -1
  48. package/templates/create/next/README.md.hbs +11 -7
  49. package/templates/create/next/deno.json.hbs +12 -0
  50. package/templates/create/next/prisma/schema.prisma.hbs +5 -0
  51. package/templates/create/next/prisma/seed.ts.hbs +5 -1
  52. package/templates/create/next/prisma.compute.ts.hbs +9 -0
  53. package/templates/create/next/src/app/globals.css +122 -0
  54. package/templates/create/next/src/app/layout.tsx.hbs +2 -2
  55. package/templates/create/next/src/app/page.tsx.hbs +58 -34
  56. package/templates/create/next/src/lib/prisma.ts.hbs +4 -18
  57. package/templates/create/nuxt/README.md.hbs +11 -7
  58. package/templates/create/nuxt/app/pages/index.vue.hbs +175 -43
  59. package/templates/create/nuxt/deno.json.hbs +5 -0
  60. package/templates/create/nuxt/nuxt.config.ts +0 -1
  61. package/templates/create/nuxt/prisma/schema.prisma.hbs +5 -0
  62. package/templates/create/nuxt/prisma/seed.ts.hbs +5 -1
  63. package/templates/create/nuxt/prisma.compute.ts.hbs +9 -0
  64. package/templates/create/nuxt/server/api/users.get.ts.hbs +6 -0
  65. package/templates/create/nuxt/server/utils/prisma.ts.hbs +4 -18
  66. package/templates/create/svelte/README.md.hbs +13 -4
  67. package/templates/create/svelte/deno.json.hbs +5 -0
  68. package/templates/create/svelte/package.json.hbs +1 -2
  69. package/templates/create/svelte/prisma/schema.prisma.hbs +5 -0
  70. package/templates/create/svelte/prisma/seed.ts.hbs +5 -1
  71. package/templates/create/svelte/src/lib/server/prisma.ts.hbs +2 -18
  72. package/templates/create/svelte/src/routes/+layout.svelte +0 -1
  73. package/templates/create/svelte/src/routes/+page.server.ts.hbs +7 -1
  74. package/templates/create/svelte/src/routes/+page.svelte.hbs +297 -41
  75. package/templates/create/svelte/svelte.config.js +13 -0
  76. package/templates/create/svelte/vite.config.ts +0 -3
  77. package/templates/create/tanstack-start/README.md.hbs +11 -7
  78. package/templates/create/tanstack-start/deno.json.hbs +13 -0
  79. package/templates/create/tanstack-start/prisma/schema.prisma.hbs +5 -0
  80. package/templates/create/tanstack-start/prisma/seed.ts.hbs +5 -1
  81. package/templates/create/tanstack-start/prisma.compute.ts.hbs +9 -0
  82. package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +4 -18
  83. package/templates/create/tanstack-start/src/routes/__root.tsx.hbs +29 -4
  84. package/templates/create/tanstack-start/src/routes/index.tsx.hbs +76 -35
  85. package/templates/create/tanstack-start/src/styles.css +146 -0
  86. package/templates/create/tanstack-start/tsconfig.json +1 -1
  87. package/templates/create/turborepo/README.md.hbs +9 -7
  88. package/templates/create/turborepo/apps/api/package.json.hbs +9 -2
  89. package/templates/create/turborepo/apps/api/src/index.ts.hbs +12 -28
  90. package/templates/create/turborepo/apps/api/tsconfig.json +0 -1
  91. package/templates/create/turborepo/deno.json.hbs +5 -0
  92. package/templates/create/turborepo/package.json.hbs +6 -0
  93. package/templates/create/turborepo/packages/db/package.json.hbs +5 -4
  94. package/templates/create/turborepo/packages/db/prisma/schema.prisma.hbs +5 -0
  95. package/templates/create/turborepo/packages/db/prisma/seed.ts.hbs +5 -1
  96. package/templates/create/turborepo/packages/db/src/client.ts.hbs +5 -2
  97. package/templates/create/turborepo/packages/db/tsconfig.json +0 -1
  98. package/templates/create/turborepo/prisma.compute.ts.hbs +14 -0
  99. package/templates/create/astro/module.ts.hbs +0 -30
  100. package/templates/create/astro/prisma-composer.config.ts.hbs +0 -8
  101. package/templates/create/astro/service.ts.hbs +0 -19
  102. package/templates/create/elysia/.yarnrc.yml.hbs +0 -3
  103. package/templates/create/elysia/module.ts.hbs +0 -30
  104. package/templates/create/elysia/prisma-composer.config.ts.hbs +0 -8
  105. package/templates/create/elysia/service.ts.hbs +0 -19
  106. package/templates/create/hono/module.ts.hbs +0 -30
  107. package/templates/create/hono/prisma-composer.config.ts.hbs +0 -8
  108. package/templates/create/hono/service.ts.hbs +0 -19
  109. package/templates/create/nest/module.ts.hbs +0 -30
  110. package/templates/create/nest/prisma-composer.config.ts.hbs +0 -8
  111. package/templates/create/nest/src/service.ts.hbs +0 -19
  112. package/templates/create/next/module.ts.hbs +0 -30
  113. package/templates/create/next/prisma-composer.config.ts.hbs +0 -8
  114. package/templates/create/next/service.ts.hbs +0 -19
  115. package/templates/create/nuxt/module.ts.hbs +0 -30
  116. package/templates/create/nuxt/prisma-composer.config.ts.hbs +0 -8
  117. package/templates/create/nuxt/service.ts.hbs +0 -19
  118. package/templates/create/svelte/module.ts.hbs +0 -30
  119. package/templates/create/svelte/prisma-composer.config.ts.hbs +0 -8
  120. package/templates/create/svelte/service.ts.hbs +0 -19
  121. package/templates/create/svelte/svelte.config.js.hbs +0 -10
  122. package/templates/create/tanstack-start/module.ts.hbs +0 -30
  123. package/templates/create/tanstack-start/prisma-composer.config.ts.hbs +0 -8
  124. package/templates/create/tanstack-start/service.ts.hbs +0 -19
  125. package/templates/create/turborepo/apps/api/src/service.ts.hbs +0 -19
  126. package/templates/create/turborepo/module.ts.hbs +0 -30
  127. package/templates/create/turborepo/prisma-composer.config.ts.hbs +0 -8
  128. package/templates/shared/setup-composer-postgres.mjs.hbs +0 -179
  129. package/templates/shared/starter.css +0 -276
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.7.1-pr.52.181.1",
3
+ "version": "0.7.2",
4
4
  "private": false,
5
5
  "description": "Create Prisma 7 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -41,7 +41,6 @@
41
41
  "lint:fix": "oxlint . --fix",
42
42
  "format": "oxfmt --write .",
43
43
  "format:check": "oxfmt --check .",
44
- "test": "bun test",
45
44
  "typecheck": "tsc --noEmit",
46
45
  "bump": "bun run scripts/bump-version.ts",
47
46
  "release": "bun run bump",
@@ -55,7 +54,6 @@
55
54
  "handlebars": "^4.7.9",
56
55
  "posthog-node": "^5.38.2",
57
56
  "trpc-cli": "^0.15.1",
58
- "yaml": "^2.8.2",
59
57
  "zod": "^4.4.3"
60
58
  },
61
59
  "devDependencies": {
@@ -70,7 +68,7 @@
70
68
  },
71
69
  "engines": {
72
70
  "bun": ">=1.3.0",
73
- "node": ">=24.0.0"
71
+ "node": ">=18.0.0"
74
72
  },
75
73
  "packageManager": "bun@1.3.14"
76
74
  }
@@ -8,7 +8,9 @@ Generated by `create-prisma` with the Astro template.
8
8
  - `{{runScriptCommand packageManager "build"}}` - build for production
9
9
  - `{{runScriptCommand packageManager "preview"}}` - preview the production build
10
10
  - `{{runScriptCommand packageManager "astro"}}` - run Astro CLI commands
11
- - `{{runScriptCommand packageManager "deploy"}}` - build and deploy with Prisma Composer
11
+ {{#if compute}}
12
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
13
+ {{/if}}
12
14
 
13
15
  ## Prisma
14
16
 
@@ -19,9 +21,7 @@ Prisma setup is scaffolded automatically in:
19
21
  - `src/lib/prisma.ts`
20
22
  - `src/pages/api/users.ts`
21
23
  - `prisma.config.ts`
22
- - `module.ts`
23
- - `service.ts`
24
- - `prisma-composer.config.ts`
24
+ - `prisma.compute.ts`
25
25
  - `src/generated/prisma`
26
26
 
27
27
  Database helper scripts are added to `package.json`:
@@ -30,11 +30,18 @@ Database helper scripts are added to `package.json`:
30
30
  - `db:push`
31
31
  - `db:migrate`
32
32
  - `db:seed`
33
+ {{#if (eq schemaPreset "basic")}}
33
34
 
34
35
  The starter page queries a basic `User` model in `src/pages/index.astro`, and `src/pages/api/users.ts` shows an Astro API route backed by the same Prisma client.
36
+ {{else}}
35
37
 
36
- ## Prisma Composer
38
+ The starter page keeps the official Astro minimal structure and points you to `prisma/schema.prisma` for your first model.
39
+ {{/if}}
40
+ {{#if compute}}
37
41
 
38
- The application topology is declared in `module.ts` and `service.ts`, with deploy configuration in `prisma-composer.config.ts`. {{#if composerPostgres}}Composer provisions Prisma Postgres and injects its connection into the service.{{else}}The database URL is bound as a secret service input from `.env`.{{/if}}
42
+ ## Prisma Compute
39
43
 
40
- If needed, sign in with `{{prismaAuthLoginCommand packageManager}}`. Run `{{runScriptCommand packageManager "deploy"}}` to deploy later changes.
44
+ This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
45
+
46
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
47
+ {{/if}}
@@ -7,15 +7,4 @@ export default defineConfig({
7
7
  output: "server",
8
8
  adapter: node({ mode: "standalone" }),
9
9
  server: { host: true },
10
- vite: {
11
- ssr: {
12
- // Bundle SSR dependencies into the server entry. Astro's standalone
13
- // build emits `import { parse, serialize } from "cookie"`, and the Bun
14
- // runtime on Prisma Compute cannot resolve those named exports from
15
- // cookie's CommonJS build at runtime (SyntaxError: Export named 'parse'
16
- // not found). Bundling resolves the imports at build time. Remove once
17
- // the Bun/cookie CJS named-export interop is fixed upstream.
18
- noExternal: true,
19
- },
20
- },
21
10
  });
@@ -0,0 +1,5 @@
1
+ {{#if (eq packageManager "deno")}}
2
+ {
3
+ "nodeModulesDir": "auto"
4
+ }
5
+ {{/if}}
@@ -1,11 +1,15 @@
1
1
  generator client {
2
2
  provider = "prisma-client"
3
3
  output = "../src/generated/prisma"
4
+ {{#if (eq packageManager "deno")}}
5
+ runtime = "deno"
6
+ {{/if}}
4
7
  }
5
8
 
6
9
  datasource db {
7
10
  provider = "{{provider}}"
8
11
  }
12
+ {{#if (eq schemaPreset "basic")}}
9
13
 
10
14
  model User {
11
15
  id String @id @default(cuid())
@@ -14,3 +18,4 @@ model User {
14
18
  createdAt DateTime @default(now())
15
19
  updatedAt DateTime @updatedAt
16
20
  }
21
+ {{/if}}
@@ -1,6 +1,7 @@
1
- import prisma from "../src/lib/prisma";
1
+ import prisma from "../src/lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
2
2
 
3
3
  async function main() {
4
+ {{#if (eq schemaPreset "basic")}}
4
5
  const users = await Promise.all([
5
6
  prisma.user.upsert({
6
7
  where: { email: "alice@prisma.io" },
@@ -21,6 +22,9 @@ async function main() {
21
22
  ]);
22
23
 
23
24
  console.log(`Seeded ${users.length} users.`);
25
+ {{else}}
26
+ console.log("No seed data defined for the empty schema preset.");
27
+ {{/if}}
24
28
  }
25
29
 
26
30
  main()
@@ -0,0 +1,10 @@
1
+ import { defineComputeConfig } from "@prisma/compute-sdk/config";
2
+
3
+ export default defineComputeConfig({
4
+ app: {
5
+ name: "{{projectName}}",
6
+ framework: "astro",
7
+ httpPort: 4321,
8
+ env: ".env",
9
+ },
10
+ });
@@ -1,8 +1,7 @@
1
+ {{#if (requiresDotenvConfigImport this.packageManager)}}
1
2
  import "dotenv/config";
2
-
3
- import service from "../../service";
4
-
5
- import { PrismaClient } from "../generated/prisma/client";
3
+ {{/if}}
4
+ import { PrismaClient } from "../generated/prisma/client{{#if (eq packageManager "deno")}}.ts{{/if}}";
6
5
  {{#if (eq provider "postgresql")}}
7
6
  import { PrismaPg } from "@prisma/adapter-pg";
8
7
  {{/if}}
@@ -19,20 +18,7 @@ import { {{sqliteAdapterClass this.packageManager}} } from "{{sqliteAdapterPacka
19
18
  import { PrismaMssql } from "@prisma/adapter-mssql";
20
19
  {{/if}}
21
20
 
22
- function getComposerDatabaseUrl(): string | undefined {
23
- try {
24
- {{#if composerPostgres}}
25
- return service.load().database.url;
26
- {{else}}
27
- return service.input().databaseUrl.expose();
28
- {{/if}}
29
- } catch {
30
- return undefined;
31
- }
32
- }
33
-
34
- const rawDatabaseUrl = getComposerDatabaseUrl() ?? import.meta.env?.DATABASE_URL ?? process.env.DATABASE_URL;
35
-
21
+ const rawDatabaseUrl = {{#if (eq packageManager "deno")}}process.env.DATABASE_URL{{else}}import.meta.env?.DATABASE_URL ?? process.env.DATABASE_URL{{/if}};
36
22
  {{#if (eq provider "sqlite")}}
37
23
  const databaseUrl = (rawDatabaseUrl ?? "").trim() || "file:./dev.db";
38
24
  {{else}}
@@ -1,5 +1,5 @@
1
1
  import type { APIRoute } from "astro";
2
-
2
+ {{#if (eq schemaPreset "basic")}}
3
3
  import prisma from "../../lib/prisma";
4
4
 
5
5
  export const GET: APIRoute = async () => {
@@ -30,3 +30,13 @@ export const GET: APIRoute = async () => {
30
30
  },
31
31
  });
32
32
  };
33
+ {{else}}
34
+
35
+ export const GET: APIRoute = async () => {
36
+ return new Response(JSON.stringify([]), {
37
+ headers: {
38
+ "Content-Type": "application/json",
39
+ },
40
+ });
41
+ };
42
+ {{/if}}
@@ -1,9 +1,10 @@
1
1
  ---
2
+ {{#if (eq schemaPreset "basic")}}
2
3
  import prisma from "../lib/prisma";
3
- import "../styles.css";
4
4
 
5
5
  const formatter = new Intl.DateTimeFormat("en", {
6
6
  dateStyle: "medium",
7
+ timeStyle: "short",
7
8
  });
8
9
 
9
10
  const users = await prisma.user
@@ -14,6 +15,7 @@ const users = await prisma.user
14
15
  },
15
16
  })
16
17
  .catch(() => undefined);
18
+ {{/if}}
17
19
  ---
18
20
 
19
21
  <html lang="en">
@@ -22,49 +24,41 @@ const users = await prisma.user
22
24
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
23
25
  <meta name="viewport" content="width=device-width" />
24
26
  <meta name="generator" content={Astro.generator} />
25
- <meta name="description" content="A minimal Prisma starter generated by create-prisma." />
26
- <title>{{projectName}} · Prisma</title>
27
+ <title>create-prisma + astro</title>
27
28
  </head>
28
29
  <body>
29
30
  <main class="shell">
30
- <header class="intro">
31
- <div class="product">
32
- <span class="product-mark" aria-hidden="true">P</span>
33
- <span class="product-name">{{projectName}}</span>
34
- <span class="framework">Astro</span>
35
- </div>
36
- <h1>Start building with Prisma.</h1>
31
+ <div class="hero">
32
+ <p class="eyebrow">Astro + Prisma 7</p>
33
+ {{#if (eq schemaPreset "basic")}}
34
+ <h1>Users from your database, loaded on the server.</h1>
37
35
  <p class="lede">
38
- Your app is connected and ready to query. The latest users from your database are shown
39
- below.
36
+ This page reads from <code>src/pages/index.astro</code> using the Prisma instance in
37
+ <code>src/lib/prisma.ts</code>. An Astro API route is also scaffolded in
38
+ <code>src/pages/api/users.ts</code>.
40
39
  </p>
41
- </header>
40
+ </div>
42
41
 
43
- <section class="user-panel" aria-labelledby="users-heading">
42
+ <section class="panel">
44
43
  <div class="panel-header">
45
- <div class="panel-title">
46
- <h2 id="users-heading">Users</h2>
47
- <p>Latest records</p>
48
- </div>
49
- <span class="count">{users?.length ?? 0}</span>
44
+ <h2>Seeded users</h2>
45
+ <span>{users?.length ?? 0} total</span>
50
46
  </div>
51
47
 
52
48
  {!users ? (
53
- <p class="empty-state">
54
- The database is not ready yet. Check the setup steps in <code>README.md</code>.
49
+ <p class="empty">
50
+ Could not query users yet. Run <code>db:migrate</code>, then <code>db:seed</code>,
51
+ then refresh.
55
52
  </p>
56
53
  ) : users.length === 0 ? (
57
- <p class="empty-state">No users yet. Run <code>db:seed</code>, then refresh.</p>
54
+ <p class="empty">No users yet. Run <code>db:seed</code> after your first migration.</p>
58
55
  ) : (
59
- <ul class="user-list">
56
+ <ul class="users">
60
57
  {users.map((user) => (
61
- <li class="user-row">
62
- <span class="avatar" aria-hidden="true">
63
- {(user.name ?? user.email).charAt(0).toUpperCase()}
64
- </span>
65
- <div class="user-copy">
66
- <p class="user-name">{user.name ?? "Unnamed user"}</p>
67
- <p class="user-email">{user.email}</p>
58
+ <li>
59
+ <div>
60
+ <strong>{user.name ?? "Unnamed user"}</strong>
61
+ <p>{user.email}</p>
68
62
  </div>
69
63
  <time datetime={user.createdAt.toISOString()}>
70
64
  {formatter.format(user.createdAt)}
@@ -74,13 +68,159 @@ const users = await prisma.user
74
68
  </ul>
75
69
  )}
76
70
  </section>
71
+ {{else}}
72
+ <h1>Your Astro app is ready.</h1>
73
+ <p class="lede">
74
+ Edit <code>prisma/schema.prisma</code>, run <code>db:migrate</code>, then load your data
75
+ in Astro pages or API routes with the Prisma instance in <code>src/lib/prisma.ts</code>.
76
+ </p>
77
+ </div>
78
+
79
+ <section class="panel">
80
+ <div class="panel-header">
81
+ <h2>What's included</h2>
82
+ <span>Starter kit</span>
83
+ </div>
77
84
 
78
- <footer class="footer">
79
- <p>Start with <code>prisma/schema.prisma</code></p>
80
- <a class="docs-link" href="https://pris.ly/d/prisma-schema" target="_blank" rel="noreferrer">
81
- Prisma docs <span aria-hidden="true">↗</span>
82
- </a>
83
- </footer>
85
+ <ul class="users">
86
+ <li>
87
+ <div>
88
+ <strong>Prisma client</strong>
89
+ <p>Use the shared instance from <code>src/lib/prisma.ts</code>.</p>
90
+ </div>
91
+ </li>
92
+ <li>
93
+ <div>
94
+ <strong>API route example</strong>
95
+ <p>See <code>src/pages/api/users.ts</code> for an Astro server endpoint.</p>
96
+ </div>
97
+ </li>
98
+ <li>
99
+ <div>
100
+ <strong>Seed script</strong>
101
+ <p>Run <code>db:seed</code> after your first migration.</p>
102
+ </div>
103
+ </li>
104
+ </ul>
105
+ </section>
106
+ {{/if}}
84
107
  </main>
85
108
  </body>
86
109
  </html>
110
+
111
+ <style>
112
+ :global(body) {
113
+ margin: 0;
114
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
115
+ background: #fff;
116
+ color: #111;
117
+ }
118
+
119
+ .shell {
120
+ max-width: 40rem;
121
+ margin: 0 auto;
122
+ padding: 3rem 1.5rem;
123
+ }
124
+
125
+ .hero {
126
+ margin-bottom: 1.5rem;
127
+ }
128
+
129
+ .eyebrow {
130
+ margin: 0 0 0.5rem;
131
+ color: #666;
132
+ font-size: 0.75rem;
133
+ font-weight: 600;
134
+ letter-spacing: 0.06em;
135
+ text-transform: uppercase;
136
+ }
137
+
138
+ h1 {
139
+ margin: 0;
140
+ font-size: 1.25rem;
141
+ font-weight: 600;
142
+ line-height: 1.4;
143
+ }
144
+
145
+ .lede {
146
+ margin: 0.5rem 0 0;
147
+ color: #666;
148
+ font-size: 0.875rem;
149
+ line-height: 1.6;
150
+ }
151
+
152
+ .panel {
153
+ border: 1px solid #e5e5e5;
154
+ border-radius: 0.5rem;
155
+ padding: 1rem;
156
+ }
157
+
158
+ .panel-header {
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: space-between;
162
+ gap: 1rem;
163
+ margin-bottom: 0.75rem;
164
+ }
165
+
166
+ h2 {
167
+ margin: 0;
168
+ font-size: 0.875rem;
169
+ font-weight: 600;
170
+ }
171
+
172
+ .panel-header span,
173
+ .empty,
174
+ time {
175
+ color: #888;
176
+ font-size: 0.8rem;
177
+ }
178
+
179
+ .panel p {
180
+ color: #666;
181
+ font-size: 0.8rem;
182
+ }
183
+
184
+ .users {
185
+ list-style: none;
186
+ margin: 0;
187
+ padding: 0;
188
+ display: grid;
189
+ gap: 0.5rem;
190
+ }
191
+
192
+ .users li {
193
+ display: flex;
194
+ align-items: center;
195
+ justify-content: space-between;
196
+ gap: 1rem;
197
+ padding: 0.625rem 0.75rem;
198
+ border: 1px solid #eee;
199
+ border-radius: 0.375rem;
200
+ }
201
+
202
+ .users p {
203
+ margin: 0.125rem 0 0;
204
+ }
205
+
206
+ time {
207
+ font-size: 0.75rem;
208
+ white-space: nowrap;
209
+ }
210
+
211
+ code {
212
+ padding: 0.125rem 0.25rem;
213
+ border-radius: 0.25rem;
214
+ background: #f5f5f5;
215
+ font-family: SFMono-Regular, Consolas, monospace;
216
+ font-size: 0.875em;
217
+ }
218
+
219
+ @media (max-width: 640px) {
220
+ .users li,
221
+ .panel-header {
222
+ flex-direction: column;
223
+ align-items: flex-start;
224
+ }
225
+ }
226
+ </style>
@@ -5,9 +5,11 @@ Generated by `create-prisma` with the Elysia template.
5
5
  ## Scripts
6
6
 
7
7
  - `{{runScriptCommand packageManager "dev"}}` - start local dev server with hot reload
8
- - `{{runScriptCommand packageManager "build"}}` - build the production server
9
- - `{{runScriptCommand packageManager "start"}}` - run the production server
10
- - `{{runScriptCommand packageManager "deploy"}}` - build and deploy with Prisma Composer
8
+ - `{{runScriptCommand packageManager "build"}}` - {{#if (eq packageManager "deno")}}type-check the app with Deno{{else}}{{#if (eq packageManager "bun")}}type-check the app for Bun{{else}}typecheck and compile{{/if}}{{/if}}
9
+ - `{{runScriptCommand packageManager "start"}}` - {{#if (eq packageManager "deno")}}run the server directly from `src/index.ts` with Deno{{else}}{{#if (eq packageManager "bun")}}run the server directly from `src/index.ts` with Bun{{else}}run compiled server from `dist/`{{/if}}{{/if}}
10
+ {{#if compute}}
11
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
12
+ {{/if}}
11
13
 
12
14
  ## Prisma
13
15
 
@@ -26,12 +28,16 @@ Generated by `create-prisma` with the Elysia template.
26
28
 
27
29
  5. Use the Prisma client from `src/lib/prisma.ts`.
28
30
 
29
- Generated Prisma files are written to `src/generated/prisma`.
31
+ Generated Prisma files are written to `src/generated/prisma`. Prisma Compute deploy defaults are written to `prisma.compute.ts`.
32
+ {{#if (eq schemaPreset "basic")}}
30
33
 
31
34
  The template includes a basic `User` model, a sample `GET /users` endpoint, and seed data in `prisma/seed.ts`.
35
+ {{/if}}
36
+ {{#if compute}}
32
37
 
33
- ## Prisma Composer
38
+ ## Prisma Compute
34
39
 
35
- The application topology is declared in `module.ts` and `service.ts`, with deploy configuration in `prisma-composer.config.ts`. {{#if composerPostgres}}Composer provisions Prisma Postgres and injects its connection into the service.{{else}}The database URL is bound as a secret service input from `.env`.{{/if}}
40
+ This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
36
41
 
37
- If needed, sign in with `{{prismaAuthLoginCommand packageManager}}`. Run `{{runScriptCommand packageManager "deploy"}}` to deploy later changes.
42
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
43
+ {{/if}}
@@ -0,0 +1,5 @@
1
+ {{#if (eq packageManager "deno")}}
2
+ {
3
+ "nodeModulesDir": "auto"
4
+ }
5
+ {{/if}}
@@ -7,9 +7,9 @@
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "scripts": {
10
- "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/src/index.js"}}",
11
- "build": "esbuild src/index.ts --bundle --platform=node --format=esm --banner:js=\"import { createRequire as __composerCreateRequire } from 'node:module'; const require = __composerCreateRequire(import.meta.url);\" --outfile=dist/server.mjs",
12
- "start": "node dist/server.mjs"
10
+ "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/src/index.js" denoFlags="--unstable-net"}}",
11
+ "build": "{{runtimeScript packageManager "build" "src/index.ts" "dist/src/index.js"}}",
12
+ "start": "{{runtimeScript packageManager "start" "src/index.ts" "dist/src/index.js" denoFlags="--unstable-net"}}"
13
13
  },
14
14
  "dependencies": {
15
15
  "@sinclair/typebox": "^0.34.49",
@@ -17,7 +17,6 @@
17
17
  "openapi-types": "^12.1.3"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/node": "^26.0.0",
21
20
  "typescript": "^6.0.3"
22
21
  }
23
22
  }
@@ -1,14 +1,19 @@
1
1
  generator client {
2
2
  provider = "prisma-client"
3
3
  output = "../src/generated/prisma"
4
+ {{#if (eq packageManager "deno")}}
5
+ runtime = "deno"
6
+ {{else}}
4
7
  {{#if (eq packageManager "bun")}}
5
8
  runtime = "bun"
6
9
  {{/if}}
10
+ {{/if}}
7
11
  }
8
12
 
9
13
  datasource db {
10
14
  provider = "{{provider}}"
11
15
  }
16
+ {{#if (eq schemaPreset "basic")}}
12
17
 
13
18
  model User {
14
19
  id String @id @default(cuid())
@@ -17,3 +22,4 @@ model User {
17
22
  createdAt DateTime @default(now())
18
23
  updatedAt DateTime @updatedAt
19
24
  }
25
+ {{/if}}
@@ -1,6 +1,7 @@
1
- import prisma from "../src/lib/prisma";
1
+ import prisma from "../src/lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
2
2
 
3
3
  async function main() {
4
+ {{#if (eq schemaPreset "basic")}}
4
5
  const users = await Promise.all([
5
6
  prisma.user.upsert({
6
7
  where: { email: "alice@prisma.io" },
@@ -21,6 +22,9 @@ async function main() {
21
22
  ]);
22
23
 
23
24
  console.log(`Seeded ${users.length} users.`);
25
+ {{else}}
26
+ console.log("No seed data defined for the empty schema preset.");
27
+ {{/if}}
24
28
  }
25
29
 
26
30
  main()
@@ -0,0 +1,11 @@
1
+ import { defineComputeConfig } from "@prisma/compute-sdk/config";
2
+
3
+ export default defineComputeConfig({
4
+ app: {
5
+ name: "{{projectName}}",
6
+ framework: "bun",
7
+ entry: "src/index.ts",
8
+ httpPort: 8080,
9
+ env: ".env",
10
+ },
11
+ });
@@ -1,30 +1,27 @@
1
1
  {{#if (requiresDotenvConfigImport packageManager)}}
2
2
  import "dotenv/config";
3
3
  {{/if}}
4
+ {{#if (eq packageManager "deno")}}
5
+ {{else}}
4
6
  import { node } from "@elysiajs/node";
7
+ {{/if}}
5
8
  import { Elysia } from "elysia";
9
+ {{#if (eq schemaPreset "basic")}}
10
+ import { prisma } from "./lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
11
+ {{/if}}
6
12
 
7
- import { prisma } from "./lib/prisma";
8
-
9
- const rawPort = (process.env.PORT ?? "").trim();
13
+ const rawPort = ({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? "").trim();
10
14
  const parsedPort = rawPort.length > 0 ? Number(rawPort) : Number.NaN;
11
15
  const port =
12
16
  Number.isInteger(parsedPort) && parsedPort >= 0 && parsedPort <= 65535 ? parsedPort : 8080;
13
17
 
14
- const runtimeAdapter = "Bun" in globalThis ? undefined : node();
15
-
16
- const app = new Elysia({ adapter: runtimeAdapter })
18
+ const app = new Elysia({{#if (eq packageManager "deno")}}{{else}}{ adapter: node() }{{/if}})
17
19
  .get("/", () => {
18
20
  return {
19
- name: "{{projectName}}",
20
- framework: "Elysia",
21
- status: "ready",
22
- endpoints: {
23
- users: "/users",
24
- },
21
+ message: "hello from create-prisma + elysia",
25
22
  };
26
23
  })
27
-
24
+ {{#if (eq schemaPreset "basic")}}
28
25
  .get("/users", async () => {
29
26
  return prisma.user.findMany({
30
27
  take: 10,
@@ -33,7 +30,14 @@ const app = new Elysia({ adapter: runtimeAdapter })
33
30
  },
34
31
  });
35
32
  })
33
+ {{/if}}
34
+ {{#if (eq packageManager "deno")}}
35
+ ;
36
36
 
37
+ Deno.serve({ port }, app.fetch);
38
+ console.log(`Server running at http://localhost:${port}`);
39
+ {{else}}
37
40
  .listen(port);
38
41
 
39
42
  console.log(`Server running at http://localhost:${app.server?.port ?? port}`);
43
+ {{/if}}