create-prisma 0.4.2 → 0.5.0-pr.42.125.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,6 +13,7 @@ Scaffold a new app with Prisma already wired up.
13
13
  - adds `db:generate`, `db:migrate`, and `db:seed` scripts
14
14
  - creates or updates `.env` with `DATABASE_URL`
15
15
  - can install dependencies and run `prisma generate` for you
16
+ - can deploy the finished app to Prisma Compute and return a live URL
16
17
 
17
18
  ## Quick Start
18
19
 
@@ -76,6 +77,14 @@ Use Prisma Postgres auto-provisioning:
76
77
  create-prisma --name my-app --template nest --provider postgresql --prisma-postgres
77
78
  ```
78
79
 
80
+ Deploy a supported app to Prisma Compute:
81
+
82
+ ```bash
83
+ create-prisma --name my-api --template hono --provider postgresql --deploy
84
+ ```
85
+
86
+ With PostgreSQL, no `--database-url`, and no `--no-prisma-postgres`, the Compute flow creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to `.env`, and deploys the app with environment variables loaded from `.env`.
87
+
79
88
  ## Supported Templates
80
89
 
81
90
  - `hono`
@@ -88,6 +97,13 @@ create-prisma --name my-app --template nest --provider postgresql --prisma-postg
88
97
  - `tanstack-start`
89
98
  - `turborepo`
90
99
 
100
+ Prisma Compute deployment is currently supported for:
101
+
102
+ - `hono`
103
+ - `elysia`
104
+ - `next`
105
+ - `tanstack-start`
106
+
91
107
  ## Supported Databases
92
108
 
93
109
  - `postgresql`
@@ -111,6 +127,7 @@ create-prisma --name my-app --template nest --provider postgresql --prisma-postg
111
127
  - `--provider` choose the database provider
112
128
  - `--package-manager` choose the package manager/runtime
113
129
  - `--schema-preset empty|basic`
130
+ - `--deploy` deploy supported templates to Prisma Compute
114
131
  - `--yes` accept defaults and skip prompts
115
132
  - `--no-install` scaffold only
116
133
  - `--no-generate` skip `prisma generate`
@@ -128,6 +145,23 @@ create-prisma --name my-app --template nest --provider postgresql --prisma-postg
128
145
  - Prisma IDE extension install
129
146
 
130
147
  These can be selected interactively or enabled with flags.
148
+ When Prisma Compute deploy is selected, the skills add-on recommends the `prisma-compute` skill too.
149
+
150
+ ## Deploy to Prisma Compute
151
+
152
+ After scaffolding, `create-prisma` can deploy your app to [Prisma Compute](https://www.prisma.io/docs/compute), the serverless hosting for TypeScript apps that runs next to your Prisma Postgres database. It is offered for the templates the Prisma CLI can deploy today: `hono`, `elysia`, `next`, and `tanstack-start`.
153
+
154
+ Accept the prompt ("Deploy to Prisma Compute now?") when it appears, or pass the flag:
155
+
156
+ ```bash
157
+ create-prisma --name my-api --template hono --provider postgresql --deploy
158
+ ```
159
+
160
+ The deploy step signs you in with the Prisma CLI if you are not signed in yet. With PostgreSQL, no `--database-url`, and no `--no-prisma-postgres`, setup creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to `.env`, runs the requested Prisma setup, then deploys the app with environment variables loaded from `.env`.
161
+
162
+ A `compute:deploy` script is added to the generated project so you can redeploy app changes later. That script only runs `@prisma/cli@latest app deploy` with `.env`; it does not create a new project, create a new database, run migrations, or seed data.
163
+
164
+ The deploy prompt is skipped in `--yes` runs unless you pass `--deploy`. Browser sign-in may still need a person at the keyboard if no Prisma CLI session exists.
131
165
 
132
166
  ## Local Development
133
167
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-Cy_IS-sg.mjs";
2
+ import "./create-ClKlnRHX.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -107,6 +107,7 @@ const extensionTargets = [
107
107
  const prismaSkillNames = [
108
108
  "prisma-cli",
109
109
  "prisma-client-api",
110
+ "prisma-compute",
110
111
  "prisma-database-setup",
111
112
  "prisma-upgrade-v7",
112
113
  "prisma-postgres"
@@ -127,7 +128,7 @@ const CommonCommandOptionsSchema = z.object({
127
128
  const PrismaSetupOptionsSchema = z.object({
128
129
  provider: DatabaseProviderSchema.optional().describe("Database provider"),
129
130
  packageManager: PackageManagerSchema.optional().describe("Package manager used for dependency installation"),
130
- prismaPostgres: z.boolean().optional().describe("Provision Prisma Postgres with create-db when provider is postgresql"),
131
+ prismaPostgres: z.boolean().optional().describe("Use Prisma Postgres when provider is postgresql"),
131
132
  databaseUrl: DatabaseUrlSchema.optional().describe("DATABASE_URL value"),
132
133
  install: z.boolean().optional().describe("Install dependencies with selected package manager"),
133
134
  generate: z.boolean().optional().describe("Generate Prisma Client after scaffolding"),
@@ -141,8 +142,18 @@ const CreateScaffoldOptionsSchema = z.object({
141
142
  skills: z.boolean().optional().describe("Enable skills addon"),
142
143
  mcp: z.boolean().optional().describe("Enable MCP addon"),
143
144
  extension: z.boolean().optional().describe("Enable extension addon"),
145
+ deploy: z.boolean().optional().describe("Deploy the scaffolded project to Prisma Compute"),
144
146
  force: z.boolean().optional().describe("Allow scaffolding into a non-empty target directory")
145
147
  });
148
+ const COMPUTE_DEPLOYABLE_TEMPLATES = new Set([
149
+ "hono",
150
+ "elysia",
151
+ "next",
152
+ "tanstack-start"
153
+ ]);
154
+ function isComputeDeployableTemplate(template) {
155
+ return COMPUTE_DEPLOYABLE_TEMPLATES.has(template);
156
+ }
146
157
  const CreateCommandInputSchema = PrismaSetupCommandInputSchema.extend(CreateScaffoldOptionsSchema.shape);
147
158
 
148
159
  //#endregion
@@ -340,11 +351,6 @@ function getPackageExecutionCommand(packageManager, commandArgs) {
340
351
  return [execution.command, ...execution.args].join(" ");
341
352
  }
342
353
  function getPrismaCliArgs(packageManager, prismaArgs) {
343
- if (packageManager === "bun") return getPackageExecutionArgs(packageManager, [
344
- "--bun",
345
- "prisma",
346
- ...prismaArgs
347
- ]);
348
354
  if (packageManager === "deno") return {
349
355
  command: "deno",
350
356
  args: [
@@ -357,7 +363,7 @@ function getPrismaCliArgs(packageManager, prismaArgs) {
357
363
  };
358
364
  return getPackageExecutionArgs(packageManager, ["prisma", ...prismaArgs]);
359
365
  }
360
- function getPrismaCliCommand(packageManager, prismaArgs) {
366
+ function getPrismaCliCommand$1(packageManager, prismaArgs) {
361
367
  const execution = getPrismaCliArgs(packageManager, prismaArgs);
362
368
  return [execution.command, ...execution.args].join(" ");
363
369
  }
@@ -460,12 +466,13 @@ async function renderTemplateTree(opts) {
460
466
  function getCreateTemplateDir(template) {
461
467
  return resolveTemplatesDir(`templates/create/${template}`);
462
468
  }
463
- function createTemplateContext(projectName, provider, schemaPreset, packageManager) {
469
+ function createTemplateContext(projectName, provider, schemaPreset, packageManager, compute) {
464
470
  return {
465
471
  projectName,
466
472
  provider,
467
473
  schemaPreset,
468
- packageManager
474
+ packageManager,
475
+ compute
469
476
  };
470
477
  }
471
478
  async function scaffoldCreateTemplate(opts) {
@@ -473,7 +480,7 @@ async function scaffoldCreateTemplate(opts) {
473
480
  await renderTemplateTree({
474
481
  templateRoot: getCreateTemplateDir(template),
475
482
  outputDir: projectDir,
476
- context: createTemplateContext(projectName, provider, schemaPreset, packageManager)
483
+ context: createTemplateContext(projectName, provider, schemaPreset, packageManager, opts.compute === true)
477
484
  });
478
485
  }
479
486
 
@@ -813,7 +820,7 @@ function getCommandErrorMessage(error) {
813
820
  }
814
821
  return error instanceof Error ? error.message : String(error);
815
822
  }
816
- async function collectPrismaSetupContext(input, options = {}) {
823
+ async function collectPrismaSetupInitialContext(input, options = {}) {
817
824
  const projectDir = path.resolve(options.projectDir ?? process.cwd());
818
825
  const useDefaults = input.yes === true;
819
826
  const verbose = input.verbose === true;
@@ -822,19 +829,11 @@ async function collectPrismaSetupContext(input, options = {}) {
822
829
  if (!databaseProvider) return;
823
830
  const schemaPreset = input.schemaPreset ?? options.defaultSchemaPreset ?? DEFAULT_SCHEMA_PRESET$1;
824
831
  const databaseUrl = input.databaseUrl;
825
- let shouldUsePrismaPostgres = false;
826
- if (databaseProvider === "postgresql" && !databaseUrl) {
827
- const prismaPostgresChoice = input.prismaPostgres ?? (useDefaults ? DEFAULT_PRISMA_POSTGRES : await promptForPrismaPostgres());
828
- if (prismaPostgresChoice === void 0) return;
829
- shouldUsePrismaPostgres = prismaPostgresChoice;
830
- }
831
832
  const detectedPackageManager = await detectPackageManager(projectDir);
832
833
  const packageManager = input.packageManager ?? (useDefaults ? detectedPackageManager : await promptForPackageManager(detectedPackageManager));
833
834
  if (!packageManager) return;
834
835
  const shouldInstall = input.install ?? (useDefaults ? DEFAULT_INSTALL : await promptForDependencyInstall(packageManager));
835
836
  if (shouldInstall === void 0) return;
836
- const shouldMigrateAndSeed = !(shouldInstall && shouldGenerate) ? false : input.migrateAndSeed ?? (useDefaults ? DEFAULT_MIGRATE_AND_SEED : await promptForMigrateAndSeed());
837
- if (shouldMigrateAndSeed === void 0) return;
838
837
  return {
839
838
  projectDir,
840
839
  verbose,
@@ -842,9 +841,24 @@ async function collectPrismaSetupContext(input, options = {}) {
842
841
  databaseProvider,
843
842
  schemaPreset,
844
843
  databaseUrl,
845
- shouldUsePrismaPostgres,
846
844
  packageManager,
847
- shouldInstall,
845
+ shouldInstall
846
+ };
847
+ }
848
+ async function completePrismaSetupContext(input, context, options = {}) {
849
+ const useDefaults = input.yes === true;
850
+ let shouldUsePrismaPostgres = false;
851
+ const shouldUseComputePostgres = context.databaseProvider === "postgresql" && !context.databaseUrl && options.useComputePostgres === true;
852
+ if (context.databaseProvider === "postgresql" && !context.databaseUrl && !shouldUseComputePostgres) {
853
+ const prismaPostgresChoice = input.prismaPostgres ?? (useDefaults ? DEFAULT_PRISMA_POSTGRES : await promptForPrismaPostgres());
854
+ if (prismaPostgresChoice === void 0) return;
855
+ shouldUsePrismaPostgres = prismaPostgresChoice;
856
+ }
857
+ const shouldMigrateAndSeed = !(context.shouldInstall && context.shouldGenerate && !(shouldUseComputePostgres && options.skipMigrateAndSeedPrompt)) ? false : input.migrateAndSeed ?? (useDefaults ? DEFAULT_MIGRATE_AND_SEED : await promptForMigrateAndSeed());
858
+ if (shouldMigrateAndSeed === void 0) return;
859
+ return {
860
+ ...context,
861
+ shouldUsePrismaPostgres,
848
862
  shouldMigrateAndSeed
849
863
  };
850
864
  }
@@ -1038,7 +1052,7 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
1038
1052
  async function generatePrismaClientForContext(context, projectDir) {
1039
1053
  const prismaProjectDir = await resolvePrismaProjectDir(projectDir);
1040
1054
  if (!context.shouldGenerate) return { didGenerateClient: false };
1041
- const generateCommand = getPrismaCliCommand(context.packageManager, ["generate"]);
1055
+ const generateCommand = getPrismaCliCommand$1(context.packageManager, ["generate"]);
1042
1056
  if (context.verbose) log.step(`Running ${generateCommand}`);
1043
1057
  const generateSpinner = context.verbose ? void 0 : spinner();
1044
1058
  generateSpinner?.start("Generating Prisma Client...");
@@ -1072,33 +1086,37 @@ function buildNextStepsForContext(opts) {
1072
1086
  const nextSteps = [...options.prependNextSteps ?? []];
1073
1087
  if (!context.shouldInstall) nextSteps.push(`- ${getInstallCommand(context.packageManager)}`);
1074
1088
  if (!didGenerateClient || !context.shouldGenerate) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:generate")}`);
