@shivaedev/platform 0.24.2 → 0.25.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.25.0 - 2026-10-25
4
+
5
+ ### Added
6
+
7
+ - Migration options accept schema components beside the numbered loader. Components apply after the ledger commits and report pending work through the same readiness check and host wait loop.
8
+ - `pgBossSchema` registers pg-boss installation and upgrades as a schema component, reporting the schema's installed and required versions.
9
+ - Quality provides a React application TypeScript preset, shared Vite and Vitest configuration helpers, application hook setup, and the shared application CI command.
10
+ - Platform provides configured local database preparation and a development runner for the server, worker and Vite processes.
11
+
12
+ ### Changed
13
+
14
+ - Generated apps migrate pg-boss through their migration list and start producers and workers with schema migration disabled.
15
+ - Generated apps reference their packages’ foundation configuration and helpers so dependency updates carry shared fixes into existing apps.
16
+
17
+ ### Fixed
18
+
19
+ - Better Auth mount failures log their redacted cause at error level in the request trace before returning the existing 503 response.
20
+ - Migration-step controllers capture schema-component services when constructed, keeping subsequent migration calls free of external service requirements.
21
+
3
22
  ## 0.24.2 - 2026-10-24
4
23
 
5
24
  ### Changed
package/README.md CHANGED
@@ -35,6 +35,12 @@ An **Origin policy** is a function of the transport request's origin, headers an
35
35
 
36
36
  The optional modules solve different boundaries. `server/runtime/` carries Effect services into Promise callers, `server/node-http/` combines subscription cancellation sources, `server/better-auth/adapter.ts` connects Better Auth storage to Effect Prisma, and `server/testing/makePlatformIt.ts` composes the Prisma and tRPC test harnesses. Choose the modules that match the application rather than adopting every integration.
37
37
 
38
+ ### Prepare local development
39
+
40
+ `setupDatabases()` from `@shivaedev/platform/server/setupDatabases.ts` reads `DATABASE_URL` and `TEST_DATABASE_URL` through Effect Config and prepares both local databases with `@shivaedev/local-postgres`. Database names come from those URLs. `DOCKER_HOST` and `DOCKER_CONTEXT` are optional. Missing database URLs fail with a typed Config error; migrations remain the application's responsibility.
41
+
42
+ `development({ server, worker, conditions? })` from `@shivaedev/platform/server/development.ts` starts the two application entry points with Node's watch mode and runs `pnpm exec vite`. Supply paths relative to the application directory and any export conditions its code needs. Provide `NodeServices.layer` to run it. When a process exits, the other processes stop and the Effect returns the first exit code, which the entry point can assign to `process.exitCode`. Use `runDevelopment(options)` from the same module for the Node entry point with that runtime wiring included.
43
+
38
44
  ### Host the application
39
45
 
40
46
  `appHost` is the server entry point for an Effect app. For a PostgreSQL app, supply the native RPC group, handler and service Layers, migration loader, session policy and static asset directory. The host completes migrations before acquiring application services, starts Node HTTP with NDJSON RPC at `/rpc`, and provides SQL, Reactivity and `AppChanges` to those Layers.
@@ -90,7 +96,9 @@ Omit `migrations` to host an app without a database. This form creates no SQL po
90
96
 
91
97
  `appHost` serves unauthenticated `GET /health`. It queries its SQL client on each request and returns `200` only when the query succeeds within two seconds; a missing SQL client, query failure or timeout returns `503`. Both responses have an empty body and `Cache-Control: no-store`. This route also works when the SQL client comes from the application’s `services` Layer. Use it for database readiness checks.
92
98
 
93
- Set `migrations.mode: "check"` on `appDatabase` or a database-backed `appHost` when a separate pre-deploy command owns migrations. Startup reads the ledger and fails with native `MigrationError` (`kind: "BadState"`) if any required migration ID or name is missing; it does not run migrations or create a ledger. Later ledger entries are allowed for rolling deployments. Use `migrations.mode: "wait"` for services that can start before that pre-deploy command finishes. It re-reads the ledger every second until current, then starts the application. Set `migrations.pollInterval` and `migrations.waitTimeout` with Effect duration inputs to change the interval and five-minute timeout. Timeout fails with the same `MigrationError` as `"check"`; interruption stops polling and closes the pool. SQL failures fail immediately. With `mode` omitted or `"migrate"`, startup applies pending migrations with a five-second lock timeout unless `migrations.lockTimeout` overrides it.
99
+ Set `migrations.mode: "check"` on `appDatabase` or a database-backed `appHost` when a separate pre-deploy command owns migrations. Startup reads the ledger and fails with native `MigrationError` (`kind: "BadState"`) if any required migration ID or name is missing or a schema component is pending; it does not run migrations or create a ledger. Later ledger entries are allowed for rolling deployments. Use `migrations.mode: "wait"` for services that can start before that pre-deploy command finishes. It re-reads the ledger and every registered component every second until all are current, then starts the application. Set `migrations.pollInterval` and `migrations.waitTimeout` with Effect duration inputs to change the interval and five-minute timeout. Timeout fails with the same `MigrationError` as `"check"`; interruption stops polling and closes the pool. SQL failures fail immediately. With `mode` omitted or `"migrate"`, startup applies pending ledger migrations with a five-second lock timeout unless `migrations.lockTimeout` overrides it, then applies schema components outside the ledger transaction.
100
+
101
+ Pass `migrations.components` beside `loader` for storage managed by another engine. For pg-boss, register `pgBossSchema({ schema: "app_jobs" })` from `@shivaedev/effect-pg-boss/server/schema.ts`, then start every jobs Layer with `migrate: false`. `check` and `wait` use the same `MigrationError` readout for pending ledger IDs and component names and details, including pg-boss’s installed and required versions.
94
102
 
