Skip to content
Myr

backend.ts

This file

Path

apps/web/src/dev/backend.ts

34 lines · 1.7 KiB · TypeScript

Last changed by

Merge dev/live-clock into mainoscabrielbefore adoption923d465

History of this file

Take it

Add apps/web: a TanStack Start Worker that forwards /rpc to the platform over PLATFORM and holds no storage bindingoscabrielbefore adoption7f84530

line 1why, one step back
1/**

Merge build/502-web-dev-backend: the web runs locally over a seeded in-process worldoscabrielbefore adoption4aeb23e

lines 2–5why, one step back
2 * `#backend` under the `development` condition (`vite dev`, vitest): the
3 * contracts served in process by the dev world, so the web runs with no4 * platform, no Artifacts and no network. The browser reaches it through5 * the same `/rpc` route, the same `Contracts` group and the same atoms as

Integrate W5 group A: the dev world opens burrow's migrate as its family, reads the session cookie, and lists when each project last landedoscabrielbefore adoptionf9bd621

line 6why, one step back
6 * production; only this target differs. The session cookie becomes the

Drop the private build plan's citations from the code, and fail verify if one comes backoscabrielbefore adoptiona29cef6

line 7why, one step back
7 * bearer here too (`withCredential`), so the cookie `/auth/dev`

Integrate W5 group A: the dev world opens burrow's migrate as its family, reads the session cookie, and lists when each project last landedoscabrielbefore adoptionf9bd621

line 8why, one step back
8 * sets signs a browser in to the dev world as that person.

Merge build/502-web-dev-backend: the web runs locally over a seeded in-process worldoscabrielbefore adoption4aeb23e

lines 9–11why, one step back
9 *
10 * One world per isolate (`server.ts`): it is made and seeded when this11 * module loads, since `toWebHandler` builds at once, and kept for the

Merge dev/live-clock into mainoscabrielbefore adoption923d465

lines 12–16why, one step back
12 * isolate's life. Under `vite dev` its seed ends at the minute it loads,
13 * and its clock runs on from there (`clock.ts`), so a page reads each14 * deadline as the seed meant it on whatever day the server starts. Nothing15 * outside `src/dev/` imports this file, and the production build carries16 * none of it (`test/production-bundle.test.ts`).

Add apps/web: a TanStack Start Worker that forwards /rpc to the platform over PLATFORM and holds no storage bindingoscabrielbefore adoption7f84530

line 17why, one step back
17 */

Merge build/502-web-dev-backend: the web runs locally over a seeded in-process worldoscabrielbefore adoption4aeb23e

line 18why, one step back
18import type { Backend } from "../server/rpc.ts";

Integrate W5 group A: the dev world opens burrow's migrate as its family, reads the session cookie, and lists when each project last landedoscabrielbefore adoptionf9bd621

line 19why, one step back
19import { credentialFrom, withCredential } from "../server/session.ts";

Merge build/1205-dev-fixturesoscabrielbefore adoptionc816189

line 20why, one step back
20import { fixturesMode } from "./fixtures.ts";

Merge build/502-web-dev-backend: the web runs locally over a seeded in-process worldoscabrielbefore adoption4aeb23e

lines 21–22why, one step back
21import { devServer } from "./server.ts";
22

Merge dev/live-clock into mainoscabrielbefore adoption923d465

lines 23–30why, one step back
23/**
24 * `vite dev` places the world at the present; vitest, whose `MODE` is25 * `test`, keeps the calendar as written, so a test reads the same instants26 * on every run.27 */28const time = import.meta.env.MODE === "test" ? "fixed" : "present";2930const served = devServer({ fixtures: fixturesMode, time });

Merge build/502-web-dev-backend: the web runs locally over a seeded in-process worldoscabrielbefore adoption4aeb23e

line 31why, one step back
31

Integrate W5 group A: the dev world opens burrow's migrate as its family, reads the session cookie, and lists when each project last landedoscabrielbefore adoptionf9bd621

lines 32–34why, one step back
32/** The development backend: every request answered by the dev world, as the platform is asked; the env unused. */
33export const backend: Backend = (request) =>34 served.handler(withCredential(request, credentialFrom(request)));