1# @fixtures/astro-ssr
2
3E2e fixture for `@alchemy.run/frontend-frameworks/astro` exercising the **SSR-first path with
4an honored user config file**. Where `packages/frontend-frameworks/fixtures/astro` is mostly prerendered
5and fully programmatic (no `astro.config.*`), this fixture is the inverse: a
6**real `astro.config.mjs`** (`output: "server"`, redirects,
7`security.checkOrigin: false`, dev toolbar off) that the integration must load
8and respect per the user-config principle, driving an app where every route is
9on-demand unless it opts into prerendering.
10
11## Status: ENABLED
12
13The user-config wave landed: the integration loads the project's
14`astro.config.*` natively and injects the toolchain as an inline overlay, so
15this suite runs ungated (`bun run test` calls `playwright test` directly).
16
17## What the app exercises
18
19- dynamic param routes (`/greet/[name]`) rendered per request — no
20 `getStaticPaths`, any param resolves
21- per-request middleware (`src/middleware.ts`): fresh `requestId` in
22 `Astro.locals` (rendered by every SSR page) mirrored onto `x-request-id` /
23 `x-middleware` response headers
24- a server-handled form POST (`/feedback`): GET renders the form, POST reads
25 `formData()` and re-renders with the echoed message; direct `fetch` POSTs
26 rely on the user config's `security.checkOrigin: false`
27- an `Astro.session` round-trip (`/session`) via zero-config sessions (KV
28 driver, `SESSION` binding auto-provisioned in dev / miniflare KV in live)
29- a streaming-friendly page (`/stream`): early chunk flushed before an async
30 component boundary resolves
31- JSON (`/api/hello`, GET + POST echo) and binary (`/api/binary`) endpoints
32- ONE prerendered page (`/about/`, `export const prerender = true`) as the
33 hybrid exception — served from assets in production
34- a redirect declared in `astro.config.mjs` (`/legacy-greeting` →
35 `/greet/astro`) whose target is on-demand, so it must be handled by the
36 worker in both dev and live
37- a `public/` static asset (`/robots.txt`) and the 404 path for unmatched
38 routes
39
40## Commands
41
42```sh
43bun run dev # astro dev with the ssr environment in workerd (port 3106)
44bun run build # astro build -> dist/ + dist/build.json
45bun run preview # miniflare over dist/build.json
46bun run test # playwright e2e over dev + live
47```