1075
- if (!didMigrate) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:migrate")}`);
1076
- if (!didSeed) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:seed")}`);
1089
+ if (options.includeMigrationAndSeedNextSteps !== false && !didMigrate) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:migrate")}`);
1090
+ if (options.includeMigrationAndSeedNextSteps !== false && !didSeed) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:seed")}`);
1077
1091
  if (options.includeDevNextStep) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "dev")}`);
1078
1092
  return nextSteps;
1079
1093
  }
1080
1094
  async function executePrismaSetupContext(context, options = {}) {
1081
1095
  const projectDir = path.resolve(options.projectDir ?? context.projectDir);
1082
1096
  const provisionResult = await provisionPrismaPostgresIfNeeded(context, projectDir);
1083
- if (!provisionResult) return false;
1084
- if (!await writeDependenciesForContext(context, projectDir)) return false;
1085
- if (!await installDependenciesForContext(context, projectDir)) return false;
1086
- if (!await finalizePrismaFilesForContext(context, projectDir, provisionResult)) return false;
1097
+ if (!provisionResult) return { ok: false };
1098
+ if (!await writeDependenciesForContext(context, projectDir)) return { ok: false };
1099
+ if (!await installDependenciesForContext(context, projectDir)) return { ok: false };
1100
+ if (!await finalizePrismaFilesForContext(context, projectDir, provisionResult)) return { ok: false };
1101
+ const databaseUrl = provisionResult.databaseUrl ?? context.databaseUrl ?? getDefaultDatabaseUrl(context.databaseProvider);
1087
1102
  const generateResult = await generatePrismaClientForContext(context, projectDir);
1088
- const migrateAndSeedResult = await migrateAndSeedIfRequested(context, projectDir, { didGenerateClient: generateResult.didGenerateClient });
1089
- const warningLines = buildWarningLines(provisionResult.warning, generateResult.warning, migrateAndSeedResult.warning);
1090
- const nextSteps = buildNextStepsForContext({
1091
- context,
1092
- options,
1093
- didGenerateClient: generateResult.didGenerateClient,
1094
- didMigrate: migrateAndSeedResult.didMigrate,
1095
- didSeed: migrateAndSeedResult.didSeed
1103
+ const migrateAndSeedResult = await migrateAndSeedIfRequested(context, projectDir, {
1104
+ databaseUrl,
1105
+ didGenerateClient: generateResult.didGenerateClient
1096
1106
  });
1097
- outro(`Setup complete.${warningLines.length > 0 ? `\n\n${warningLines.join("\n")}` : ""}
1098
-
1099
- Next steps:
1100
- ${nextSteps.join("\n")}`);
1101
- return true;
1107
+ const warningLines = buildWarningLines(provisionResult.warning, generateResult.warning, migrateAndSeedResult.warning);
1108
+ return {
1109
+ ok: true,
1110
+ nextSteps: buildNextStepsForContext({
1111
+ context,
1112
+ options,
1113
+ didGenerateClient: generateResult.didGenerateClient,
1114
+ didMigrate: migrateAndSeedResult.didMigrate,
1115
+ didSeed: migrateAndSeedResult.didSeed
1116
+ }),
1117
+ warningSection: warningLines.length > 0 ? `\n\n${warningLines.join("\n")}` : "",
1118
+ databaseUrl: provisionResult.databaseUrl ?? context.databaseUrl
1119
+ };
1102
1120
  }
1103
1121
  async function migrateAndSeedIfRequested(context, projectDir, options) {
1104
1122
  const prismaProjectDir = await resolvePrismaProjectDir(projectDir);
@@ -1111,6 +1129,11 @@ async function migrateAndSeedIfRequested(context, projectDir, options) {
1111
1129
  didSeed: false,
1112
1130
  warning: "Skipped migrate + seed because the Prisma Client was not generated."
1113
1131
  };
1132
+ if (!options.databaseUrl) return {
1133
+ didMigrate: false,
1134
+ didSeed: false,
1135
+ warning: "Skipped migrate + seed because no DATABASE_URL is available."
1136
+ };
1114
1137
  const migrateInvocation = getPrismaCliArgs(context.packageManager, [
1115
1138
  "migrate",
1116
1139
  "dev",
@@ -1130,7 +1153,7 @@ async function migrateAndSeedIfRequested(context, projectDir, options) {
1130
1153
  migrateSpinner.stop("Initial migration applied.");
1131
1154
  didMigrate = true;
1132
1155
  } catch (error) {
1133
- migrateSpinner.error(`Migration failed${error instanceof Error ? `: ${error.message}` : "."}`);
1156
+ migrateSpinner.stop(`Migration failed${error instanceof Error ? `: ${error.message}` : "."}`);
1134
1157
  return {
1135
1158
  didMigrate: false,
1136
1159
  didSeed: false,
@@ -1148,7 +1171,7 @@ async function migrateAndSeedIfRequested(context, projectDir, options) {
1148
1171
  seedSpinner.stop("Database seeded.");
1149
1172
  didSeed = true;
1150
1173
  } catch (error) {
1151
- seedSpinner.error(`Seed failed${error instanceof Error ? `: ${error.message}` : "."}`);
1174
+ seedSpinner.stop(`Seed failed${error instanceof Error ? `: ${error.message}` : "."}`);
1152
1175
  return {
1153
1176
  didMigrate,
1154
1177
  didSeed: false,
@@ -1360,8 +1383,9 @@ const SHARED_PRISMA_SKILLS = [
1360
1383
  "prisma-upgrade-v7"
1361
1384
  ];
1362
1385
  function getAvailablePrismaSkills(provider) {
1363
- if (provider === "postgresql") return [...SHARED_PRISMA_SKILLS, "prisma-postgres"];
1364
- return [...SHARED_PRISMA_SKILLS];
1386
+ const skills = [...SHARED_PRISMA_SKILLS, "prisma-compute"];
1387
+ if (provider === "postgresql") return [...skills, "prisma-postgres"];
1388
+ return skills;
1365
1389
  }
1366
1390
  function getSkillOptions(provider) {
1367
1391
  const available = getAvailablePrismaSkills(provider);
@@ -1376,6 +1400,11 @@ function getSkillOptions(provider) {
1376
1400
  label: "prisma-client-api",
1377
1401
  hint: "Prisma Client query patterns"
1378
1402
  },
1403
+ "prisma-compute": {
1404
+ value: "prisma-compute",
1405
+ label: "prisma-compute",
1406
+ hint: "Prisma Compute deploy and hosting workflows"
1407
+ },
1379
1408
  "prisma-database-setup": {
1380
1409
  value: "prisma-database-setup",
1381
1410
  label: "prisma-database-setup",
@@ -1421,9 +1450,10 @@ const EXTENSION_TARGET_OPTIONS = [
1421
1450
  function uniqueValues(values) {
1422
1451
  return Array.from(new Set(values));
1423
1452
  }
1424
- function getRecommendedPrismaSkills(provider, shouldUsePrismaPostgres) {
1425
- const skills = [...getAvailablePrismaSkills(provider)];
1426
- if (!shouldUsePrismaPostgres) return skills.filter((skill) => skill !== "prisma-postgres");
1453
+ function getRecommendedPrismaSkills(provider, shouldUsePrismaPostgres, shouldUseComputeDeploy) {
1454
+ const skills = [...SHARED_PRISMA_SKILLS];
1455
+ if (provider === "postgresql" && shouldUsePrismaPostgres) skills.push("prisma-postgres");
1456
+ if (shouldUseComputeDeploy) skills.push("prisma-compute");
1427
1457
  return uniqueValues(skills);
1428
1458
  }
1429
1459
  async function promptForAddons() {
@@ -1521,7 +1551,7 @@ async function collectCreateAddonSetupContext(input, options) {
1521
1551
  if (addons.length === 0) return null;
1522
1552
  const scope = addons.includes("skills") || addons.includes("mcp") ? options.useDefaults ? DEFAULT_ADDON_SCOPE : await promptForAddonScope() : DEFAULT_ADDON_SCOPE;
1523
1553
  if (!scope) return;
1524
- const recommendedSkills = getRecommendedPrismaSkills(options.provider, options.shouldUsePrismaPostgres);
1554
+ const recommendedSkills = getRecommendedPrismaSkills(options.provider, options.shouldUsePrismaPostgres, options.shouldUseComputeDeploy);
1525
1555
  const skills = !addons.includes("skills") ? [] : options.useDefaults ? recommendedSkills : await promptForPrismaSkills(options.provider, recommendedSkills);
1526
1556
  if (!skills) return;
1527
1557
  const skillsAgents = !addons.includes("skills") ? [] : options.useDefaults ? [...DEFAULT_SKILLS_AGENTS] : await promptForSkillsAgents();
@@ -1689,23 +1719,295 @@ async function executeCreateAddonSetupContext(params) {
1689
1719
  addonSpinner.stop("Add-ons applied.");
1690
1720
  }
1691
1721
 
1722
+ //#endregion
1723
+ //#region src/tasks/deploy-to-compute.ts
1724
+ const PRISMA_CLI_PACKAGE = "@prisma/cli@latest";
1725
+ const DEPLOY_OPTIONS_BY_TEMPLATE = {
1726
+ hono: {
1727
+ framework: "hono",
1728
+ httpPort: 8080
1729
+ },
1730
+ elysia: {
1731
+ framework: "bun",
1732
+ httpPort: 8080,
1733
+ requiresExplicitFramework: true
1734
+ },
1735
+ next: { framework: "nextjs" },
1736
+ "tanstack-start": { framework: "tanstack-start" }
1737
+ };
1738
+ function getPrismaCliCommand(packageManager) {
1739
+ return getPackageExecutionCommand(getPrismaCliExecutionPackageManager(packageManager), [PRISMA_CLI_PACKAGE]);
1740
+ }
1741
+ function getPrismaCliAppDeployCommand(packageManager) {
1742
+ return getPackageExecutionCommand(getPrismaCliExecutionPackageManager(packageManager), [
1743
+ PRISMA_CLI_PACKAGE,
1744
+ "app",
1745
+ "deploy"
1746
+ ]);
1747
+ }
1748
+ function getComputeDeployScriptMap(context) {
1749
+ const deployArgs = [
1750
+ "--prod",
1751
+ "--yes",
1752
+ "--env",
1753
+ ".env",
1754
+ ...getComputeDeployRuntimeArgs(context)
1755
+ ];
1756
+ const deployCommand = [getPrismaCliAppDeployCommand(context.packageManager), ...deployArgs].join(" ");
1757
+ return { "compute:deploy": deployCommand };
1758
+ }
1759
+ function getComputeDeployRuntimeArgs(context) {
1760
+ return [...context.requiresExplicitFramework ? ["--framework", context.framework] : [], ...context.httpPort ? ["--http-port", String(context.httpPort)] : []];
1761
+ }
1762
+ function runPrismaCli(packageManager, args, options = {}) {
1763
+ const execution = getPackageExecutionArgs(getPrismaCliExecutionPackageManager(packageManager), [PRISMA_CLI_PACKAGE, ...args]);
1764
+ return execa(execution.command, execution.args, options);
1765
+ }
1766
+ function getPrismaCliExecutionPackageManager(packageManager) {
1767
+ return packageManager === "deno" ? "npm" : packageManager;
1768
+ }
1769
+ async function isAuthenticated(packageManager) {
1770
+ try {
1771
+ await runPrismaCli(packageManager, [
1772
+ "project",
1773
+ "list",
1774
+ "--json"
1775
+ ], { stdio: "pipe" });
1776
+ return true;
1777
+ } catch {
1778
+ return false;
1779
+ }
1780
+ }
1781
+ async function ensurePrismaCliAvailable(packageManager) {
1782
+ try {
1783
+ await runPrismaCli(packageManager, ["--help"], { stdio: "pipe" });
1784
+ return true;
1785
+ } catch (error) {
1786
+ const command = getPrismaCliCommand(packageManager);
1787
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
1788
+ log.warn(`Could not find the selected package manager. Re-run ${command} manually.`);
1789
+ return false;
1790
+ }
1791
+ log.warn(`Could not run ${command}${error instanceof Error ? `: ${redactSecrets(error.message)}` : "."}`);
1792
+ return false;
1793
+ }
1794
+ }
1795
+ async function collectComputeDeployContext(input, options) {
1796
+ if (!isComputeDeployableTemplate(options.template)) return null;
1797
+ if (input.deploy === false) return null;
1798
+ let wantsDeploy;
1799
+ if (input.deploy === true) wantsDeploy = true;
1800
+ else if (options.useDefaults) return null;
1801
+ else {
1802
+ const confirmed = await confirm({
1803
+ message: "Deploy to Prisma Compute now?",
1804
+ initialValue: false
1805
+ });
1806
+ if (isCancel(confirmed)) {
1807
+ cancel("Operation cancelled.");
1808
+ return;
1809
+ }
1810
+ wantsDeploy = confirmed;
1811
+ }
1812
+ if (!wantsDeploy) return null;
1813
+ if (!await ensurePrismaCliAvailable(options.packageManager)) {
1814
+ if (input.deploy === true) throw createExplicitDeployError("the Prisma CLI is not available");
1815
+ return null;
1816
+ }
1817
+ if (!await isAuthenticated(options.packageManager)) {
1818
+ log.info("Authenticating with Prisma...");
1819
+ try {
1820
+ await runPrismaCli(options.packageManager, ["auth", "login"], { stdio: "inherit" });
1821
+ } catch (error) {
1822
+ log.warn(`Prisma login was not completed${error instanceof Error ? `: ${redactSecrets(error.message)}` : "."}`);
1823
+ if (input.deploy === true) throw createExplicitDeployError("authentication failed", error);
1824
+ return null;
1825
+ }
1826
+ }
1827
+ const deployOptions = DEPLOY_OPTIONS_BY_TEMPLATE[options.template];
1828
+ if (!deployOptions) {
1829
+ if (input.deploy === true) throw createExplicitDeployError(`${options.template} is not supported by prisma app deploy yet`);
1830
+ return null;
1831
+ }
1832
+ return {
1833
+ template: options.template,
1834
+ packageManager: options.packageManager,
1835
+ createProjectName: options.defaultServiceName,
1836
+ framework: deployOptions.framework,
1837
+ httpPort: deployOptions.httpPort,
1838
+ requiresExplicitFramework: deployOptions.requiresExplicitFramework
1839
+ };
1840
+ }
1841
+ function redactSecrets(message) {
1842
+ return message.replace(/(['"])([A-Z0-9_]*(?:DATABASE_URL|DIRECT_URL|TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*=)(.*?)\1/g, "$1$2<redacted>$1").replace(/\b([A-Z0-9_]*(?:DATABASE_URL|DIRECT_URL|TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*=)[^\s]+/g, "$1<redacted>");
1843
+ }
1844
+ function parseJson(stdout) {
1845
+ if (typeof stdout !== "string" || stdout.trim().length === 0) return null;
1846
+ try {
1847
+ return JSON.parse(stdout);
1848
+ } catch {
1849
+ return null;
1850
+ }
1851
+ }
1852
+ function getJsonErrorMessage(error, fallback) {
1853
+ return error?.summary ?? error?.message ?? error?.name ?? fallback;
1854
+ }
1855
+ function getErrorMessage(error) {
1856
+ return redactSecrets(error instanceof Error ? error.message : String(error));
1857
+ }
1858
+ function createDeployError(message) {
1859
+ return new Error(redactSecrets(message ?? "unknown error"));
1860
+ }
1861
+ function createExplicitDeployError(reason, error) {
1862
+ const detail = error instanceof Error ? `: ${redactSecrets(error.message)}` : "";
1863
+ return /* @__PURE__ */ new Error(`Deploy requested but ${reason}${detail}`);
1864
+ }
1865
+ async function runPrismaCliJson(params) {
1866
+ try {
1867
+ const { stdout, exitCode } = await runPrismaCli(params.packageManager, params.args, {
1868
+ cwd: params.cwd,
1869
+ reject: false,
1870
+ stdio: [
1871
+ "ignore",
1872
+ "pipe",
1873
+ "pipe"
1874
+ ]
1875
+ });
1876
+ const parsed = parseJson(stdout);
1877
+ if (!parsed) return {
1878
+ ok: false,
1879
+ error: new Error(params.invalidOutputError)
1880
+ };
1881
+ if (exitCode !== 0 || !parsed.ok) return {
1882
+ ok: false,
1883
+ error: createDeployError(parsed.ok ? params.fallbackError : getJsonErrorMessage(parsed.error, params.fallbackError))
1884
+ };
1885
+ return {
1886
+ ok: true,
1887
+ result: parsed.result
1888
+ };
1889
+ } catch (error) {
1890
+ return {
1891
+ ok: false,
1892
+ error: new Error(getErrorMessage(error))
1893
+ };
1894
+ }
1895
+ }
1896
+ function toComputeDeployResult(data) {
1897
+ return {
1898
+ appUrl: data.deployment.url,
1899
+ appId: data.app.id,
1900
+ appName: data.app.name,
1901
+ deploymentId: data.deployment.id,
1902
+ projectId: data.project.id,
1903
+ projectName: data.project.name,
1904
+ branchName: data.branch.name,
1905
+ database: data.branchDatabase?.database
1906
+ };
1907
+ }
1908
+ async function executeComputeDatabaseSetup(params) {
1909
+ const projectSpinner = spinner();
1910
+ projectSpinner.start("Creating Prisma Compute project...");
1911
+ const projectResult = await runPrismaCliJson({
1912
+ packageManager: params.context.packageManager,
1913
+ args: [
1914
+ "project",
1915
+ "create",
1916
+ params.context.createProjectName,
1917
+ "--json"
1918
+ ],
1919
+ cwd: params.projectDir,
1920
+ fallbackError: "Prisma project create failed.",
1921
+ invalidOutputError: "Invalid prisma project create output"
1922
+ });
1923
+ if (!projectResult.ok) {
1924
+ projectSpinner.error(`Project creation failed: ${projectResult.error.message}`);
1925
+ return {
1926
+ ok: false,
1927
+ cancelled: false,
1928
+ error: projectResult.error
1929
+ };
1930
+ }
1931
+ projectSpinner.stop("Prisma Compute project created.");
1932
+ const databaseSpinner = spinner();
1933
+ databaseSpinner.start("Creating Prisma Postgres database...");
1934
+ const databaseResult = await runPrismaCliJson({
1935
+ packageManager: params.context.packageManager,
1936
+ args: [
1937
+ "database",
1938
+ "create",
1939
+ "main",
1940
+ "--branch",
1941
+ "main",
1942
+ "--json"
1943
+ ],
1944
+ cwd: params.projectDir,
1945
+ fallbackError: "Prisma database create failed.",
1946
+ invalidOutputError: "Invalid prisma database create output"
1947
+ });
1948
+ if (!databaseResult.ok) {
1949
+ databaseSpinner.error(`Database creation failed: ${databaseResult.error.message}`);
1950
+ return {
1951
+ ok: false,
1952
+ cancelled: false,
1953
+ error: databaseResult.error
1954
+ };
1955
+ }
1956
+ databaseSpinner.stop("Prisma Postgres database created.");
1957
+ return {
1958
+ ok: true,
1959
+ result: {
1960
+ databaseUrl: databaseResult.result.connectionString,
1961
+ projectId: databaseResult.result.projectId,
1962
+ projectName: databaseResult.result.projectName,
1963
+ database: databaseResult.result.database
1964
+ }
1965
+ };
1966
+ }
1967
+ async function executeComputeDeployContext(params) {
1968
+ const deploySpinner = spinner();
1969
+ deploySpinner.start("Deploying to Prisma Compute...");
1970
+ const args = [
1971
+ "app",
1972
+ "deploy",
1973
+ "--json",
1974
+ "--yes",
1975
+ "--prod",
1976
+ "--env",
1977
+ ".env",
1978
+ ...params.createProject === false ? [] : ["--create-project", params.context.createProjectName],
1979
+ ...getComputeDeployRuntimeArgs(params.context)
1980
+ ];
1981
+ const deployResult = await runPrismaCliJson({
1982
+ packageManager: params.context.packageManager,
1983
+ args,
1984
+ cwd: params.projectDir,
1985
+ fallbackError: "Prisma app deploy failed.",
1986
+ invalidOutputError: "Invalid prisma app deploy output"
1987
+ });
1988
+ if (!deployResult.ok) {
1989
+ deploySpinner.error(`Deploy failed: ${deployResult.error.message}`);
1990
+ return {
1991
+ ok: false,
1992
+ cancelled: false,
1993
+ error: deployResult.error
1994
+ };
1995
+ }
1996
+ deploySpinner.stop("Deployed to Prisma Compute.");
1997
+ return {
1998
+ ok: true,
1999
+ result: toComputeDeployResult(deployResult.result)
2000
+ };
2001
+ }
2002
+
1692
2003
  //#endregion
1693
2004
  //#region src/telemetry/client.ts
1694
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
2005
+ const TELEMETRY_API_KEY = "";
1695
2006
  const TELEMETRY_HOST = "https://us.i.posthog.com";
1696
2007
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
1697
2008
  const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
1698
- function isTruthyEnvValue(value) {
1699
- return [
1700
- "1",
1701
- "true",
1702
- "yes",
1703
- "on"
1704
- ].includes(String(value ?? "").trim().toLowerCase());
1705
- }
1706
2009
  function shouldDisableTelemetry() {
1707
- if (isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS)) return true;
1708
- return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
2010
+ return true;
1709
2011
  }
1710
2012
  function getTelemetryConfigDir() {
1711
2013
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -1727,7 +2029,7 @@ async function getAnonymousId() {
1727
2029
  }
1728
2030
  function getCommonProperties() {
1729
2031
  return {
1730
- "cli-version": "0.4.2",
2032
+ "cli-version": "0.5.0-pr.42.125.1",
1731
2033
  "node-version": process.version,
1732
2034
  platform: process.platform,
1733
2035
  arch: process.arch
@@ -2003,15 +2305,27 @@ async function collectCreateContext(input) {
2003
2305
  cancel(`Target directory ${formatPathForDisplay(targetDirectory)} is not empty. Use --force to continue.`);
2004
2306
  return;
2005
2307
  }
2006
- const prismaSetupContext = await collectPrismaSetupContext(input, {
2308
+ const prismaSetupInitialContext = await collectPrismaSetupInitialContext(input, {
2007
2309
  projectDir: targetDirectory,
2008
2310
  defaultSchemaPreset: DEFAULT_SCHEMA_PRESET
2009
2311
  });
2312
+ if (!prismaSetupInitialContext) return;
2313
+ const projectPackageName = toPackageName(path.basename(targetDirectory));
2314
+ const computeDeployContext = await collectComputeDeployContext(input, {
2315
+ template,
2316
+ packageManager: prismaSetupInitialContext.packageManager,
2317
+ useDefaults,
2318
+ defaultServiceName: projectPackageName
2319
+ });
2320
+ if (computeDeployContext === void 0) return;
2321
+ const useComputeDatabase = Boolean(computeDeployContext && prismaSetupInitialContext.databaseProvider === "postgresql" && !prismaSetupInitialContext.databaseUrl && input.prismaPostgres !== false);
2322
+ const prismaSetupContext = await completePrismaSetupContext(input, prismaSetupInitialContext, { useComputePostgres: useComputeDatabase });
2010
2323
  if (!prismaSetupContext) return;
2011
2324
  const addonSetupContext = await collectCreateAddonSetupContext(input, {
2012
2325
  useDefaults,
2013
2326
  provider: prismaSetupContext.databaseProvider,
2014
- shouldUsePrismaPostgres: prismaSetupContext.shouldUsePrismaPostgres
2327
+ shouldUsePrismaPostgres: prismaSetupContext.shouldUsePrismaPostgres,
2328
+ shouldUseComputeDeploy: Boolean(computeDeployContext)
2015
2329
  });
2016
2330
  if (addonSetupContext === void 0) return;
2017
2331
  return {
@@ -2019,9 +2333,11 @@ async function collectCreateContext(input) {
2019
2333
  targetPathState,
2020
2334
  force,
2021
2335
  template,
2022
- projectPackageName: toPackageName(path.basename(targetDirectory)),
2336
+ projectPackageName,
2023
2337
  prismaSetupContext,
2024
- addonSetupContext: addonSetupContext ?? void 0
2338
+ addonSetupContext: addonSetupContext ?? void 0,
2339
+ computeDeployContext: computeDeployContext ?? void 0,
2340
+ useComputeDatabase
2025
2341
  };
2026
2342
  }
2027
2343
  async function executeCreateContext(context) {
@@ -2034,7 +2350,8 @@ async function executeCreateContext(context) {
2034
2350
  template: context.template,
2035
2351
  schemaPreset: context.prismaSetupContext.schemaPreset,
2036
2352
  provider: context.prismaSetupContext.databaseProvider,
2037
- packageManager: context.prismaSetupContext.packageManager
2353
+ packageManager: context.prismaSetupContext.packageManager,
2354
+ compute: Boolean(context.computeDeployContext)
2038
2355
  });
2039
2356
  scaffoldSpinner.stop("Project files scaffolded.");
2040
2357
  } catch (error) {
@@ -2051,6 +2368,11 @@ async function executeCreateContext(context) {
2051
2368
  packageManager: context.prismaSetupContext.packageManager,
2052
2369
  projectDir: context.targetDirectory
2053
2370
  });
2371
+ if (context.computeDeployContext) await addPackageDependency({
2372
+ scripts: getComputeDeployScriptMap(context.computeDeployContext),
2373
+ scriptMode: "if-missing",
2374
+ projectDir: context.targetDirectory
2375
+ });
2054
2376
  } catch (error) {
2055
2377
  return {
2056
2378
  ok: false,
@@ -2074,12 +2396,38 @@ async function executeCreateContext(context) {
2074
2396
  error
2075
2397
  };
2076
2398
  }
2399
+ let computeDatabaseResult;
2400
+ if (context.useComputeDatabase && context.computeDeployContext) try {
2401
+ const result = await executeComputeDatabaseSetup({
2402
+ context: context.computeDeployContext,
2403
+ projectDir: context.targetDirectory
2404
+ });
2405
+ if (!result.ok && !result.cancelled) return {
2406
+ ok: false,
2407
+ stage: "compute_deploy",
2408
+ error: result.error
2409
+ };
2410
+ if (result.ok) computeDatabaseResult = result.result;
2411
+ } catch (error) {
2412
+ return {
2413
+ ok: false,
2414
+ stage: "compute_deploy",
2415
+ error
2416
+ };
2417
+ }
2418
+ const prismaSetupContext = computeDatabaseResult ? {
2419
+ ...context.prismaSetupContext,
2420
+ databaseUrl: computeDatabaseResult.databaseUrl,
2421
+ shouldUsePrismaPostgres: false
2422
+ } : context.prismaSetupContext;
2423
+ let prismaResult;
2077
2424
  try {
2078
- if (!await executePrismaSetupContext(context.prismaSetupContext, {
2425
+ prismaResult = await executePrismaSetupContext(prismaSetupContext, {
2079
2426
  prependNextSteps: nextSteps,
2080
2427
  projectDir: context.targetDirectory,
2081
- includeDevNextStep: true
2082
- })) return {
2428
+ includeDevNextStep: !context.useComputeDatabase
2429
+ });
2430
+ if (!prismaResult.ok) return {
2083
2431
  ok: false,
2084
2432
  stage: "prisma_setup"
2085
2433
  };
@@ -2090,6 +2438,37 @@ async function executeCreateContext(context) {
2090
2438
  error
2091
2439
  };
2092
2440
  }
2441
+ let deployResult;
2442
+ if (context.computeDeployContext) try {
2443
+ const result = await executeComputeDeployContext({
2444
+ context: context.computeDeployContext,
2445
+ projectDir: context.targetDirectory,
2446
+ createProject: !computeDatabaseResult
2447
+ });
2448
+ if (!result.ok && !result.cancelled) return {
2449
+ ok: false,
2450
+ stage: "compute_deploy",
2451
+ error: result.error
2452
+ };
2453
+ if (result.ok) {
2454
+ deployResult = result.result;
2455
+ prismaResult.nextSteps.push(`- ${getRunScriptCommand(context.prismaSetupContext.packageManager, "compute:deploy")}`);
2456
+ }
2457
+ } catch (error) {
2458
+ return {
2459
+ ok: false,
2460
+ stage: "compute_deploy",
2461
+ error
2462
+ };
2463
+ }
2464
+ const summaryLines = [];
2465
+ summaryLines.push(`Setup complete.${prismaResult.warningSection}`);
2466
+ if (deployResult) {
2467
+ const database = computeDatabaseResult?.database ?? deployResult.database;
2468
+ summaryLines.push("", "Deployed to Prisma Compute:", ...deployResult.appUrl ? [`- App URL: ${deployResult.appUrl}`] : [], `- App: ${deployResult.appName} (${deployResult.appId})`, `- Deployment: ${deployResult.deploymentId}`, ...database ? [`- Database: ${database.name} (${database.id})`] : []);
2469
+ }
2470
+ summaryLines.push("", "Next steps:", prismaResult.nextSteps.join("\n"));
2471
+ outro(summaryLines.join("\n"));
2093
2472
  return { ok: true };
2094
2473
  }
2095
2474
 
package/dist/index.d.mts CHANGED
@@ -248,6 +248,7 @@ declare const CreateCommandInputSchema: z.ZodObject<{
248
248
  skills: z.ZodOptional<z.ZodBoolean>;
249
249
  mcp: z.ZodOptional<z.ZodBoolean>;
250
250
  extension: z.ZodOptional<z.ZodBoolean>;
251
+ deploy: z.ZodOptional<z.ZodBoolean>;
251
252
  force: z.ZodOptional<z.ZodBoolean>;
252
253
  }, z.core.$strip>;
253
254
  type CreateCommandInput = z.infer<typeof CreateCommandInputSchema>;
@@ -295,6 +296,7 @@ declare const router: {
295
296
  skills: zod.ZodOptional<zod.ZodBoolean>;
296
297
  mcp: zod.ZodOptional<zod.ZodBoolean>;
297
298
  extension: zod.ZodOptional<zod.ZodBoolean>;
299
+ deploy: zod.ZodOptional<zod.ZodBoolean>;
298
300
  force: zod.ZodOptional<zod.ZodBoolean>;
299
301
  }, zod_v4_core0.$strip>>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
300
302
  };
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseUrlSchema, i as DatabaseProviderSchema, n as CreateCommandInputSchema, o as PackageManagerSchema, r as CreateTemplateSchema, s as SchemaPresetSchema, t as runCreateCommand } from "./create-Cy_IS-sg.mjs";
2
+ import { a as DatabaseUrlSchema, i as DatabaseProviderSchema, n as CreateCommandInputSchema, o as PackageManagerSchema, r as CreateTemplateSchema, s as SchemaPresetSchema, t as runCreateCommand } from "./create-ClKlnRHX.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";
7
+ const CLI_VERSION = "0.5.0-pr.42.125.1";
8
8
  const router = os.router({ create: os.meta({
9
9
  description: "Create a new project with Prisma setup",
10
10
  default: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.4.2",
3
+ "version": "0.5.0-pr.42.125.1",
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",
@@ -8,6 +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
+ {{#if compute}}
12
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
13
+ {{/if}}
11
14
 
12
15
  ## Prisma
13
16
 
@@ -33,3 +36,11 @@ The starter page queries a basic `User` model in `src/pages/index.astro`, and `s
33
36
 
