Browse Source

Gate /demo routes to dev-only instead of requiring per-fork deletion

They're core-owned verification scaffolding (the live smoke-test surface
for the realtime session layer and humanoid package), not client-project
UI, so a branched project shouldn't need to remove them to keep them out
of production.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
main
Jonathan Hinkel 2 months ago
parent
commit
11a0c6bd97
  1. 1
      AGENTS.md
  2. 2
      docs/ARCHITECTURE.md
  3. 13
      src/routes/demo/+layout.server.ts

1
AGENTS.md

@ -10,6 +10,7 @@ Base SvelteKit project meant to be branched off for future webavatar client proj
- `src/lib/project/`, `src/lib/server/project/`, `src/lib/client/project/` — mirrors the three directories above, but for code specific to whichever client project branches from this template (tool implementations, custom instructions, etc.), instead of reusable template infrastructure. **Core never imports from project, only the reverse** — see [docs/TOOLS.md](docs/TOOLS.md) for the concrete example this convention was introduced for. - `src/lib/project/`, `src/lib/server/project/`, `src/lib/client/project/` — mirrors the three directories above, but for code specific to whichever client project branches from this template (tool implementations, custom instructions, etc.), instead of reusable template infrastructure. **Core never imports from project, only the reverse** — see [docs/TOOLS.md](docs/TOOLS.md) for the concrete example this convention was introduced for.
- `src/lib/humanoid/`, `src/lib/client/humanoid/` — an **optional package** (not `core`, not `project`; see "Module layering" in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)) providing avatar-state derivation and animation-channel composition for 3D humanoid avatars. Nothing in `core`/`project` imports from it — a project only pulls it in if it's building a humanoid avatar. See [docs/HUMANOID.md](docs/HUMANOID.md). - `src/lib/humanoid/`, `src/lib/client/humanoid/` — an **optional package** (not `core`, not `project`; see "Module layering" in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)) providing avatar-state derivation and animation-channel composition for 3D humanoid avatars. Nothing in `core`/`project` imports from it — a project only pulls it in if it's building a humanoid avatar. See [docs/HUMANOID.md](docs/HUMANOID.md).
- `src/routes/` — thin route glue; delegates into the above rather than holding logic itself. - `src/routes/` — thin route glue; delegates into the above rather than holding logic itself.
- `src/routes/demo/` — core-owned verification scaffolding (the live smoke-test surface referenced under "Verifying changes" below), not a client project's UI. Gated to dev-only (404s in production) so a branched project never needs to delete it to keep it out of a shipped build.
- `docs/` — architecture and subsystem documentation (see "Documentation" below). - `docs/` — architecture and subsystem documentation (see "Documentation" below).
## Development ## Development

2
docs/ARCHITECTURE.md

@ -22,6 +22,8 @@ First (and, as of this writing, only) package: **`humanoid`** (`src/lib/humanoid
Routes (`src/routes/`) stay thin and delegate into these — a route file is glue, not where logic lives. Routes (`src/routes/`) stay thin and delegate into these — a route file is glue, not where logic lives.
`src/routes/demo/` is the one exception worth calling out: it's core-owned verification scaffolding (the `/demo/realtime` and `/demo/humanoid` smoke-test surfaces referenced throughout these docs and in [AGENTS.md](../AGENTS.md)'s "Verifying changes"), not a client project's own UI, and a branched project has no reason to touch it. Rather than needing to be deleted per fork, it's gated to dev-only via `src/routes/demo/+layout.server.ts` (404s when `!dev`) — it stays available for `npm run dev` verification but never ships in a production build.
## Foundational infrastructure decisions ## Foundational infrastructure decisions
- **This app runs as a persistent Node process, not serverless.** The adapter is `@sveltejs/adapter-node` — configured inline in [`vite.config.ts`](../vite.config.ts)'s `sveltekit({ adapter: ... })` option, since this project has no separate `svelte.config.js` — started via a custom [`server.js`](../server.js) rather than adapter-node's default generated entrypoint. This is a hard requirement, not a preference: the realtime session relay holds a WebSocket connection to a browser and a second WebSocket connection to the model provider simultaneously, for the lifetime of a conversation. No serverless/edge adapter can hold connections like that. Any client project branching from this base inherits that constraint — plan hosting accordingly. - **This app runs as a persistent Node process, not serverless.** The adapter is `@sveltejs/adapter-node` — configured inline in [`vite.config.ts`](../vite.config.ts)'s `sveltekit({ adapter: ... })` option, since this project has no separate `svelte.config.js` — started via a custom [`server.js`](../server.js) rather than adapter-node's default generated entrypoint. This is a hard requirement, not a preference: the realtime session relay holds a WebSocket connection to a browser and a second WebSocket connection to the model provider simultaneously, for the lifetime of a conversation. No serverless/edge adapter can hold connections like that. Any client project branching from this base inherits that constraint — plan hosting accordingly.

13
src/routes/demo/+layout.server.ts

@ -0,0 +1,13 @@
import { dev } from '$app/environment';
import { error } from '@sveltejs/kit';
/**
* `/demo/**` is core-owned verification scaffolding (see docs/ARCHITECTURE.md's
* "Module layering" and AGENTS.md's "Verifying changes") — the live smoke-test
* surface for the realtime session layer and the humanoid package, not part of
* any client project's shipped UI. Gated to dev so a branched project doesn't
* need to delete it to keep it out of production.
*/
export const load = () => {
if (!dev) error(404);
};
Loading…
Cancel
Save