@getstrata/starter 2.2.46 → 2.2.48

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
@@ -212,6 +212,35 @@ function dockerLayerForNeeded(layers, enabled) {
212
212
  return { enabled: true, services: enableDockerServices(needed) };
213
213
  }
214
214
 
215
+ // src/databaseDefaults.ts
216
+ var GENERATED_POSTGRES_APP_ROLE = "strata_app";
217
+ var GENERATED_POSTGRES_APP_PASSWORD = "dev-strata-app-change-me";
218
+ var GENERATED_POSTGRES_SUPERUSER_PASSWORD = "dev-postgres-change-me";
219
+ var GENERATED_MYSQL_ROOT_PASSWORD = "dev-mysql-change-me";
220
+ function appDatabaseName(projectName) {
221
+ return projectName.replace(/[^A-Za-z0-9_]/g, "_");
222
+ }
223
+ function usesComposePostgres(layers) {
224
+ return selectedDockerServices(layers).includes("postgres");
225
+ }
226
+ function defaultDatabaseUrl(layers, projectName) {
227
+ if (layers.database === "sqlite") {
228
+ return "sqlite:./storage/app.sqlite";
229
+ }
230
+ const database = appDatabaseName(projectName);
231
+ if (layers.database === "mysql") {
232
+ return `mysql://root:${GENERATED_MYSQL_ROOT_PASSWORD}@localhost:3306/${database}`;
233
+ }
234
+ return `postgresql://${GENERATED_POSTGRES_APP_ROLE}:${GENERATED_POSTGRES_APP_PASSWORD}@localhost:5432/${database}`;
235
+ }
236
+ function defaultMigrationDatabaseUrl(layers, projectName) {
237
+ if (layers.database !== "postgres") {
238
+ return null;
239
+ }
240
+ const database = appDatabaseName(projectName);
241
+ return `postgresql://postgres:${GENERATED_POSTGRES_SUPERUSER_PASSWORD}@localhost:5432/${database}`;
242
+ }
243
+
215
244
  // src/presets.ts
