create-prisma 0.4.2-next.37.88.1 → 0.4.2-next.37.89.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 (36) hide show
  1. package/README.md +0 -1
  2. package/dist/cli.mjs +1 -1
  3. package/dist/{create-W3plkOl1.mjs → create-C6SFJkUe.mjs} +19 -51
  4. package/dist/index.d.mts +1 -13
  5. package/dist/index.mjs +3 -3
  6. package/package.json +1 -1
  7. package/templates/create/_shared/prisma/seed.ts.hbs +1 -4
  8. package/templates/create/astro/README.md.hbs +1 -6
  9. package/templates/create/astro/src/lib/prisma.ts.hbs +4 -8
  10. package/templates/create/astro/src/pages/api/users.ts.hbs +1 -10
  11. package/templates/create/astro/src/pages/index.astro.hbs +3 -38
  12. package/templates/create/elysia/README.md.hbs +2 -4
  13. package/templates/create/elysia/src/index.ts.hbs +3 -4
  14. package/templates/create/elysia/src/lib/prisma.ts.hbs +4 -8
  15. package/templates/create/hono/README.md.hbs +2 -4
  16. package/templates/create/hono/src/index.ts.hbs +1 -4
  17. package/templates/create/hono/src/lib/prisma.ts.hbs +4 -8
  18. package/templates/create/nest/README.md.hbs +2 -4
  19. package/templates/create/nest/src/app.module.ts.hbs +5 -6
  20. package/templates/create/nest/src/lib/prisma.ts.hbs +4 -8
  21. package/templates/create/nest/src/users.controller.ts.hbs +1 -2
  22. package/templates/create/nest/src/users.service.ts.hbs +1 -2
  23. package/templates/create/next/README.md.hbs +2 -4
  24. package/templates/create/next/src/app/page.tsx.hbs +2 -38
  25. package/templates/create/next/src/lib/prisma.ts.hbs +4 -8
  26. package/templates/create/nuxt/README.md.hbs +2 -4
  27. package/templates/create/nuxt/app/pages/index.vue.hbs +2 -38
  28. package/templates/create/nuxt/server/api/users.get.ts.hbs +1 -6
  29. package/templates/create/nuxt/server/utils/prisma.ts.hbs +4 -8
  30. package/templates/create/svelte/README.md.hbs +1 -6
  31. package/templates/create/svelte/src/lib/server/prisma.ts.hbs +4 -8
  32. package/templates/create/svelte/src/routes/+page.server.ts.hbs +1 -6
  33. package/templates/create/svelte/src/routes/+page.svelte.hbs +0 -154
  34. package/templates/create/tanstack-start/README.md.hbs +2 -4
  35. package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +4 -8
  36. package/templates/create/tanstack-start/src/routes/index.tsx.hbs +5 -45
package/README.md CHANGED
@@ -118,7 +118,6 @@ create-prisma --name my-app --template nest --provider postgres --prisma-postgre
118
118
  - `--provider postgres|postgresql|mongo|mongodb` (default: `postgres`)
119
119
  - `--authoring psl|typescript` (default: `psl`)
120
120
  - `--package-manager` choose the package manager/runtime
121
- - `--schema-preset empty|basic` (default: `basic`)
122
121
  - `--database-url` set `DATABASE_URL`
123
122
  - `--yes` accept defaults and skip prompts
124
123
  - `--no-install` scaffold only
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-W3plkOl1.mjs";
2
+ import "./create-C6SFJkUe.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.88.1",
52
+ "cli-version": "0.4.2-next.37.89.1",
53
53
  "node-version": process.version,
54
54
  platform: process.platform,
55
55
  arch: process.arch