34
37
  The starter page keeps the official Astro minimal structure and points you to `prisma/schema.prisma` for your first model.
35
38
  {{/if}}
39
+ {{#if compute}}
40
+
41
+ ## Prisma Compute
42
+
43
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
44
+
45
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
46
+ {{/if}}
@@ -0,0 +1,10 @@
1
+ // @ts-check
2
+ import { defineConfig } from "astro/config";
3
+ import node from "@astrojs/node";
4
+
5
+ // https://astro.build/config
6
+ export default defineConfig({
7
+ output: "server",
8
+ adapter: node({ mode: "standalone" }),
9
+ server: { host: true },
10
+ });
@@ -12,7 +12,8 @@
12
12
  "astro": "astro"
13
13
  },
14
14
  "dependencies": {
15
- "astro": "^5.17.1"
15
+ "astro": "^5.17.1",
16
+ "@astrojs/node": "^9.5.5"
16
17
  },
17
18
  "devDependencies": {
18
19
  "@types/node": "^24.3.0",
@@ -7,6 +7,9 @@ Generated by `create-prisma` with the Elysia template.
7
7
  - `{{runScriptCommand packageManager "dev"}}` - start local dev server with hot reload
8
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
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}}
10
13
 
11
14
  ## Prisma
12
15
 
