1# aws-router
2
3Two Vite sites behind one shared `AWS.Website.Router`, mounted on different
4paths:
5
6| Path | Site |
7| --------- | ----------- |
8| `/` | `apps/web` |
9| `/docs/*` | `apps/docs` |
10
11## Local
12
13```sh
14pnpm dev
15```
16
17`alchemy dev` runs each site's own Vite dev server (HMR included) and serves
18the Router from a locally emulated CloudFront on its own port:
19
20```
21url http://localhost:9500
22web http://localhost:5173
23docs http://localhost:5174
24```
25
26Open the `url` — `/` and `/docs/` route to the two dev servers through the
27emulated edge, running the same CloudFront Function a deploy would. Editing
28either app updates instantly; no redeploy, no invalidation.
29
30Requires Docker: the emulator runs as a container that `alchemy dev` starts
31for you.
32
33## Deploy
34
35```sh
36pnpm deploy
37```
38
39Creates a real CloudFront distribution, uploads each site to S3, and serves
40both from the same front door. `pnpm destroy` tears it down.
41
42## Notes
43
44The path prefix is not stripped: a site mounted at `/docs` is addressed as
45`/docs/...` at the edge, so `apps/docs` sets Vite's `base` to `/docs/` to
46match. `apps/web` is at the root and needs no `base`.
47
48Nothing in `alchemy.run.ts` is dev-specific — the same resource graph is
49declared in both modes.