@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
md 45 lines 1.95 KB
Rendered Raw
1 # cloudflare-foldkit-ssr
2
3 The cookie-backed counter scaffold from `create-foldkit-app --rendering ssr`.
4 Foldkit renders each page request in a Cloudflare Worker. Its Flags contain the
5 count from the request cookie and the render timestamp. `Runtime.hydrate` adopts
6 that HTML, and clicking a counter button persists the new count in the browser
7 cookie. Reloading demonstrates that the Worker renders the persisted count.
8
9 Responses use `Cache-Control: private, no-store` and `Vary: cookie`. There are no
10 prerendered pages in this example.
11
12 ## Run on Cloudflare
13
14 From this directory, after installing the workspace dependencies:
15
16 ```sh
17 pnpm dev
18 pnpm deploy
19 pnpm destroy
20 ```
21
22 `pnpm build` runs the standard Vite build. `pnpm test` runs the credentialed
23 Cloudflare integration checks and destroys the example afterward.
24
25 `alchemy.run.ts` uses `Cloudflare.Website.Foldkit`. The application’s Vite plugin
26 supplies the build output and routing metadata; no hand-written Worker wrapper
27 or build identity declaration is required.
28
29 ## Scaffold source
30
31 Application files follow [Foldkit’s generator and examples](https://github.com/foldkit/foldkit/tree/foldkit%400.167.0/packages/create-foldkit-app/templates/rendering/ssr)
32 (Foldkit 0.167.0 / `create-foldkit-app` 0.39.0). The original files were produced using the
33 generator’s `createProject` function. Alchemy adds the deployment file, workspace
34 package configuration and integration tests. The SSR cookie helper uses the HTTP
35 module path from this workspace’s Effect version.
36
37 ## Rendering examples
38
39 - [SPA / CSR](../cloudflare-foldkit-spa): browser-only counter.
40 - [SSG](../cloudflare-foldkit-ssg): prerendered home and about pages.
41 - [SSR](../cloudflare-foldkit-ssr): cookie-backed request rendering.
42 - [Hybrid](../cloudflare-foldkit-hybrid): prerendered pages and a dynamic counter.
43
44 SSR/SSG documents follow the 0.167 scaffold: CSS is imported by the client entry,
45 and the server exports `renderDocument`. There is no source `index.html`.