@getstrata/starter 1.0.2 → 1.0.4
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
|
@@ -2180,10 +2180,11 @@ function renderAuthProvider(layers) {
|
|
|
2180
2180
|
import type { AuthUser } from "@getstrata/core/auth/authContext";
|
|
2181
2181
|
import { currentAuthUser } from "@getstrata/core/auth/authContext";
|
|
2182
2182
|
import type { ServiceProvider } from "@getstrata/core/contracts/di";
|
|
2183
|
+
import { envFlagEnabled } from "@getstrata/core/runtime/appEnv";
|
|
2183
2184
|
|
|
2184
2185
|
class StarterAuthManager {
|
|
2185
2186
|
async resolve(request?: Request): Promise<AuthUser | null> {
|
|
2186
|
-
if (process.env.AUTH_DEV_HEADERS
|
|
2187
|
+
if (!envFlagEnabled(process.env.AUTH_DEV_HEADERS)) {
|
|
2187
2188
|
return request ? null : currentAuthUser();
|
|
2188
2189
|
}
|
|
2189
2190
|
if (request) {
|
|
@@ -2528,10 +2529,11 @@ function renderPackageJson(projectName, options = {}) {
|
|
|
2528
2529
|
"@getstrata/cli": "workspace:*",
|
|
2529
2530
|
"@getstrata/core": "workspace:*"
|
|
2530
2531
|
} : {
|
|
2531
|
-
"@getstrata/bootstrap": "^1.0.
|
|
2532
|
-
"@getstrata/cli": "^1.0.
|
|
2533
|
-
"@getstrata/core": "^1.0.
|
|
2532
|
+
"@getstrata/bootstrap": "^1.0.4",
|
|
2533
|
+
"@getstrata/cli": "^1.0.4",
|
|
2534
|
+
"@getstrata/core": "^1.0.4"
|
|
2534
2535
|
};
|
|
2536
|
+
coreDeps.eta = "^4.6.0";
|
|
2535
2537
|
if (options.layers?.database === "mysql") {
|
|
2536
2538
|
coreDeps.mysql2 = "^3.24.3";
|
|
2537
2539
|
}
|
|
@@ -2626,7 +2628,7 @@ function renderSupportingToolsReadme(layers) {
|
|
|
2626
2628
|
}
|
|
2627
2629
|
function renderApiDocs(projectName, layers) {
|
|
2628
2630
|
const rows = ["| Method | Path | Notes |", "| --- | --- | --- |"];
|
|
2629
|
-
rows.push("| `GET` | `/health` | Plain text `ok` (200), or `degraded` (503) until the database ping succeeds and the migrated `notes` table exists. Docker HEALTHCHECK uses this path. |");
|
|
2631
|
+
rows.push("| `GET` | `/health` | Plain text `ok` (200), or `degraded` (503) until the database ping succeeds and the migrated `notes` table exists. 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. |');
|
|
2630
2632
|
rows.push("| `GET` | `/` | Welcome page. Restyle or replace it. |");
|
|
2631
2633
|
if (authUsesToken(layers.auth)) {
|
|
2632
2634
|
rows.push("| `POST` | `/api/v1/auth/login` | `{ email, password }` returns `{ token }`. |", "| `POST` | `/api/v1/auth/register` | Creates a user and returns a token. |", "| `GET` | `/api/v1/auth/me` | Requires `Authorization: Bearer <token>`. |");
|
|
@@ -3532,6 +3534,7 @@ import { createHealthRoutes } from "@getstrata/bootstrap/health";
|
|
|
3532
3534
|
${metricsImport}import { assertProductionSecrets } from "@getstrata/bootstrap/secretsGuard";
|
|
3533
3535
|
import { createWebServer } from "@getstrata/bootstrap/web/server";
|
|
3534
3536
|
import { setActiveApplicationContext } from "@getstrata/core/runtime/applicationRegistry";
|
|
3537
|
+
import { isProductionEnv } from "@getstrata/core/runtime/appEnv";
|
|
3535
3538
|
import { migrate } from "../db/migrate.ts";
|
|
3536
3539
|
import { buildRoutes } from "../routes.ts";
|
|
3537
3540
|
import { loadConfig } from "./config.ts";
|
|
@@ -3590,7 +3593,7 @@ function createAppContext(): AppContext {
|
|
|
3590
3593
|
}
|
|
3591
3594
|
|
|
3592
3595
|
export async function bootstrapApp(options: BootstrapOptions = {}): Promise<BootstrappedApp> {
|
|
3593
|
-
const isProduction =
|
|
3596
|
+
const isProduction = isProductionEnv();
|
|
3594
3597
|
// Dev boots migrate for convenience. Production must not mutate schema on
|
|
3595
3598
|
// start, so run \`strata migrate\` as an explicit deploy step instead.
|
|
3596
3599
|
const { migrate: runMigrate = !isProduction } = options;
|
|
@@ -5,6 +5,7 @@ This scaffold sets `FRONTEND_MODE=api`: no server-rendered views beyond the welc
|
|
|
5
5
|
## What exists after migrating
|
|
6
6
|
|
|
7
7
|
- `GET /health` returns plain text `ok`, or `degraded` (503) until the database ping succeeds and the migrated `notes` table exists. Docker HEALTHCHECK uses `/health`.
|
|
8
|
+
- `GET /ready` returns JSON `{"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 `/health` is the deploy gate.
|
|
8
9
|
- `GET /` returns the welcome page.
|
|
9
10
|
- A `notes` table, with no routes on it yet.
|
|
10
11
|
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
"check": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@getstrata/bootstrap": "^1.0.
|
|
15
|
-
"@getstrata/cli": "^1.0.
|
|
16
|
-
"@getstrata/core": "^1.0.
|
|
14
|
+
"@getstrata/bootstrap": "^1.0.4",
|
|
15
|
+
"@getstrata/cli": "^1.0.4",
|
|
16
|
+
"@getstrata/core": "^1.0.4",
|
|
17
|
+
"eta": "^4.6.0"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"@types/bun": "^1.4.0",
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ServiceContainer,
|
|
11
11
|
} from "@getstrata/bootstrap/contracts";
|
|
12
12
|
import { createWebServer } from "@getstrata/bootstrap/web/server";
|
|
13
|
+
import { isProductionEnv } from "@getstrata/core/runtime/appEnv";
|
|
13
14
|
import { setActiveApplicationContext } from "@getstrata/core/runtime/applicationRegistry";
|
|
14
15
|
import { migrate } from "../db/migrate.ts";
|
|
15
16
|
import { buildRoutes } from "../routes.ts";
|
|
@@ -68,7 +69,7 @@ function createAppContext(): AppContext {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export async function bootstrapApp(options: BootstrapOptions = {}): Promise<BootstrappedApp> {
|
|
71
|
-
const isProduction =
|
|
72
|
+
const isProduction = isProductionEnv();
|
|
72
73
|
const { migrate: runMigrate = !isProduction } = options;
|
|
73
74
|
|
|
74
75
|
const appConfig = loadConfig();
|