@@ -104,7 +104,6 @@ function getBaseCreateProperties(input, context) {
104
104
  "database-provider": context?.prismaSetupContext.databaseProvider ?? input.provider ?? null,
105
105
  "authoring-style": context?.prismaSetupContext.authoring ?? input.authoring ?? null,
106
106
  "package-manager": context?.prismaSetupContext.packageManager ?? input.packageManager ?? null,
107
- "schema-preset": context?.prismaSetupContext.schemaPreset ?? input.schemaPreset ?? null,
108
107
  "should-install": context?.prismaSetupContext.shouldInstall ?? input.install ?? null,
109
108
  "should-emit": context?.prismaSetupContext.shouldEmit ?? input.emit ?? null,
110
109
  "uses-prisma-postgres": context?.prismaSetupContext.shouldUsePrismaPostgres ?? input.prismaPostgres ?? null,
@@ -216,7 +215,6 @@ const packageManagers = [
216
215
  "bun",
217
216
  "deno"
218
217
  ];
219
- const schemaPresets = ["empty", "basic"];
220
218
  const authoringStyles = ["psl", "typescript"];
221
219
  const createTemplates = [
222
220
  "hono",
@@ -235,7 +233,6 @@ function normalizeDatabaseProvider(value) {
235
233
  }
236
234
  const DatabaseProviderSchema = z.enum(databaseProviderInputs).transform(normalizeDatabaseProvider);
237
235
  const PackageManagerSchema = z.enum(packageManagers);
238
- const SchemaPresetSchema = z.enum(schemaPresets);
239
236
  const AuthoringStyleSchema = z.enum(authoringStyles);
240
237
  const CreateTemplateSchema = z.enum(createTemplates);
241
238
  const DatabaseUrlSchema = z.string().trim().min(1, "Please enter a valid database URL");
@@ -250,8 +247,7 @@ const PrismaSetupOptionsSchema = z.object({
250
247
  prismaPostgres: z.boolean().optional().describe("Provision Prisma Postgres with create-db when target is postgres"),
251
248
  databaseUrl: DatabaseUrlSchema.optional().describe("DATABASE_URL value"),
252
249
  install: z.boolean().optional().describe("Install dependencies with selected package manager"),
253
- emit: z.boolean().optional().describe("Emit Prisma Next contract artifacts after scaffolding"),
254
- schemaPreset: SchemaPresetSchema.optional().describe("Schema preset to scaffold in prisma/contract.prisma or prisma/contract.ts")
250
+ emit: z.boolean().optional().describe("Emit Prisma Next contract artifacts after scaffolding")
255
251
  });
256
252
  const PrismaSetupCommandInputSchema = CommonCommandOptionsSchema.extend(PrismaSetupOptionsSchema.shape);
257
253
  const CreateScaffoldOptionsSchema = z.object({
@@ -571,21 +567,20 @@ function getCreateTemplateDir(template) {
571
567
  function getCreateSharedTemplateDir() {
572
568
  return resolveTemplatesDir("templates/create/_shared");
573
569
  }
574
- function createTemplateContext(projectName, template, provider, authoring, schemaPreset, packageManager) {
570
+ function createTemplateContext(projectName, template, provider, authoring, packageManager) {
575
571
  return {
576
572
  projectName,
577
573
  template,
578
574
  provider,
579
575
  authoring,
580
- schemaPreset,
581
576
  packageManager
582
577
  };
583
578
  }
584
579
  async function scaffoldCreateTemplate(opts) {
585
- const { projectDir, projectName, template, provider, authoring, schemaPreset, packageManager } = opts;
580
+ const { projectDir, projectName, template, provider, authoring, packageManager } = opts;
586
581
  const templateRoot = getCreateTemplateDir(template);
587
582
  const sharedTemplateRoot = getCreateSharedTemplateDir();
588
- const context = createTemplateContext(projectName, template, provider, authoring, schemaPreset, packageManager);
583
+ const context = createTemplateContext(projectName, template, provider, authoring, packageManager);
589
584
  await renderTemplateTree({
590
585
  templateRoot: sharedTemplateRoot,
591
586
  outputDir: projectDir,
@@ -834,7 +829,6 @@ function getCreateDbCommand(packageManager) {
834
829
  //#region src/tasks/setup-prisma.ts
835
830
  const DEFAULT_DATABASE_PROVIDER = "postgres";
836
831
  const DEFAULT_AUTHORING = "psl";
837
- const DEFAULT_SCHEMA_PRESET$1 = "basic";
838
832
  const DEFAULT_INSTALL = true;
839
833
  const DEFAULT_EMIT = true;
840
834
  const DEFAULT_INTERACTIVE_PRISMA_POSTGRES = true;
@@ -878,31 +872,6 @@ const requiredPrismaFileGroups = [
878
872
  function getContractPath(authoring) {
879
873
  return `prisma/contract${authoring === "typescript" ? ".ts" : ".prisma"}`;
880
874
  }
881
- function getEmptyContractContent(provider, authoring) {
882
- if (authoring === "psl") return "// use prisma-next\n";
883
- if (provider === "mongo") return `import { defineContract } from "@prisma-next/mongo/contract-builder";
884
- import mongoFamily from "@prisma-next/mongo/family";
885
- import mongoTarget from "@prisma-next/mongo/target";
886
-
887
- export const contract = defineContract(
888
- { family: mongoFamily, target: mongoTarget },
889
- () => ({
890
- models: {},
891
- }),
892
- );
893
- `;
894
- return `import { defineContract } from "@prisma-next/postgres/contract-builder";
895
- import sqlFamily from "@prisma-next/postgres/family";
896
- import postgresTarget from "@prisma-next/postgres/target";
897
-
898
- export const contract = defineContract(
899
- { family: sqlFamily, target: postgresTarget },
900
- () => ({
901
- models: {},
902
- }),
903
- );
904
- `;
905
- }
906
875
  async function promptForDatabaseProvider() {
907
876
  const databaseProvider = await select({
908
877
  message: "Select your database",
@@ -1044,7 +1013,6 @@ async function collectPrismaSetupContext(input, options = {}) {
1044
1013
  }
1045
1014
  const authoring = input.authoring ?? (useDefaults ? DEFAULT_AUTHORING : await promptForAuthoringStyle());
1046
1015
  if (!authoring) return;
1047
- const schemaPreset = input.schemaPreset ?? options.defaultSchemaPreset ?? DEFAULT_SCHEMA_PRESET$1;
1048
1016
  const detectedPackageManager = await detectPackageManager(projectDir);
1049
1017
  const packageManager = input.packageManager ?? (useDefaults ? detectedPackageManager : await promptForPackageManager(detectedPackageManager));
1050
1018
  if (!packageManager) return;
@@ -1056,7 +1024,6 @@ async function collectPrismaSetupContext(input, options = {}) {
1056
1024
  shouldEmit,
1057
1025
  databaseProvider,
1058
1026
  authoring,
1059
- schemaPreset,
1060
1027
  databaseUrl,
1061
1028
  shouldUsePrismaPostgres,
1062
1029
  packageManager,
@@ -1276,7 +1243,6 @@ async function runPrismaNextInitForContext(context, projectDir) {
1276
1243
  CI: "1"
1277
1244
  }
1278
1245
  });
1279
- if (context.schemaPreset === "empty") await fs.writeFile(path.join(projectDir, getContractPath(context.authoring)), getEmptyContractContent(context.databaseProvider, context.authoring), "utf8");
1280
1246
  if (context.verbose) log.success("Prisma Next project files ready.");
1281
1247
  return true;
1282
1248
  } catch (error) {
@@ -1445,7 +1411,7 @@ function buildNextStepsForContext(opts) {
1445
1411
  command: getRunScriptCommand(context.packageManager, "migration:apply"),
1446
1412
  description: "Apply the planned migration to the database."
1447
1413
  });
1448
- if (context.schemaPreset === "basic") nextSteps.push({
1414
+ nextSteps.push({
1449
1415
  command: getRunScriptCommand(context.packageManager, "db:seed"),
1450
1416
  description: "Insert the sample user and post data from prisma/seed.ts."
1451
1417
  });
@@ -1459,9 +1425,14 @@ function formatNextSteps(nextSteps) {
1459
1425
  return nextSteps.map((step) => `${step.command}\n ${step.description}`).join("\n\n");
1460
1426
  }
1461
1427
  function formatAgentPrompt(didSyncAgentSkills) {
1462
- const prompt = "What can I do with Prisma Next?";
1463
- if (didSyncAgentSkills) return `Ask your agent:\n${prompt}`;
1464
- return `After syncing the Prisma Next skills, ask your agent:\n${prompt}`;
1428
+ return [
1429
+ "Ask your agent:",
1430
+ "What can I do with Prisma Next?",
1431
+ "",
1432
+ "Learn more:",
1433
+ `Docs: prisma-next.md`,
1434
+ `Skill: ${didSyncAgentSkills ? ".agents/skills/prisma-next/SKILL.md" : ".agents/skills/prisma-next/SKILL.md (after skills sync)"}`
1435
+ ].join("\n");
1465
1436
  }
1466
1437
  async function executePrismaSetupContext(context, options = {}) {
1467
1438
  const projectDir = path.resolve(options.projectDir ?? context.projectDir);
@@ -1513,7 +1484,7 @@ async function executePrismaSetupContext(context, options = {}) {
1513
1484
  progressSpinner?.stop("Prisma Next project ready.");
1514
1485
  if (warningLines.length > 0) note(warningLines.map((line) => line.replace(/^- /, "")).join("\n"), "Heads up");
1515
1486
  note(formatAgentPrompt(skillSyncResult.didSyncAgentSkills), "Agent prompt");
1516
- note(formatNextSteps(nextSteps), "Next steps for Prisma Next");
1487
+ if (context.verbose) note(formatNextSteps(nextSteps), "Next steps for Prisma Next");
1517
1488
  outro("Prisma Next setup complete.");
1518
1489
  return true;
1519
1490
  }
@@ -1529,7 +1500,6 @@ function getCreatePrismaIntro() {
1529
1500
  //#region src/commands/create.ts
1530
1501
  const DEFAULT_PROJECT_NAME = "my-app";
1531
1502
  const DEFAULT_TEMPLATE = "hono";
1532
- const DEFAULT_SCHEMA_PRESET = "basic";
1533
1503
  function toPackageName(projectName) {
1534
1504
  return projectName.toLowerCase().replace(/[^a-z0-9._-]/g, "-").replace(/^-+/, "").replace(/-+$/, "") || "app";
1535
1505
  }
@@ -1688,10 +1658,7 @@ async function collectCreateContext(input) {
1688
1658
  cancel(`Target directory ${formatPathForDisplay(targetDirectory)} is not empty. Use --force to continue.`);
1689
1659
  return;
1690
1660
  }
1691
- const prismaSetupContext = await collectPrismaSetupContext(input, {
1692
- projectDir: targetDirectory,
1693
- defaultSchemaPreset: DEFAULT_SCHEMA_PRESET
1694
- });
1661
+ const prismaSetupContext = await collectPrismaSetupContext(input, { projectDir: targetDirectory });
1695
1662
  if (!prismaSetupContext) return;
1696
1663
  return {
1697
1664
  targetDirectory,
@@ -1706,15 +1673,16 @@ async function executeCreateContext(context) {
1706
1673
  const createSpinner = context.prismaSetupContext.verbose ? void 0 : spinner();
1707
1674
  createSpinner?.start("Creating Prisma Next project...");
1708
1675
  try {
1676
+ if (context.prismaSetupContext.verbose) log.step(`Scaffolding ${context.template} starter.`);
1709
1677
  await scaffoldCreateTemplate({
1710
1678
  projectDir: context.targetDirectory,
1711
1679
  projectName: context.projectPackageName,
1712
1680
  template: context.template,
1713
- schemaPreset: context.prismaSetupContext.schemaPreset,
1714
1681
  provider: context.prismaSetupContext.databaseProvider,
1715
1682
  authoring: context.prismaSetupContext.authoring,
1716
1683
  packageManager: context.prismaSetupContext.packageManager
1717
1684
  });
1685
+ if (context.prismaSetupContext.verbose) log.success("Starter files scaffolded.");
1718
1686
  } catch (error) {
1719
1687
  createSpinner?.stop("Could not create Prisma Next project.");
1720
1688
  return {
@@ -1764,4 +1732,4 @@ async function executeCreateContext(context) {
1764
1732
  }
1765
1733
 
1766
1734
  //#endregion
1767
- export { DatabaseProviderSchema as a, SchemaPresetSchema as c, CreateTemplateSchema as i, AuthoringStyleSchema as n, DatabaseUrlSchema as o, CreateCommandInputSchema as r, PackageManagerSchema as s, runCreateCommand as t };
1735
+ export { DatabaseProviderSchema as a, CreateTemplateSchema as i, AuthoringStyleSchema as n, DatabaseUrlSchema as o, CreateCommandInputSchema as r, PackageManagerSchema as s, runCreateCommand as t };
package/dist/index.d.mts CHANGED
@@ -190,10 +190,6 @@ declare const PackageManagerSchema: z.ZodEnum<{
190
190
  bun: "bun";
191
191
  deno: "deno";
192
192
  }>;
193
- declare const SchemaPresetSchema: z.ZodEnum<{
194
- empty: "empty";
195
- basic: "basic";
196
- }>;
197
193
  declare const AuthoringStyleSchema: z.ZodEnum<{
198
194
  psl: "psl";
199
195
  typescript: "typescript";
@@ -233,10 +229,6 @@ declare const CreateCommandInputSchema: z.ZodObject<{
233
229
  databaseUrl: z.ZodOptional<z.ZodString>;
234
230
  install: z.ZodOptional<z.ZodBoolean>;
235
231
  emit: z.ZodOptional<z.ZodBoolean>;
236
- schemaPreset: z.ZodOptional<z.ZodEnum<{
237
- empty: "empty";
238
- basic: "basic";
239
- }>>;
240
232
  name: z.ZodOptional<z.ZodString>;
241
233
  template: z.ZodOptional<z.ZodEnum<{
242
234
  hono: "hono";
@@ -278,10 +270,6 @@ declare const router: {
278
270
  databaseUrl: zod.ZodOptional<zod.ZodString>;
279
271
  install: zod.ZodOptional<zod.ZodBoolean>;
280
272
  emit: zod.ZodOptional<zod.ZodBoolean>;
281
- schemaPreset: zod.ZodOptional<zod.ZodEnum<{
282
- empty: "empty";
283
- basic: "basic";
284
- }>>;
285
273
  name: zod.ZodOptional<zod.ZodString>;
286
274
  template: zod.ZodOptional<zod.ZodEnum<{
287
275
  hono: "hono";
@@ -299,4 +287,4 @@ declare const router: {
299
287
  declare function createCreatePrismaCli(): trpc_cli0.TrpcCli;
300
288
  declare function create(input?: CreateCommandInput): Promise<void>;
301
289
  //#endregion
302
- export { AuthoringStyleSchema, type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, SchemaPresetSchema, create, createCreatePrismaCli, router };
290
+ export { AuthoringStyleSchema, type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseProviderSchema, c as SchemaPresetSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-W3plkOl1.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-C6SFJkUe.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.88.1";
7
+ const CLI_VERSION = "0.4.2-next.37.89.1";
8
8
  const router = os.router({ create: os.meta({
9
9
  description: "Create a new project with Prisma setup",
10
10
  default: true,
@@ -24,4 +24,4 @@ async function create(input = {}) {
24
24
  }
25
25
 
26
26
  //#endregion
27
- export { AuthoringStyleSchema, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, SchemaPresetSchema, create, createCreatePrismaCli, router };
27
+ export { AuthoringStyleSchema, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.4.2-next.37.88.1",
3
+ "version": "0.4.2-next.37.89.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",
@@ -1,4 +1,3 @@
1
- {{#if (eq schemaPreset "basic")}}
2
1
  {{#if (requiresDotenvConfigImport packageManager)}}
3
2
  import "dotenv/config";
4
3
  {{/if}}
@@ -51,6 +50,4 @@ try {
51
50
  await db.runtime().close();
52
51
  }
53
52
  {{/if}}
54
- {{else}}
55
- console.log("No seed data for the empty schema preset.");
56
- {{/if}}
53
+
@@ -32,18 +32,13 @@ Database helper scripts are added to `package.json`:
32
32
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
33
33
  - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
34
34
  {{/if}}
35
- {{#if (eq schemaPreset "basic")}}
35
+
36
36
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
37
- {{/if}}
38
37
 
39
38
  For provider-specific Prisma Next reference docs, see `prisma-next.md`. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
40
39
  The Astro Vite dev server also auto-emits Prisma Next contract artifacts when the contract changes.
41
40
 
42
41
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
43
- {{#if (eq schemaPreset "basic")}}
44
42
 
45
43
  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 Next helper.
46
- {{else}}
47
44
 
48
- The starter page keeps the official Astro minimal structure and points you to your Prisma Next contract for the first model.
49
- {{/if}}
@@ -4,13 +4,13 @@ import mongo from "@prisma-next/mongo/runtime";
4
4
  {{else}}
5
5
  import postgres from "@prisma-next/postgres/runtime";
6
6
  {{/if}}
7
- {{#if (eq schemaPreset "basic")}}
7
+
8
8
  {{#if (eq provider "mongo")}}
9
9
  import type { DefaultModelRow } from "@prisma-next/mongo-orm";
10
10
  {{else}}
11
11
  import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
12
12
  {{/if}}
13
- {{/if}}
13
+
14
14
  import type { Contract } from "../../prisma/contract.d";
15
15
  import contractJson from "../../prisma/contract.json" with { type: "json" };
16
16
 
@@ -26,7 +26,6 @@ export const db = postgres<Contract>({
26
26
  });
27
27
  {{/if}}
28
28
 
29
- {{#if (eq schemaPreset "basic")}}
30
29
  type UserRow = DefaultModelRow<Contract, "User">;
31
30
 
32
31
  {{#if (eq provider "mongo")}}
@@ -48,10 +47,9 @@ function toStarterUser(user: Pick<UserRow, "id" | "email" | "name" | "createdAt"
48
47
  };
49
48
  }
50
49
  {{/if}}
51
- {{/if}}
52
50
 
53
51
  export async function listUsers(limit = 10) {
54
- {{#if (eq schemaPreset "basic")}}
52
+
55
53
  {{#if (eq provider "mongo")}}
56
54
  const users: ReturnType<typeof toStarterUser>[] = [];
57
55
 
@@ -65,9 +63,7 @@ export async function listUsers(limit = 10) {
65
63
 
66
64
  return users.map(toStarterUser);
67
65
  {{/if}}
68
- {{else}}
69
- return [];
70
- {{/if}}
66
+
71
67
  }
72
68
 
73
69
  export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
@@ -1,5 +1,5 @@
1
1
  import type { APIRoute } from "astro";
2
- {{#if (eq schemaPreset "basic")}}
2
+
3
3
  import { listUsers } from "../../lib/prisma";
4
4
 
5
5
  export const GET: APIRoute = async () => {
@@ -23,13 +23,4 @@ export const GET: APIRoute = async () => {
23
23
  },
24
24
  });
25
25
  };
26
- {{else}}
27
26
 
28
- export const GET: APIRoute = async () => {
29
- return new Response(JSON.stringify([]), {
30
- headers: {
31
- "Content-Type": "application/json",
32
- },
33
- });
34
- };
35
- {{/if}}
@@ -1,5 +1,5 @@
1
1
  ---
2
- {{#if (eq schemaPreset "basic")}}
2
+
3
3
  import { listUsers } from "../lib/prisma";
4
4
 
5
5
  const formatter = new Intl.DateTimeFormat("en", {
@@ -8,7 +8,7 @@ const formatter = new Intl.DateTimeFormat("en", {
8
8
  });
9
9
 
10
10
  const users = await listUsers(10).catch(() => undefined);
11
- {{/if}}
11
+
12
12
  ---
13
13
 
14
14
  <html lang="en">
@@ -23,7 +23,7 @@ const users = await listUsers(10).catch(() => undefined);
23
23
  <main class="shell">
24
24
  <div class="hero">
25
25
  <p class="eyebrow">Astro + Prisma Next</p>
26
- {{#if (eq schemaPreset "basic")}}
26
+
27
27
  <h1>Users from your database, loaded on the server.</h1>
28
28
  <p class="lede">
29
29
  This page reads from <code>src/pages/index.astro</code> using the Prisma Next helper in
@@ -65,42 +65,7 @@ const users = await listUsers(10).catch(() => undefined);
65
65
  </ul>
66
66
  )}
67
67
  </section>
68
- {{else}}
69
- <h1>Your Astro app is ready.</h1>
70
- <p class="lede">
71
- Edit your Prisma Next contract, run <code>contract:emit</code>, then load your data
72
- in Astro pages or API routes with the helper in <code>src/lib/prisma.ts</code>.
73
- </p>
74
- </div>
75
68
 
76
- <section class="panel">
77
- <div class="panel-header">
78
- <h2>What's included</h2>
79
- <span>Starter kit</span>
80
- </div>
81
-
82
- <ul class="users">
83
- <li>
84
- <div>
85
- <strong>Prisma client</strong>
86
- <p>Use the shared Prisma Next runtime from <code>src/lib/prisma.ts</code>.</p>
87
- </div>
88
- </li>
89
- <li>
90
- <div>
91
- <strong>API route example</strong>
92
- <p>See <code>src/pages/api/users.ts</code> for an Astro server endpoint.</p>
93
- </div>
94
- </li>
95
- <li>
96
- <div>
97
- <strong>Manual database setup</strong>
98
- <p>Run the schema setup commands when you are ready.</p>
99
- </div>
100
- </li>
101
- </ul>
102
- </section>
103
- {{/if}}
104
69
  </main>
105
70
  </body>
106
71
  </html>
@@ -30,14 +30,12 @@ Database helper scripts are added to `package.json`:
30
30
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
31
31
  - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
32
32
  {{/if}}
33
- {{#if (eq schemaPreset "basic")}}
33
+
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
35
- {{/if}}
36
35
 
37
36
  For provider-specific Prisma Next reference docs, see `prisma-next.md`. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
38
37
 
39
38
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
40
- {{#if (eq schemaPreset "basic")}}
41
39
 
42
40
  The template includes a basic `User` model and a sample `GET /users` endpoint.
43
- {{/if}}
41
+
@@ -6,9 +6,8 @@ import "dotenv/config";
6
6
  import { node } from "@elysiajs/node";
7
7
  {{/if}}
8
8
  import { Elysia } from "elysia";
9
- {{#if (eq schemaPreset "basic")}}
9
+
10
10
  import { listUsers } from "./lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
11
- {{/if}}
12
11
 
13
12
  const rawPort = ({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? "").trim();
14
13
  const parsedPort = rawPort.length > 0 ? Number(rawPort) : Number.NaN;
@@ -21,7 +20,7 @@ const app = new Elysia({{#if (eq packageManager "deno")}}{{else}}{ adapter: node
21
20
  message: "hello from create-prisma + elysia",
22
21
  };
23
22
  })
24
- {{#if (eq schemaPreset "basic")}}
23
+
25
24
  .get("/users", async ({ set }) => {
26
25
  const users = await listUsers(10).catch((error) => {
27
26
  console.error("Failed to query users:", error);
@@ -35,7 +34,7 @@ const app = new Elysia({{#if (eq packageManager "deno")}}{{else}}{ adapter: node
35
34
 
36
35
  return users;
37
36
  })
38
- {{/if}}
37
+
39
38
  {{#if (eq packageManager "deno")}}
40
39
  ;
41
40
 
@@ -4,13 +4,13 @@ import mongo from "@prisma-next/mongo/runtime";
4
4
  {{else}}
5
5
  import postgres from "@prisma-next/postgres/runtime";
6
6
  {{/if}}
7
- {{#if (eq schemaPreset "basic")}}
7
+
8
8
  {{#if (eq provider "mongo")}}
9
9
  import type { DefaultModelRow } from "@prisma-next/mongo-orm";
10
10
  {{else}}
11
11
  import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
12
12
  {{/if}}
13
- {{/if}}
13
+
14
14
  import type { Contract } from "../../prisma/contract.d";
15
15
  import contractJson from "../../prisma/contract.json" with { type: "json" };
16
16
 
@@ -26,7 +26,6 @@ export const db = postgres<Contract>({
26
26
  });
27
27
  {{/if}}
28
28
 
29
- {{#if (eq schemaPreset "basic")}}
30
29
  type UserRow = DefaultModelRow<Contract, "User">;
31
30
 
32
31
  {{#if (eq provider "mongo")}}
@@ -48,10 +47,9 @@ function toStarterUser(user: Pick<UserRow, "id" | "email" | "name" | "createdAt"
48
47
  };
49
48
  }
50
49
  {{/if}}
51
- {{/if}}
52
50
 
53
51
  export async function listUsers(limit = 10) {
54
- {{#if (eq schemaPreset "basic")}}
52
+
55
53
  {{#if (eq provider "mongo")}}
56
54
  const users: ReturnType<typeof toStarterUser>[] = [];
57
55
 
@@ -65,9 +63,7 @@ export async function listUsers(limit = 10) {
65
63
 
66
64
  return users.map(toStarterUser);
67
65
  {{/if}}
68
- {{else}}
69
- return [];
70
- {{/if}}
66
+
71
67
  }
72
68
 
73
69
  export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
@@ -30,14 +30,12 @@ Database helper scripts are added to `package.json`:
30
30
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
31
31
  - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
32
32
  {{/if}}
33
- {{#if (eq schemaPreset "basic")}}
33
+
34
34
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
35
- {{/if}}
36
35
 
37
36
  For provider-specific Prisma Next reference docs, see `prisma-next.md`. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
38
37
 
39
38
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
40
- {{#if (eq schemaPreset "basic")}}
41
39
 
42
40
  The template includes a basic `User` model and a sample `GET /users` endpoint.
43
- {{/if}}
41
+
@@ -3,9 +3,8 @@ import "dotenv/config";
3
3
  {{/if}}
4
4
  import { serve } from "@hono/node-server";
5
5
  import { Hono } from "hono";
6
- {{#if (eq schemaPreset "basic")}}
6
+
7
7
  import { listUsers } from "./lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
8
- {{/if}}
9
8
 
10
9
  const app = new Hono();
11
10
 
@@ -14,7 +13,6 @@ app.get("/", (c) => {
14
13
  message: "hello from create-prisma + hono",
15
14
  });
16
15
  });
17
- {{#if (eq schemaPreset "basic")}}
18
16
 
19
17
  app.get("/users", async (c) => {
20
18
  const users = await listUsers(10).catch((error) => {
@@ -28,7 +26,6 @@ app.get("/users", async (c) => {
28
26
 
29
27
  return c.json(users);
30
28
  });
31
- {{/if}}
32
29
 
33
30
  const rawPort = ({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? "").trim();
34
31
  const parsedPort = rawPort.length > 0 ? Number(rawPort) : Number.NaN;
@@ -4,13 +4,13 @@ import mongo from "@prisma-next/mongo/runtime";
4
4
  {{else}}
5
5
  import postgres from "@prisma-next/postgres/runtime";
6
6
  {{/if}}
7
- {{#if (eq schemaPreset "basic")}}
7
+
8
8
  {{#if (eq provider "mongo")}}
9
9
  import type { DefaultModelRow } from "@prisma-next/mongo-orm";
10
10
  {{else}}
11
11
  import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
12
12
  {{/if}}
13
- {{/if}}
13
+
14
14
  import type { Contract } from "../../prisma/contract.d";
15
15
  import contractJson from "../../prisma/contract.json" with { type: "json" };
16
16
 
@@ -26,7 +26,6 @@ export const db = postgres<Contract>({
26
26
  });
27
27
  {{/if}}
28
28
 
29
- {{#if (eq schemaPreset "basic")}}
30
29
  type UserRow = DefaultModelRow<Contract, "User">;
31
30
 
32
31
  {{#if (eq provider "mongo")}}
@@ -48,10 +47,9 @@ function toStarterUser(user: Pick<UserRow, "id" | "email" | "name" | "createdAt"
48
47
  };
49
48
  }
50
49
  {{/if}}
51
- {{/if}}
52
50
 
53
51
  export async function listUsers(limit = 10) {
54
- {{#if (eq schemaPreset "basic")}}
52
+
55
53
  {{#if (eq provider "mongo")}}
56
54
  const users: ReturnType<typeof toStarterUser>[] = [];
57
55
 
@@ -65,9 +63,7 @@ export async function listUsers(limit = 10) {
65
63
 
66
64
  return users.map(toStarterUser);
67
65
  {{/if}}
68
- {{else}}
69
- return [];
70
- {{/if}}
66
+
71
67
  }
72
68
 
73
69
  export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
@@ -31,14 +31,12 @@ Database helper scripts are added to `package.json`:
31
31
  - `{{runScriptCommand packageManager "migration:plan"}}` - create a migration plan
32
32
  - `{{runScriptCommand packageManager "migration:apply"}}` - apply a planned migration
33
33
  {{/if}}
34
- {{#if (eq schemaPreset "basic")}}
34
+
35
35
  - `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
36
- {{/if}}
37
36
 
38
37
  For provider-specific Prisma Next reference docs, see `prisma-next.md`. Agent-specific project guidance is scaffolded in `.agents/skills/prisma-next/SKILL.md`.
39
38
 
40
39
  Node-based Prisma Next projects expect Node.js 24 LTS or newer.
41
- {{#if (eq schemaPreset "basic")}}
42
40
 
43
41
  The template includes a basic `User` model and a sample `GET /users` endpoint.
44
- {{/if}}
42
+