95
103
  Supply `preflight: AppConfigLive` to `appHost` to build a native Layer before checking or applying migrations, or constructing the application. Use it to validate configuration such as app IDs, keys and invite lists. Its errors stay in the returned Layer's typed error channel, its requirements remain external requirements, and its services are available to migrations, application construction, services and RPC handlers as well as callers of the host Layer. Preflight resources close with the host scope. The option also works without migrations.
96
104
 
@@ -1,6 +1,8 @@
1
1
  import type { Duration } from "effect";
2
2
  import type { Migrator } from "effect/sql";
3
+ import type { SchemaComponent } from "@shivaedev/effect-sql/SchemaComponent.ts";
3
4
  export interface MigrationOptions<R = never> {
5
+ readonly components?: readonly SchemaComponent<R>[];
4
6
  readonly loader: Migrator.Loader<R>;
5
7
  readonly lockTimeout?: Duration.Input;
6
8
  readonly mode?: "migrate" | "check" | "wait";
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationOptions.d.ts","sourceRoot":"","sources":["../../src/server/MigrationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;CACtC"}
1
+ {"version":3,"file":"MigrationOptions.d.ts","sourceRoot":"","sources":["../../src/server/MigrationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEhF,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,KAAK;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/server/better-auth/mount.ts"],"names":[],"mappings":"AA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ts";
7
7
  import { signInPolicyOptions } from "#server/better-auth/signInPolicy.ts";
8
8
  import { trustedProxyPeer, trustedProxyRanges } from "#server/rpc-server/local.ts";
9
+ import { redact } from "#server/rpc-server/redact.ts";
9
10
  export const betterAuthMount = Effect.fn("Platform.betterAuthMount")(function* (options, mount = {}) {
10
11
  const secret = options.secret ?? Redacted.value(yield* Config.Redacted("BETTER_AUTH_SECRET"));
11
12
  const publicUrl = yield* Config.URL("PUBLIC_URL").pipe(Config.option);
@@ -47,7 +48,7 @@ export const betterAuthMount = Effect.fn("Platform.betterAuthMount")(function* (
47
48
  web.headers.delete("x-forwarded-for");
48
49
  web.headers.delete(clientIpHeader);
49
50
  }
50
- return HttpServerResponse.fromWeb(yield* Effect.tryPromise(() => auth.handler(web)));
51
+ return HttpServerResponse.fromWeb(yield* Effect.tryPromise(() => auth.handler(web)).pipe(Effect.tapError((error) => Effect.logError("Authentication provider failed", redact(error.cause)))));
51
52
  }).pipe(Effect.catch(() => Effect.succeed(HttpServerResponse.text("Authentication is temporarily unavailable", { status: 503 }))))));
52
53
  function admittedSessions(getSession) {
53
54
  if (!gate.active) {
@@ -1 +1 @@
1
- {"version":3,"file":"mount.js","sourceRoot":"","sources":["../../../src/server/better-auth/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,IAAI,EAAmB,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAyB,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAClG,OAAO,EAAyC,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,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I,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,kCAAkC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,EACF,CAAC,IAAI,EAAE,EAAE,CACR,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;QACzB,gEAAgE;QAChE,MAAM,YAAY,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/G,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;QACjB,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC,CAAC,CACH,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Effect } from "effect";
2
+ import { ChildProcessSpawner } from "effect/process";
3
+ export interface DevelopmentOptions {
4
+ readonly conditions?: readonly string[];
5
+ readonly server: string;
6
+ readonly worker: string;
7
+ }
8
+ export declare const development: (args_0: DevelopmentOptions) => Effect.Effect<ChildProcessSpawner.ExitCode, import("effect/PlatformError").PlatformError, ChildProcessSpawner.ChildProcessSpawner>;
9
+ export declare function runDevelopment(options: DevelopmentOptions): void;
10
+ //# sourceMappingURL=development.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development.d.ts","sourceRoot":"","sources":["../../src/server/development.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,oKAStB,CAAC;AAEH,wBAAgB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAWhE"}
@@ -0,0 +1,20 @@
1
+ import process from "node:process";
2
+ import { NodeRuntime, NodeServices } from "@effect/platform-node";
3
+ import { Effect } from "effect";
4
+ import { ChildProcess, ChildProcessSpawner } from "effect/process";
5
+ export const development = Effect.fn("Platform.development")(function* ({ server, worker, conditions = [] }) {
6
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7
+ const options = { stderr: "inherit", stdout: "inherit" };
8
+ const args = [...conditions.map((condition) => `--conditions=${condition}`), "--watch"];
9
+ return yield* Effect.raceAll([
10
+ spawner.exitCode(ChildProcess.make(process.execPath, [...args, server], options)),
11
+ spawner.exitCode(ChildProcess.make(process.execPath, [...args, worker], options)),
12
+ spawner.exitCode(ChildProcess.make("pnpm", ["exec", "vite"], options)),
13
+ ]);
14
+ });
15
+ export function runDevelopment(options) {
16
+ NodeRuntime.runMain(development(options).pipe(Effect.tap((code) => Effect.sync(() => {
17
+ process.exitCode = code;
18
+ })), Effect.provide(NodeServices.layer)));
19
+ }
20
+ //# source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C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,OAA2B;IACzD,WAAW,CAAC,OAAO,CAClB,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CACxB,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QAChB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC,CAAC,CACF,EACD,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAClC,CACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Config, Effect } from "effect";
2
+ export declare const setupDatabases: () => Effect.Effect<void, Config.ConfigError, never>;
3
+ //# sourceMappingURL=setupDatabases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupDatabases.d.ts","sourceRoot":"","sources":["../../src/server/setupDatabases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,eAAO,MAAM,cAAc,sDAQzB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Config, Effect } from "effect";
2
+ import { localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
3
+ export const setupDatabases = Effect.fn("Platform.setupDatabases")(function* () {
4
+ const config = yield* Config.all({
5
+ "DATABASE_URL": Config.String("DATABASE_URL"),
6
+ "DOCKER_CONTEXT": Config.String("DOCKER_CONTEXT").pipe(Config.withDefault("")),
7
+ "DOCKER_HOST": Config.String("DOCKER_HOST").pipe(Config.withDefault("")),
8
+ "TEST_DATABASE_URL": Config.String("TEST_DATABASE_URL"),
9
+ });
10
+ yield* Effect.sync(() => localPostgres(config).prepareDatabases([config.DATABASE_URL, config.TEST_DATABASE_URL]));
11
+ });
12
+ //# sourceMappingURL=setupDatabases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupDatabases.js","sourceRoot":"","sources":["../../src/server/setupDatabases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAElF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC,QAAQ,CAAC;IAC3E,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7C,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9E,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACxE,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;KACvD,CAAC,CAAC;IACH,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACnH,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/platform",
3
- "version": "0.24.2",
3
+ "version": "0.25.0",
4
4
  "description": "Opinionated Effect application infrastructure for ShivaeDev services",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/platform#readme",
6
6
  "bugs": {
@@ -41,7 +41,8 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@shivaedev/effect-contract": "0.11.0",
44
- "@shivaedev/effect-sql": "0.13.1",
44
+ "@shivaedev/effect-sql": "0.14.0",
45
+ "@shivaedev/local-postgres": "0.7.0",
45
46
  "@shivaedev/types": "0.2.1"
46
47
  },
47
48
  "devDependencies": {
@@ -54,11 +55,12 @@
54
55
  "@prisma-next/sql-contract": "0.16.0",
55
56
  "@prisma-next/sql-orm-client": "0.16.0",
56
57
  "@prisma-next/target-postgres": "0.16.0",
58
+ "@shivaedev/effect-pg-boss": "0.16.0",
57
59
  "@shivaedev/effect-prisma": "0.10.3",
58
60
  "@shivaedev/effect-test": "0.7.2",
59
- "@shivaedev/effect-test-sql": "0.8.3",
61
+ "@shivaedev/effect-test-sql": "0.8.4",
60
62
  "@shivaedev/effect-trpc": "0.8.3",
61
- "@shivaedev/quality": "0.34.0",
63
+ "@shivaedev/quality": "0.35.0",
62
64
  "@shivaedev/test-story": "0.18.2",
63
65
  "@trpc/client": "11.19.0",
64
66
  "@trpc/server": "11.19.0",
@@ -67,6 +69,7 @@
67
69
  "better-auth": "1.7.10",
68
70
  "effect": "4.0.5",
69
71
  "pg": "8.23.0",
72
+ "pg-boss": "12.38.0",
70
73
  "superjson": "2.2.6",
71
74
  "typescript": "7.0.2",
72
75
  "vitest": "5.0.5"
@@ -1,7 +1,9 @@
1
1
  import type { Duration } from "effect";
2
2
  import type { Migrator } from "effect/sql";
3
+ import type { SchemaComponent } from "@shivaedev/effect-sql/SchemaComponent.ts";
3
4
 
4
5
  export interface MigrationOptions<R = never> {
6
+ readonly components?: readonly SchemaComponent<R>[];
5
7
  readonly loader: Migrator.Loader<R>;
6
8
  readonly lockTimeout?: Duration.Input;
7
9
  readonly mode?: "migrate" | "check" | "wait";
@@ -7,6 +7,7 @@ import { type PolicyStorage, type SignInPolicy, signInGate } from "#server/bette
7
7
  import { signInPolicyOptions } from "#server/better-auth/signInPolicy.ts";
8
8
  import type { GetSession } from "#server/rpc-server/adapters/betterAuthSessions.ts";
9
9
  import { trustedProxyPeer, trustedProxyRanges } from "#server/rpc-server/local.ts";
10
+ import { redact } from "#server/rpc-server/redact.ts";
10
11
  import type { SessionShape } from "#server/rpc-server/session.ts";
11
12
 
12
13
  export interface BetterAuthMountOptions<E = never, R = never> {
@@ -59,7 +60,11 @@ export const betterAuthMount = Effect.fn("Platform.betterAuthMount")(function* <
59
60
  web.headers.delete("x-forwarded-for");
60
61
  web.headers.delete(clientIpHeader);
61
62
  }
62
- return HttpServerResponse.fromWeb(yield* Effect.tryPromise(() => auth.handler(web)));
63
+ return HttpServerResponse.fromWeb(
64
+ yield* Effect.tryPromise(() => auth.handler(web)).pipe(
65
+ Effect.tapError((error) => Effect.logError("Authentication provider failed", redact(error.cause))),
66
+ ),
67
+ );
63
68
  }).pipe(Effect.catch(() => Effect.succeed(HttpServerResponse.text("Authentication is temporarily unavailable", { status: 503 })))),
64
69
  ),
65
70
  );
@@ -0,0 +1,34 @@
1
+ import process from "node:process";
2
+ import { NodeRuntime, NodeServices } from "@effect/platform-node";
3
+ import { Effect } from "effect";
4
+ import { ChildProcess, ChildProcessSpawner } from "effect/process";
5
+
6
+ export interface DevelopmentOptions {
7
+ readonly conditions?: readonly string[];
8
+ readonly server: string;
9
+ readonly worker: string;
10
+ }
11
+
12
+ export const development = Effect.fn("Platform.development")(function* ({ server, worker, conditions = [] }: DevelopmentOptions) {
13
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
14
+ const options = { stderr: "inherit", stdout: "inherit" } as const;
15
+ const args = [...conditions.map((condition) => `--conditions=${condition}`), "--watch"];
16
+ return yield* Effect.raceAll([
17
+ spawner.exitCode(ChildProcess.make(process.execPath, [...args, server], options)),
18
+ spawner.exitCode(ChildProcess.make(process.execPath, [...args, worker], options)),
19
+ spawner.exitCode(ChildProcess.make("pnpm", ["exec", "vite"], options)),
20
+ ]);
21
+ });
22
+
23
+ export function runDevelopment(options: DevelopmentOptions): void {
24
+ NodeRuntime.runMain(
25
+ development(options).pipe(
26
+ Effect.tap((code) =>
27
+ Effect.sync(() => {
28
+ process.exitCode = code;
29
+ }),
30
+ ),
31
+ Effect.provide(NodeServices.layer),
32
+ ),
33
+ );
34
+ }
@@ -0,0 +1,12 @@
1
+ import { Config, Effect } from "effect";
2
+ import { localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
3
+
4
+ export const setupDatabases = Effect.fn("Platform.setupDatabases")(function* () {
5
+ const config = yield* Config.all({
6
+ "DATABASE_URL": Config.String("DATABASE_URL"),
7
+ "DOCKER_CONTEXT": Config.String("DOCKER_CONTEXT").pipe(Config.withDefault("")),
8
+ "DOCKER_HOST": Config.String("DOCKER_HOST").pipe(Config.withDefault("")),
9
+ "TEST_DATABASE_URL": Config.String("TEST_DATABASE_URL"),
10
+ });
11
+ yield* Effect.sync(() => localPostgres(config).prepareDatabases([config.DATABASE_URL, config.TEST_DATABASE_URL]));
12
+ });