216
245
  var noneExtras = {
217
246
  mfa: false,
@@ -2609,6 +2638,8 @@ ${tokenLookup}
2609
2638
  function renderAuthProvider(layers) {
2610
2639
  if (layers.auth === "headers") {
2611
2640
  return `import { CORE_AUTH_TOKEN } from "@getstrata/bootstrap/config";
2641
+ import { createTokenAbilityChecker } from "@getstrata/core/auth/tokenAbilityChecker";
2642
+ import { CORE_ABILITY_CHECKER_TOKEN } from "@getstrata/core/contracts/serviceTokens";
2612
2643
  import { AuthManager, GuestGuard } from "@getstrata/core/auth/guard";
2613
2644
  import type { ServiceProvider } from "@getstrata/core/contracts/di";
2614
2645
  import { envFlagEnabled } from "@getstrata/core/runtime/appEnv";
@@ -2620,6 +2651,7 @@ const authProvider: ServiceProvider = {
2620
2651
  ? new GuestGuard()
2621
2652
  : { resolve: () => null };
2622
2653
  container.set(CORE_AUTH_TOKEN, new AuthManager(guard));
2654
+ container.set(CORE_ABILITY_CHECKER_TOKEN, createTokenAbilityChecker());
2623
2655
  },
2624
2656
  };
2625
2657
 
@@ -2644,7 +2676,7 @@ export default authProvider;
2644
2676
  auth.registerGuard("token", apiGuard);` : "";
2645
2677
  const jwtReg = authUsesJwt(layers.auth) ? ` auth.registerGuard("jwt", new JwtGuard(container));` : "";
2646
2678
  const basicReg = authUsesToken(layers.auth) || authUsesJwt(layers.auth) ? ` auth.registerGuard("basic", new BasicAuthGuard(container));` : "";
2647
- const ability = authUsesToken(layers.auth) ? ` container.set(CORE_ABILITY_CHECKER_TOKEN, createTokenAbilityChecker());` : "";
2679
+ const ability = ` container.set(CORE_ABILITY_CHECKER_TOKEN, createTokenAbilityChecker());`;
2648
2680
  const imports = [`import { CORE_AUTH_TOKEN } from "@getstrata/bootstrap/config";`];
2649
2681
  if (authUsesCookie(layers.auth)) {
2650
2682
  imports.push(`import { createCookieSessionAuthManager } from "@getstrata/bootstrap/web/session";`);
@@ -2662,14 +2694,9 @@ export default authProvider;
2662
2694
  if (authUsesJwt(layers.auth)) {
2663
2695
  imports.push(`import { JwtGuard } from "@getstrata/core/auth/jwtGuard";`);
2664
2696
  }
2665
- if (authUsesToken(layers.auth)) {
2666
- imports.push(`import { createTokenAbilityChecker } from "@getstrata/core/auth/tokenAbilityChecker";`);
2667
- }
2697
+ imports.push(`import { createTokenAbilityChecker } from "@getstrata/core/auth/tokenAbilityChecker";`);
2668
2698
  imports.push(`import type { ServiceProvider } from "@getstrata/core/contracts/di";`);
2669
- const tokenImports = ["CORE_AUTH_USER_DIRECTORY_TOKEN"];
2670
- if (authUsesToken(layers.auth)) {
2671
- tokenImports.unshift("CORE_ABILITY_CHECKER_TOKEN");
2672
- }
2699
+ const tokenImports = ["CORE_ABILITY_CHECKER_TOKEN", "CORE_AUTH_USER_DIRECTORY_TOKEN"];
2673
2700
  imports.push(`import {
2674
2701
  ${tokenImports.join(`,
2675
2702
  `)},
@@ -2698,6 +2725,149 @@ export default authProvider;
2698
2725
  `;
2699
2726
  }
2700
2727
 
2728
+ // src/renderDocker.ts
2729
+ function renderServiceHealthcheck(test) {
2730
+ return ` healthcheck:
2731
+ test: ${JSON.stringify(test)}
2732
+ interval: 2s
2733
+ timeout: 3s
2734
+ retries: 60
2735
+ start_period: 5s`;
2736
+ }
2737
+ function renderDockerCompose(projectName, layers) {
2738
+ const selected = selectedDockerServices(layers);
2739
+ if (selected.length === 0) {
2740
+ return null;
2741
+ }
2742
+ const selectedSet = new Set(selected);
2743
+ const services = [];
2744
+ if (selectedSet.has("postgres")) {
2745
+ const database = appDatabaseName(projectName);
2746
+ services.push(` postgres:
2747
+ image: postgres:16-alpine
2748
+ environment:
2749
+ POSTGRES_USER: postgres
2750
+ POSTGRES_PASSWORD: ${GENERATED_POSTGRES_SUPERUSER_PASSWORD}
2751
+ POSTGRES_DB: ${database}
2752
+ ${renderServiceHealthcheck(["CMD-SHELL", 'PGPASSWORD="$$POSTGRES_PASSWORD" psql -h 127.0.0.1 -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -tAc "SELECT 1" >/dev/null'])}
2753
+ ports:
2754
+ # Localhost only. Do not publish this port on a production host.
2755
+ - "127.0.0.1:5432:5432"
2756
+ volumes:
2757
+ - pgdata:/var/lib/postgresql/data
2758
+ - ./docker/postgres-init:/docker-entrypoint-initdb.d:ro`);
2759
+ }
2760
+ if (selectedSet.has("mysql")) {
2761
+ const database = appDatabaseName(projectName);
2762
+ services.push(` mysql:
2763
+ image: mysql:8.4
2764
+ environment:
2765
+ MYSQL_ROOT_PASSWORD: ${GENERATED_MYSQL_ROOT_PASSWORD}
2766
+ MYSQL_DATABASE: ${database}
2767
+ ${renderServiceHealthcheck(["CMD-SHELL", 'MYSQL_PWD="$$MYSQL_ROOT_PASSWORD" mysql --protocol=tcp -h 127.0.0.1 -u root -D "$$MYSQL_DATABASE" -N -e "SELECT 1" >/dev/null'])}
2768
+ ports:
2769
+ - "127.0.0.1:3306:3306"
2770
+ volumes:
2771
+ - mysqldata:/var/lib/mysql`);
2772
+ }
2773
+ if (selectedSet.has("adminer")) {
2774
+ const server = selectedSet.has("mysql") ? "mysql" : "postgres";
2775
+ services.push(` adminer:
2776
+ image: adminer:5.4.2
2777
+ profiles:
2778
+ - debug
2779
+ environment:
2780
+ ADMINER_DEFAULT_SERVER: ${server}
2781
+ depends_on:
2782
+ ${server}:
2783
+ condition: service_healthy
2784
+ ${renderServiceHealthcheck(["CMD", "php", "-r", "exit(@file_get_contents('http://127.0.0.1:8080/') === false ? 1 : 0);"])}
2785
+ ports:
2786
+ - "127.0.0.1:8080:8080"`);
2787
+ }
2788
+ if (selectedSet.has("redis")) {
2789
+ services.push(` redis:
2790
+ image: redis:7-alpine
2791
+ environment:
2792
+ REDIS_PASSWORD: "\${REDIS_PASSWORD:-dev-redis-change-me}"
2793
+ ${renderServiceHealthcheck(["CMD-SHELL", 'REDISCLI_AUTH="$$REDIS_PASSWORD" redis-cli --no-auth-warning ping | grep -qx PONG'])}
2794
+ command: ["redis-server", "--requirepass", "\${REDIS_PASSWORD:-dev-redis-change-me}"]
2795
+ ports:
2796
+ - "127.0.0.1:6379:6379"`);
2797
+ }
2798
+ if (selectedSet.has("mailpit")) {
2799
+ services.push(` mailpit:
2800
+ image: axllent/mailpit:latest
2801
+ ${renderServiceHealthcheck(["CMD", "/mailpit", "readyz"])}
2802
+ ports:
2803
+ - "127.0.0.1:1025:1025"
2804
+ - "127.0.0.1:8025:8025"`);
2805
+ }
2806
+ const volumes = [];
2807
+ if (selectedSet.has("postgres")) {
2808
+ volumes.push(" pgdata:");
2809
+ }
2810
+ if (selectedSet.has("mysql")) {
2811
+ volumes.push(" mysqldata:");
2812
+ }
2813
+ return `services:
2814
+ ${services.join(`
2815
+
2816
+ `)}
2817
+ ${volumes.length > 0 ? `
2818
+ volumes:
2819
+ ${volumes.join(`
2820
+ `)}
2821
+ ` : ""}`;
2822
+ }
2823
+ function renderDockerfile(layers) {
2824
+ const frontend = needsFrontendBuild(layers.frontend);
2825
+ const lines = [
2826
+ '# Production image. Build once, run with env from your platform; see README "Deploy".',
2827
+ "FROM oven/bun:1.4.3 AS deps",
2828
+ "WORKDIR /app",
2829
+ "COPY package.json bun.lock ./",
2830
+ "RUN bun install --frozen-lockfile --production",
2831
+ ""
2832
+ ];
2833
+ if (frontend) {
2834
+ lines.push("FROM oven/bun:1.4.3 AS frontend", "WORKDIR /app/frontend", "COPY --from=deps /app/node_modules /app/node_modules", "ARG SPA_PREFIX", "ENV SPA_PREFIX=$SPA_PREFIX", "COPY frontend/package.json frontend/bun.lock ./", "RUN bun install --frozen-lockfile", "COPY frontend/ ./", "RUN bun run build", "");
2835
+ }
2836
+ lines.push("FROM oven/bun:1.4.3-slim AS runtime", "WORKDIR /app", "ENV APP_ENV=production", "ENV AUTH_DEV_HEADERS=false", "ENV PORT=3000", "COPY --from=deps /app/node_modules ./node_modules", "COPY . .");
2837
+ if (frontend) {
2838
+ lines.push("COPY --from=frontend /app/frontend/dist ./frontend/dist");
2839
+ }
2840
+ lines.push("RUN mkdir -p storage && chown -R bun:bun /app", "USER bun", "EXPOSE 3000");
2841
+ if (layers.database === "sqlite") {
2842
+ lines.push("# SQLite lives in storage/; mount a volume there or the data dies with the container.", 'VOLUME ["/app/storage"]');
2843
+ }
2844
+ lines.push("# Readiness: anonymous dependency/schema probe; use a separate process check for liveness.", `HEALTHCHECK --interval=30s --timeout=3s --start-period=10s CMD ["bun", "-e", "fetch('http://127.0.0.1:' + process.env.PORT + '/health').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"]`, 'CMD ["bun", "./node_modules/.bin/strata", "start"]');
2845
+ return `${lines.join(`
2846
+ `)}
2847
+ `;
2848
+ }
2849
+ function renderDockerignore(layers) {
2850
+ const lines = [
2851
+ ".git",
2852
+ "node_modules",
2853
+ ".env",
2854
+ ".env.*",
2855
+ "!.env.example",
2856
+ "storage/*.sqlite",
2857
+ "storage/*.sqlite-journal",
2858
+ "storage/*.sqlite-wal",
2859
+ "storage/*.sqlite-shm",
2860
+ "coverage",
2861
+ "docker-compose.yml"
2862
+ ];
2863
+ if (needsFrontendBuild(layers.frontend)) {
2864
+ lines.push("frontend/node_modules", "frontend/dist");
2865
+ }
2866
+ return `${lines.join(`
2867
+ `)}
2868
+ `;
2869
+ }
2870
+
2701
2871
  // ../../src/core/runtime/appEnv.ts
2702
2872
  var NON_PRODUCTION_APP_ENVS = new Set(["local", "development", "dev", "test", "testing", "ci"]);
2703
2873
 
@@ -2854,36 +3024,57 @@ function generatedRlsBootstrapSql(tables, userOwnedTables = []) {
2854
3024
  `);
2855
3025
  }
2856
3026
 
2857
- // src/renderEnv.ts
2858
- function envFlag(value) {
2859
- return value ? "true" : "false";
2860
- }
2861
- var GENERATED_POSTGRES_APP_ROLE = "strata_app";
2862
- var GENERATED_POSTGRES_APP_PASSWORD = "dev-strata-app-change-me";
2863
- var GENERATED_POSTGRES_SUPERUSER_PASSWORD = "dev-postgres-change-me";
2864
- var GENERATED_MYSQL_ROOT_PASSWORD = "dev-mysql-change-me";
2865
- function appDatabaseName(projectName) {
2866
- return projectName.replace(/[^A-Za-z0-9_]/g, "_");
2867
- }
2868
- function usesComposePostgres(layers) {
2869
- return selectedDockerServices(layers).includes("postgres");
3027
+ // src/renderSupportingTools.ts
3028
+ function localEnvVars(services) {
3029
+ const vars = [];
3030
+ for (const name of services) {
3031
+ if (name === "postgres" || name === "mysql") {
3032
+ vars.push("DATABASE_URL");
3033
+ } else if (name === "redis") {
3034
+ vars.push("REDIS_URL");
3035
+ } else if (name === "mailpit") {
3036
+ vars.push("MAIL_HOST");
3037
+ }
3038
+ }
3039
+ return [...new Set(vars)];
2870
3040
  }
2871
- function defaultDatabaseUrl(layers, projectName) {
2872
- if (layers.database === "sqlite") {
2873
- return "sqlite:./storage/app.sqlite";
3041
+ function renderSupportingToolsReadme(projectName, layers) {
3042
+ const needed = neededDockerServices(layers);
3043
+ if (needed.length === 0) {
3044
+ return "";
2874
3045
  }
2875
- const database = appDatabaseName(projectName);
2876
- if (layers.database === "mysql") {
2877
- return `mysql://root:${GENERATED_MYSQL_ROOT_PASSWORD}@localhost:3306/${database}`;
3046
+ const dockerOn = selectedDockerServices(layers);
3047
+ const dockerSet = new Set(dockerOn);
3048
+ const localOn = needed.filter((name) => !dockerSet.has(name));
3049
+ const lines = ["## Supporting tools", ""];
3050
+ if (dockerOn.length > 0) {
3051
+ const names = dockerOn.map((name) => DOCKER_SERVICE_LABELS[name]).join(", ");
3052
+ lines.push(`Docker Compose includes ${names}.`, "", "```bash", dockerComposeUpCommand(layers), "```", "", "Wait for this command to succeed before migrating. It waits up to 180 seconds for selected services to be healthy; inspect `docker compose ps` and `docker compose logs` if it fails. Increasing `--wait-timeout` can accommodate a slow first initialization. These checks do not run application migrations.", "");
3053
+ if (dockerSet.has("adminer")) {
3054
+ const mysql = layers.database === "mysql";
3055
+ const system = mysql ? "MySQL" : "PostgreSQL";
3056
+ const server = mysql ? "mysql" : "postgres";
3057
+ const username = mysql ? "root" : "postgres";
3058
+ const password = mysql ? GENERATED_MYSQL_ROOT_PASSWORD : GENERATED_POSTGRES_SUPERUSER_PASSWORD;
3059
+ lines.push(`Adminer: http://localhost:8080 (${system}, server \`${server}\`, username \`${username}\`, password \`${password}\`, database \`${appDatabaseName(projectName)}\`).`, "", "Adminer is optional development tooling in the `debug` profile; plain `docker compose up -d` does not start Adminer. Use the profile command above to start it with the database.", "");
3060
+ if (!mysql) {
3061
+ lines.push("Adminer uses the Compose `postgres` superuser, which skips FORCE RLS. Application traffic should use `strata_app`.", "");
3062
+ }
3063
+ }
2878
3064
  }
2879
- return `postgresql://${GENERATED_POSTGRES_APP_ROLE}:${GENERATED_POSTGRES_APP_PASSWORD}@localhost:5432/${database}`;
2880
- }
2881
- function defaultMigrationDatabaseUrl(layers, projectName) {
2882
- if (layers.database !== "postgres") {
2883
- return null;
3065
+ if (localOn.length > 0) {
3066
+ const names = localOn.map((name) => DOCKER_SERVICE_LABELS[name]).join(", ");
3067
+ const envVars = localEnvVars(localOn).map((name) => `\`${name}\``).join(", ");
3068
+ lines.push(`Use local installs for ${names}. Point ${envVars} in \`.env\` at services on this machine.`, "");
2884
3069
  }
2885
- const database = appDatabaseName(projectName);
2886
- return `postgresql://postgres:${GENERATED_POSTGRES_SUPERUSER_PASSWORD}@localhost:5432/${database}`;
3070
+ return `${lines.join(`
3071
+ `)}
3072
+ `;
3073
+ }
3074
+
3075
+ // src/renderEnv.ts
3076
+ function envFlag(value) {
3077
+ return value ? "true" : "false";
2887
3078
  }
2888
3079
  function postgresAppRoleEnvNotes(layers) {
2889
3080
  if (layers.database !== "postgres") {
@@ -3077,100 +3268,6 @@ function renderEnvExample(projectName, layers) {
3077
3268
  `)}
3078
3269
  `;
3079
3270
  }
3080
- function renderServiceHealthcheck(test) {
3081
- return ` healthcheck:
3082
- test: ${JSON.stringify(test)}
3083
- interval: 2s
3084
- timeout: 3s
3085
- retries: 60
3086
- start_period: 5s`;
3087
- }
3088
- function renderDockerCompose(projectName, layers) {
3089
- const selected = selectedDockerServices(layers);
3090
- if (selected.length === 0) {
3091
- return null;
3092
- }
3093
- const selectedSet = new Set(selected);
3094
- const services = [];
3095
- if (selectedSet.has("postgres")) {
3096
- const database = appDatabaseName(projectName);
3097
- services.push(` postgres:
3098
- image: postgres:16-alpine
3099
- environment:
3100
- POSTGRES_USER: postgres
3101
- POSTGRES_PASSWORD: ${GENERATED_POSTGRES_SUPERUSER_PASSWORD}
3102
- POSTGRES_DB: ${database}
3103
- ${renderServiceHealthcheck(["CMD-SHELL", 'PGPASSWORD="$$POSTGRES_PASSWORD" psql -h 127.0.0.1 -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -tAc "SELECT 1" >/dev/null'])}
3104
- ports:
3105
- # Localhost only. Do not publish this port on a production host.
3106
- - "127.0.0.1:5432:5432"
3107
- volumes:
3108
- - pgdata:/var/lib/postgresql/data
3109
- - ./docker/postgres-init:/docker-entrypoint-initdb.d:ro`);
3110
- }
3111
- if (selectedSet.has("mysql")) {
3112
- const database = appDatabaseName(projectName);
3113
- services.push(` mysql:
3114
- image: mysql:8.4
3115
- environment:
3116
- MYSQL_ROOT_PASSWORD: ${GENERATED_MYSQL_ROOT_PASSWORD}
3117
- MYSQL_DATABASE: ${database}
3118
- ${renderServiceHealthcheck(["CMD-SHELL", 'MYSQL_PWD="$$MYSQL_ROOT_PASSWORD" mysql --protocol=tcp -h 127.0.0.1 -u root -D "$$MYSQL_DATABASE" -N -e "SELECT 1" >/dev/null'])}
3119
- ports:
3120
- - "127.0.0.1:3306:3306"
3121
- volumes:
3122
- - mysqldata:/var/lib/mysql`);
3123
- }
3124
- if (selectedSet.has("adminer")) {
3125
- const server = selectedSet.has("mysql") ? "mysql" : "postgres";
3126
- services.push(` adminer:
3127
- image: adminer:5.4.2
3128
- profiles:
3129
- - debug
3130
- environment:
3131
- ADMINER_DEFAULT_SERVER: ${server}
3132
- depends_on:
3133
- ${server}:
3134
- condition: service_healthy
3135
- ${renderServiceHealthcheck(["CMD", "php", "-r", "exit(@file_get_contents('http://127.0.0.1:8080/') === false ? 1 : 0);"])}
3136
- ports:
3137
- - "127.0.0.1:8080:8080"`);
3138
- }
3139
- if (selectedSet.has("redis")) {
3140
- services.push(` redis:
3141
- image: redis:7-alpine
3142
- environment:
3143
- REDIS_PASSWORD: "\${REDIS_PASSWORD:-dev-redis-change-me}"
3144
- ${renderServiceHealthcheck(["CMD-SHELL", 'REDISCLI_AUTH="$$REDIS_PASSWORD" redis-cli --no-auth-warning ping | grep -qx PONG'])}
3145
- command: ["redis-server", "--requirepass", "\${REDIS_PASSWORD:-dev-redis-change-me}"]
3146
- ports:
3147
- - "127.0.0.1:6379:6379"`);
3148
- }
3149
- if (selectedSet.has("mailpit")) {
3150
- services.push(` mailpit:
3151
- image: axllent/mailpit:latest
3152
- ${renderServiceHealthcheck(["CMD", "/mailpit", "readyz"])}
3153
- ports:
3154
- - "127.0.0.1:1025:1025"
3155
- - "127.0.0.1:8025:8025"`);
3156
- }
3157
- const volumes = [];
3158
- if (selectedSet.has("postgres")) {
3159
- volumes.push(" pgdata:");
3160
- }
3161
- if (selectedSet.has("mysql")) {
3162
- volumes.push(" mysqldata:");
3163
- }
3164
- return `services:
3165
- ${services.join(`
3166
-
3167
- `)}
3168
- ${volumes.length > 0 ? `
3169
- volumes:
3170
- ${volumes.join(`
3171
- `)}
3172
- ` : ""}`;
3173
- }
3174
3271
  function renderGitignore() {
3175
3272
  return `node_modules
3176
3273
  .env
@@ -3185,62 +3282,15 @@ coverage
3185
3282
  *.tsbuildinfo
3186
3283
  `;
3187
3284
  }
3188
- function renderDockerfile(layers) {
3189
- const frontend = needsFrontendBuild(layers.frontend);
3190
- const lines = [
3191
- '# Production image. Build once, run with env from your platform; see README "Deploy".',
3192
- "FROM oven/bun:1.4.3 AS deps",
3193
- "WORKDIR /app",
3194
- "COPY package.json bun.lock ./",
3195
- "RUN bun install --frozen-lockfile --production",
3196
- ""
3197
- ];
3198
- if (frontend) {
3199
- lines.push("FROM oven/bun:1.4.3 AS frontend", "WORKDIR /app/frontend", "COPY --from=deps /app/node_modules /app/node_modules", "ARG SPA_PREFIX", "ENV SPA_PREFIX=$SPA_PREFIX", "COPY frontend/package.json frontend/bun.lock ./", "RUN bun install --frozen-lockfile", "COPY frontend/ ./", "RUN bun run build", "");
3200
- }
3201
- lines.push("FROM oven/bun:1.4.3-slim AS runtime", "WORKDIR /app", "ENV APP_ENV=production", "ENV AUTH_DEV_HEADERS=false", "ENV PORT=3000", "COPY --from=deps /app/node_modules ./node_modules", "COPY . .");
3202
- if (frontend) {
3203
- lines.push("COPY --from=frontend /app/frontend/dist ./frontend/dist");
3204
- }
3205
- lines.push("RUN mkdir -p storage && chown -R bun:bun /app", "USER bun", "EXPOSE 3000");
3206
- if (layers.database === "sqlite") {
3207
- lines.push("# SQLite lives in storage/; mount a volume there or the data dies with the container.", 'VOLUME ["/app/storage"]');
3208
- }
3209
- lines.push("# Readiness: anonymous dependency/schema probe; use a separate process check for liveness.", `HEALTHCHECK --interval=30s --timeout=3s --start-period=10s CMD ["bun", "-e", "fetch('http://127.0.0.1:' + process.env.PORT + '/health').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"]`, 'CMD ["bun", "./node_modules/.bin/strata", "start"]');
3210
- return `${lines.join(`
3211
- `)}
3212
- `;
3213
- }
3214
- function renderDockerignore(layers) {
3215
- const lines = [
3216
- ".git",
3217
- "node_modules",
3218
- ".env",
3219
- ".env.*",
3220
- "!.env.example",
3221
- "storage/*.sqlite",
3222
- "storage/*.sqlite-journal",
3223
- "storage/*.sqlite-wal",
3224
- "storage/*.sqlite-shm",
3225
- "coverage",
3226
- "docker-compose.yml"
3227
- ];
3228
- if (needsFrontendBuild(layers.frontend)) {
3229
- lines.push("frontend/node_modules", "frontend/dist");
3230
- }
3231
- return `${lines.join(`
3232
- `)}
3233
- `;
3234
- }
3235
3285
  function renderPackageJson(projectName, options = {}) {
3236
3286
  const coreDeps = options.workspaceDependencies ? {
3237
3287
  "@getstrata/bootstrap": "workspace:*",
3238
3288
  "@getstrata/cli": "workspace:*",
3239
3289
  "@getstrata/core": "workspace:*"
3240
3290
  } : {
3241
- "@getstrata/bootstrap": "^2.2.46",
3242
- "@getstrata/cli": "^2.2.46",
3243
- "@getstrata/core": "^2.2.46"
3291
+ "@getstrata/bootstrap": "^2.2.48",
3292
+ "@getstrata/cli": "^2.2.48",
3293
+ "@getstrata/core": "^2.2.48"
3244
3294
  };
3245
3295
  coreDeps.eta = "^4.6.0";
3246
3296
  if (options.layers?.database === "mysql") {
@@ -3297,52 +3347,6 @@ function renderLayersManifest(projectName, layers) {
3297
3347
  }, null, 2)}
3298
3348
  `;
3299
3349
  }
3300
- function localEnvVars(services) {
3301
- const vars = [];
3302
- for (const name of services) {
3303
- if (name === "postgres" || name === "mysql") {
3304
- vars.push("DATABASE_URL");
3305
- } else if (name === "redis") {
3306
- vars.push("REDIS_URL");
3307
- } else if (name === "mailpit") {
3308
- vars.push("MAIL_HOST");
3309
- }
3310
- }
3311
- return [...new Set(vars)];
3312
- }
3313
- function renderSupportingToolsReadme(projectName, layers) {
3314
- const needed = neededDockerServices(layers);
3315
- if (needed.length === 0) {
3316
- return "";
3317
- }
3318
- const dockerOn = selectedDockerServices(layers);
3319
- const dockerSet = new Set(dockerOn);
3320
- const localOn = needed.filter((name) => !dockerSet.has(name));
3321
- const lines = ["## Supporting tools", ""];
3322
- if (dockerOn.length > 0) {
3323
- const names = dockerOn.map((name) => DOCKER_SERVICE_LABELS[name]).join(", ");
3324
- lines.push(`Docker Compose includes ${names}.`, "", "```bash", dockerComposeUpCommand(layers), "```", "", "Wait for this command to succeed before migrating. It waits up to 180 seconds for selected services to be healthy; inspect `docker compose ps` and `docker compose logs` if it fails. Increasing `--wait-timeout` can accommodate a slow first initialization. These checks do not run application migrations.", "");
3325
- if (dockerSet.has("adminer")) {
3326
- const mysql = layers.database === "mysql";
3327
- const system = mysql ? "MySQL" : "PostgreSQL";
3328
- const server = mysql ? "mysql" : "postgres";
3329
- const username = mysql ? "root" : "postgres";
3330
- const password = mysql ? GENERATED_MYSQL_ROOT_PASSWORD : GENERATED_POSTGRES_SUPERUSER_PASSWORD;
3331
- lines.push(`Adminer: http://localhost:8080 (${system}, server \`${server}\`, username \`${username}\`, password \`${password}\`, database \`${appDatabaseName(projectName)}\`).`, "", "Adminer is optional development tooling in the `debug` profile; plain `docker compose up -d` does not start Adminer. Use the profile command above to start it with the database.", "");
3332
- if (!mysql) {
3333
- lines.push("Adminer uses the Compose `postgres` superuser, which skips FORCE RLS. Application traffic should use `strata_app`.", "");
3334
- }
3335
- }
3336
- }
3337
- if (localOn.length > 0) {
3338
- const names = localOn.map((name) => DOCKER_SERVICE_LABELS[name]).join(", ");
3339
- const envVars = localEnvVars(localOn).map((name) => `\`${name}\``).join(", ");
3340
- lines.push(`Use local installs for ${names}. Point ${envVars} in \`.env\` at services on this machine.`, "");
3341
- }
3342
- return `${lines.join(`
3343
- `)}
3344
- `;
3345
- }
3346
3350
  function renderApiDocs(projectName, layers) {
3347
3351
  const rows = ["| Method | Path | Notes |", "| --- | --- | --- |"];
3348
3352
  rows.push("| `GET` | `/health` | Plain text `ok` (200) when configured database/Redis checks succeed and `notes` is readable (zero rows is still 200). This infrastructure probe runs outside API auth/tenancy admission, never selects a tenant or bypasses RLS, and returns no rows. `degraded` (503) when a dependency or schema check fails. Docker HEALTHCHECK uses this path. |", '| `GET` | `/ready` | JSON from the framework: `{"status":"ready","checks":{"database":"ok","redis":"skipped"}}` (200) or `not_ready` (503). `redis` is `ok` or `error` when `REDIS_URL` is set and `skipped` otherwise. It does not check the schema, so use `/health` as the deploy gate. |');
@@ -12,9 +12,9 @@
12
12
  "check": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@getstrata/bootstrap": "^2.2.46",
16
- "@getstrata/cli": "^2.2.46",
17
- "@getstrata/core": "^2.2.46",
15
+ "@getstrata/bootstrap": "^2.2.48",
16
+ "@getstrata/cli": "^2.2.48",
17
+ "@getstrata/core": "^2.2.48",
18
18
  "eta": "^4.6.0"
19
19
  },
20
20
  "devDependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/starter",
3
- "version": "2.2.46",
3
+ "version": "2.2.48",
4
4
  "description": "Interactive create-strata wizard. Choose each layer; one database engine.",
5
5
  "type": "module",
6
6
  "license": "MIT",