create-strata 2.2.37 → 2.2.39

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/dist/cli.js CHANGED
@@ -2877,6 +2877,8 @@ function renderEnvExample(projectName, layers) {
2877
2877
  `APP_KEY_PREFIX=${projectName}`,
2878
2878
  "APP_ENV=local",
2879
2879
  "PORT=3000",
2880
+ "# Optional TCP listen address, separate from public APP_URL / tenant hosts.",
2881
+ "# HOST=0.0.0.0",
2880
2882
  "# Total graceful shutdown budget in milliseconds; keep deployment grace longer.",
2881
2883
  "SHUTDOWN_TIMEOUT_MS=30000",
2882
2884
  "APP_URL=http://localhost:3000",
@@ -3177,9 +3179,9 @@ function renderPackageJson(projectName, options = {}) {
3177
3179
  "@getstrata/cli": "workspace:*",
3178
3180
  "@getstrata/core": "workspace:*"
3179
3181
  } : {
3180
- "@getstrata/bootstrap": "^2.2.37",
3181
- "@getstrata/cli": "^2.2.37",
3182
- "@getstrata/core": "^2.2.37"
3182
+ "@getstrata/bootstrap": "^2.2.39",
3183
+ "@getstrata/cli": "^2.2.39",
3184
+ "@getstrata/core": "^2.2.39"
3183
3185
  };
3184
3186
  coreDeps.eta = "^4.6.0";
3185
3187
  if (options.layers?.database === "mysql") {
@@ -4419,6 +4421,8 @@ configureModulesDirectory(join(import.meta.dir, "../modules"));
4419
4421
  function renderConfigTs() {
4420
4422
  return `export interface AppConfig {
4421
4423
  port: number;
4424
+ /** Optional listen address; independent of the trusted public APP_URL. */
4425
+ hostname?: string;
4422
4426
  appUrl: string;
4423
4427
  databaseUrl: string;
4424
4428
  }
@@ -4431,6 +4435,7 @@ export function loadConfig(): AppConfig {
4431
4435
 
4432
4436
  return {
4433
4437
  port: Number(process.env.PORT ?? 3000),
4438
+ hostname: process.env.HOST?.trim() || undefined,
4434
4439
  appUrl: process.env.APP_URL ?? "http://localhost:3000",
4435
4440
  databaseUrl,
4436
4441
  };
@@ -4686,7 +4691,7 @@ import {
4686
4691
  } from "@getstrata/bootstrap/discoverModules";
4687
4692
  import { createHealthRoutes } from "@getstrata/bootstrap/health";
4688
4693
  ${metricsImport}import { assertProductionSecrets, assertRlsLiveDatabaseRole } from "@getstrata/bootstrap/secretsGuard";
4689
- import { createWebServer } from "@getstrata/bootstrap/web/server";
4694
+ import { createWebServer, type NativeServerOptions } from "@getstrata/bootstrap/web/server";
4690
4695
  import type { LifecycleCoordinator } from "@getstrata/core/lifecycle/gracefulShutdown";
4691
4696
  import { isProductionEnv } from "@getstrata/core/runtime/appEnv";
4692
4697
  import { isRlsTenancy } from "@getstrata/core/tenant/tenancyConfig";
@@ -4698,6 +4703,7 @@ import { closeDatabase, getSql, pingDatabase } from "./database.ts";
4698
4703
  ${ensureLine}import { starterProviders } from "./providers/index.ts";
4699
4704
 
4700
4705
  export interface BootstrapOptions {
4706
+ /** Automatic migrations and local database provisioning; false uses existing infrastructure. */
4701
4707
  migrate?: boolean;${layers.extras.metrics ? `
4702
4708
  /** Explicit opt-in; HTTP-only metrics remain the default. */
4703
4709
  runtimeMetrics?: MetricsRuntimeOptions;` : ""}
@@ -4734,7 +4740,7 @@ export async function bootstrapApp(options: BootstrapOptions = {}): Promise<Boot
4734
4740
  assertProductionSecrets();
4735
4741
  }
4736
4742
 
4737
- ${needsEnsure(layers) ? ` await ensureAppDatabase({ provision: !isProduction });
4743
+ ${needsEnsure(layers) ? ` await ensureAppDatabase({ provision: !isProduction && runMigrate });
4738
4744
  ` : ""} const appConfig = loadConfig();
4739
4745
  getSql();
4740
4746
  if (!(await pingDatabase())) throw new Error("Database is not ready.");
@@ -4780,11 +4786,12 @@ export async function createApp(options: BootstrapOptions = {}) {
4780
4786
  return bootstrapApp({ migrate: false, ...options });
4781
4787
  }
4782
4788
 
4783
- export function createAppServer(routes: AppRouteMap, port = 0, lifecycle?: LifecycleCoordinator) {
4789
+ export function createAppServer(routes: AppRouteMap, port = 0, lifecycle?: LifecycleCoordinator, native?: NativeServerOptions) {
4784
4790
  return createWebServer({
4785
4791
  port,
4786
4792
  publicDir: "./public",
4787
4793
  lifecycle,
4794
+ native,
4788
4795
  routes,
4789
4796
  });
4790
4797
  }
@@ -12,9 +12,9 @@
12
12
  "check": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@getstrata/bootstrap": "^2.2.37",
16
- "@getstrata/cli": "^2.2.37",
17
- "@getstrata/core": "^2.2.37",
15
+ "@getstrata/bootstrap": "^2.2.39",
16
+ "@getstrata/cli": "^2.2.39",
17
+ "@getstrata/core": "^2.2.39",
18
18
  "eta": "^4.6.0"
19
19
  },
20
20
  "devDependencies": {
@@ -1,5 +1,6 @@
1
1
  export interface AppConfig {
2
2
  port: number;
3
+ hostname?: string;
3
4
  appUrl: string;
4
5
  databaseUrl: string;
5
6
  }
@@ -12,6 +13,7 @@ export function loadConfig(): AppConfig {
12
13
 
13
14
  return {
14
15
  port: Number(process.env.PORT ?? 3000),
16
+ hostname: process.env.HOST?.trim() || undefined,
15
17
  appUrl: process.env.APP_URL ?? "http://localhost:3000",
16
18
  databaseUrl,
17
19
  };
@@ -10,7 +10,12 @@ const { routes, config, context } = await bootstrapApp();
10
10
  const lifecycle = new LifecycleCoordinator();
11
11
  let server: ReturnType<typeof createAppServer>;
12
12
  try {
13
- server = createAppServer(routes, config.port, lifecycle);
13
+ server = createAppServer(
14
+ routes,
15
+ config.port,
16
+ lifecycle,
17
+ config.hostname ? { hostname: config.hostname } : undefined,
18
+ );
14
19
  } catch (error) {
15
20
  try {
16
21
  await context.dispose();
@@ -19,7 +24,7 @@ try {
19
24
  }
20
25
  throw error;
21
26
  }
22
- console.log(`Listening on http://localhost:${server.port} (APP_URL ${config.appUrl})`);
27
+ console.log(`Listening on ${server.url.origin} (APP_URL ${config.appUrl})`);
23
28
 
24
29
  lifecycle.register("providers:drain", () => context.drain(), "drain");
25
30
  lifecycle.register("providers:flush", () => context.flush(), "flush");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-strata",
3
- "version": "2.2.37",
3
+ "version": "2.2.39",
4
4
  "description": "Create a new Strata app. Interactive wizard; choose each layer; one database engine.",
5
5
  "type": "module",
6
6
  "license": "MIT",