@@ -30,3 +33,11 @@ Generated Prisma files are written to `src/generated/prisma`.
30
33
 
31
34
  The template includes a basic `User` model, a sample `GET /users` endpoint, and seed data in `prisma/seed.ts`.
32
35
  {{/if}}
36
+ {{#if compute}}
37
+
38
+ ## Prisma Compute
39
+
40
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
41
+
42
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
43
+ {{/if}}
@@ -5,6 +5,7 @@
5
5
  "packageManager": "{{packageManagerManifestValue packageManager}}",
6
6
  {{/if}}
7
7
  "type": "module",
8
+ "main": "src/index.ts",
8
9
  "scripts": {
9
10
  "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/src/index.js" denoFlags="--unstable-net"}}",
10
11
  "build": "{{runtimeScript packageManager "build" "src/index.ts" "dist/src/index.js"}}",
@@ -13,7 +13,7 @@ import { prisma } from "./lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}
13
13
  const rawPort = ({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? "").trim();
14
14
  const parsedPort = rawPort.length > 0 ? Number(rawPort) : Number.NaN;
15
15
  const port =
16
- Number.isInteger(parsedPort) && parsedPort >= 0 && parsedPort <= 65535 ? parsedPort : 3000;
16
+ Number.isInteger(parsedPort) && parsedPort >= 0 && parsedPort <= 65535 ? parsedPort : 8080;
17
17
 
18
18
  const app = new Elysia({{#if (eq packageManager "deno")}}{{else}}{ adapter: node() }{{/if}})
19
19
  .get("/", () => {
@@ -7,6 +7,9 @@ Generated by `create-prisma` with the Hono template.
7
7
  - `{{runScriptCommand packageManager "dev"}}` - start local dev server
8
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
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}}
10
13
 
11
14
  ## Prisma
12
15
 
@@ -30,3 +33,11 @@ Generated Prisma files are written to `src/generated/prisma`.
30
33
 
31
34
  The template includes a basic `User` model, a sample `GET /users` endpoint, and seed data in `prisma/seed.ts`.
32
35
  {{/if}}
36
+ {{#if compute}}
37
+
38
+ ## Prisma Compute
39
+
40
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
41
+
42
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
43
+ {{/if}}
@@ -5,6 +5,7 @@
5
5
  "packageManager": "{{packageManagerManifestValue packageManager}}",
6
6
  {{/if}}
7
7
  "type": "module",
8
+ "main": "src/index.ts",
8
9
  "scripts": {
9
10
  "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/src/index.js"}}",
10
11
  "build": "{{runtimeScript packageManager "build" "src/index.ts" "dist/src/index.js"}}",
@@ -31,7 +31,7 @@ app.get("/users", async (c) => {
31
31
  const rawPort = ({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? "").trim();
32
32
  const parsedPort = rawPort.length > 0 ? Number(rawPort) : Number.NaN;
33
33
  const port =
34
- Number.isInteger(parsedPort) && parsedPort >= 0 && parsedPort <= 65535 ? parsedPort : 3000;
34
+ Number.isInteger(parsedPort) && parsedPort >= 0 && parsedPort <= 65535 ? parsedPort : 8080;
35
35
  serve({
36
36
  fetch: app.fetch,
37
37
  port,
@@ -7,6 +7,9 @@ Generated by `create-prisma` with the NestJS template.
7
7
  - `{{runScriptCommand packageManager "dev"}}` - start the Nest dev server with watch mode
8
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}}compile the app into `dist/`{{/if}}{{/if}}
9
9
  - `{{runScriptCommand packageManager "start"}}` - {{#if (eq packageManager "deno")}}run the server directly from `src/main.ts` with Deno{{else}}{{#if (eq packageManager "bun")}}run the server directly from `src/main.ts` with Bun{{else}}run the compiled server from `dist/main.js`{{/if}}{{/if}}
10
+ {{#if compute}}
11
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
12
+ {{/if}}
10
13
 
11
14
  ## Prisma
12
15
 
@@ -30,3 +33,11 @@ Generated Prisma files are written to `src/generated/prisma`.
30
33
 
31
34
  The template includes a basic `User` model, a sample `GET /users` endpoint, and seed data in `prisma/seed.ts`.
32
35
  {{/if}}
36
+ {{#if compute}}
37
+
38
+ ## Prisma Compute
39
+
40
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
41
+
42
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
43
+ {{/if}}
@@ -7,6 +7,9 @@ Generated by `create-prisma` with the Next.js template.
7
7
  - `{{runScriptCommand packageManager "dev"}}` - start local dev server
8
8
  - `{{runScriptCommand packageManager "build"}}` - production build
9
9
  - `{{runScriptCommand packageManager "start"}}` - run production server
10
+ {{#if compute}}
11
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
12
+ {{/if}}
10
13
 
11
14
  ## Prisma
12
15
 
@@ -28,3 +31,11 @@ Database helper scripts are added to `package.json`:
28
31
 
29
32
  The starter page in `src/app/page.tsx` reads from a basic `User` model so you can verify queries quickly, and `prisma/seed.ts` inserts starter users.
30
33
  {{/if}}
34
+ {{#if compute}}
35
+
36
+ ## Prisma Compute
37
+
38
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
39
+
40
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
41
+ {{/if}}
@@ -1,7 +1,7 @@
1
1
  import type { NextConfig } from "next";
2
2
 
3
3
  const nextConfig: NextConfig = {
4
- // Add Next config here when needed.
4
+ output: "standalone",
5
5
  };
6
6
 
7
7
  export default nextConfig;
@@ -8,6 +8,9 @@ Generated by `create-prisma` with the Nuxt template.
8
8
  - `{{runScriptCommand packageManager "build"}}` - build for production
9
9
  - `{{runScriptCommand packageManager "preview"}}` - preview the production build
10
10
  - `{{runScriptCommand packageManager "typecheck"}}` - run Nuxt type checks
11
+ {{#if compute}}
12
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
13
+ {{/if}}
11
14
 
12
15
  ## Prisma
13
16
 
@@ -30,3 +33,11 @@ Database helper scripts are added to `package.json`:
30
33
 
31
34
  The starter page in `app/pages/index.vue` fetches seeded users from `server/api/users.get.ts`, and `prisma/seed.ts` inserts starter users.
32
35
  {{/if}}
36
+ {{#if compute}}
37
+
38
+ ## Prisma Compute
39
+
40
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
41
+
42
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
43
+ {{/if}}
@@ -8,6 +8,9 @@ Generated by `create-prisma` with the SvelteKit template.
8
8
  - `{{runScriptCommand packageManager "build"}}` - build for production
9
9
  - `{{runScriptCommand packageManager "preview"}}` - preview the production build
10
10
  - `{{runScriptCommand packageManager "check"}}` - run SvelteKit sync and type checks
11
+ {{#if compute}}
12
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
13
+ {{/if}}
11
14
 
12
15
  ## Prisma
13
16
 
@@ -32,3 +35,11 @@ The starter page loads users in `+page.server.ts`, renders them in `+page.svelte
32
35
 
33
36
  The starter page keeps the official SvelteKit minimal structure and points you to `prisma/schema.prisma` for your first model.
34
37
  {{/if}}
38
+ {{#if compute}}
39
+
40
+ ## Prisma Compute
41
+
42
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
43
+
44
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
45
+ {{/if}}
@@ -8,6 +8,9 @@ Generated by `create-prisma` with the TanStack Start template.
8
8
  - `{{runScriptCommand packageManager "build"}}` - build for production
9
9
  - `{{runScriptCommand packageManager "preview"}}` - preview the production build
10
10
  - `{{runScriptCommand packageManager "typecheck"}}` - run TypeScript checks
11
+ {{#if compute}}
12
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
13
+ {{/if}}
11
14
 
12
15
  ## Prisma
13
16
 
@@ -29,3 +32,11 @@ Database helper scripts are added to `package.json`:
29
32
 
30
33
  The home route uses a TanStack Start server function to load users with the Prisma client from `src/lib/prisma.server.ts`, so you can verify a real database query without adding an API route first.
31
34
  {{/if}}
35
+ {{#if compute}}
36
+
37
+ ## Prisma Compute
38
+
39
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
40
+
41
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
42
+ {{/if}}
@@ -7,27 +7,27 @@
7
7
  {{/if}}
8
8
  "type": "module",
9
9
  "scripts": {
10
- "dev": "vite dev --port 3000",
10
+ "dev": "vite dev",
11
11
  "build": "vite build",
12
+ "start": "node .output/server/index.mjs",
12
13
  "preview": "vite preview",
13
14
  "typecheck": "tsc --noEmit"
14
15
  },
15
16
  "dependencies": {
16
- "@tanstack/react-router": "^1.132.0",
17
- "@tanstack/react-start": "^1.132.0",
17
+ "@tanstack/react-router": "^1.167.42",
18
+ "@tanstack/react-start": "^1.167.42",
19
+ "nitro": "^3.0.260415-beta",
18
20
  "react": "^19.2.0",
19
21
  "react-dom": "^19.2.0"
20
22
  },
21
23
  "devDependencies": {
22
- "@tanstack/router-plugin": "^1.132.0",
23
24
  "@types/node": "^24.3.0",
24
25
  "@types/react": "^19.2.2",
25
26
  "@types/react-dom": "^19.2.2",
26
- "@vitejs/plugin-react": "^5.1.4",
27
+ "@vitejs/plugin-react": "^6.0.0",
27
28
  "tsx": "^4.7.1",
28
29
  "typescript": "^5.9.3",
29
- "vite": "^7.3.1",
30
- "vite-tsconfig-paths": "^5.1.4"
30
+ "vite": "^8.0.8"
31
31
  }
32
32
  }
33
33
 
@@ -1,8 +1,16 @@
1
1
  import { defineConfig } from "vite";
2
2
  import viteReact from "@vitejs/plugin-react";
3
3
  import { tanstackStart } from "@tanstack/react-start/plugin/vite";
4
- import tsconfigPaths from "vite-tsconfig-paths";
4
+ import { nitro } from "nitro/vite";
5
5
 
6
6
  export default defineConfig({
7
- plugins: [tsconfigPaths({ projects: ["./tsconfig.json"] }), tanstackStart(), viteReact()],
7
+ resolve: {
8
+ tsconfigPaths: true,
9
+ },
10
+ plugins: [
11
+ tanstackStart(),
12
+ nitro(),
13
+ // react's vite plugin must come after start's vite plugin
14
+ viteReact(),
15
+ ],
8
16
  });
@@ -15,6 +15,9 @@ Generated by `create-prisma` with the Turborepo template.
15
15
  - `{{runScriptCommand packageManager "db:generate"}}` - generate Prisma Client in `packages/db`
16
16
  - `{{runScriptCommand packageManager "db:migrate"}}` - create/apply migrations in `packages/db`
17
17
  - `{{runScriptCommand packageManager "db:seed"}}` - run seed script in `packages/db`
18
+ {{#if compute}}
19
+ - `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `.env`
20
+ {{/if}}
18
21
 
19
22
  ## Prisma
20
23
 
@@ -27,3 +30,11 @@ Prisma is scaffolded inside `packages/db`:
27
30
  - `packages/db/src/generated/prisma`
28
31
 
29
32
  `apps/api/src/index.ts` imports the shared Prisma client from `@repo/db`.
33
+ {{#if compute}}
34
+
35
+ ## Prisma Compute
36
+
37
+ This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
38
+
39
+ After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
40
+ {{/if}}
@@ -1,5 +0,0 @@
1
- // @ts-check
2
- import { defineConfig } from "astro/config";
3
-
4
- // https://astro.build/config
5
- export default defineConfig({});