@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 58 lines 2.43 KB
Rendered Raw
1 # cloudflare-foldkit-hybrid
2
3 Based on the routed `create-foldkit-app --rendering ssg` scaffold, extended with
4 request-derived Flags following Foldkit’s SSR example. One application combines
5 prerendered pages with a request-rendered counter.
6
7 | Route | Rendering |
8 | --- | --- |
9 | `/` | Prerendered at build time |
10 | `/about` | Prerendered at build time |
11 | `/counter?count=7` | Rendered by the Worker with an initial count of 7 |
12
13 Open `/counter?count=7` directly and view source: the count is already in the
14 HTML. Increment it after hydration, then reload to restore the request-derived
15 value. Client-side navigation remains within the running app; reload a route to
16 request fresh SSR Flags. Adding a query to `/` or `/about` does not rerender their
17 static HTML. Unknown pages return 404.
18
19 Only `/counter` sets `Cache-Control: private, no-store`. Prerendered routes return
20 plain `Server.Rendered` results because static HTML cannot preserve custom
21 response headers.
22
23 ## Run on Cloudflare
24
25 From this directory, after installing the workspace dependencies:
26
27 ```sh
28 pnpm dev
29 pnpm deploy
30 pnpm destroy
31 ```
32
33 `pnpm build` runs the standard Vite build. `pnpm test` runs the credentialed
34 Cloudflare integration checks and destroys the example afterward.
35
36 `alchemy.run.ts` uses `Cloudflare.Website.Foldkit`. The application’s Vite plugin
37 supplies the build output and routing metadata; no hand-written Worker wrapper
38 or build identity declaration is required.
39
40 ## Scaffold source
41
42 Application files follow [Foldkit’s generator and examples](https://github.com/foldkit/foldkit/tree/foldkit%400.167.0/packages/create-foldkit-app/templates/rendering/ssg)
43 (Foldkit 0.167.0 / `create-foldkit-app` 0.39.0). The original files were produced using the
44 generator’s `createProject` function. Alchemy adds the deployment file, workspace
45 package configuration and integration tests.
46
47 ## Rendering examples
48
49 - [SPA / CSR](../cloudflare-foldkit-spa): browser-only counter.
50 - [SSG](../cloudflare-foldkit-ssg): prerendered home and about pages.
51 - [SSR](../cloudflare-foldkit-ssr): cookie-backed request rendering.
52 - [Hybrid](../cloudflare-foldkit-hybrid): prerendered pages and a dynamic counter.
53
54 SSR/SSG documents follow the 0.167 scaffold: CSS is imported by the client entry,
55 and the server exports `renderDocument`. There is no source `index.html`.
56
57 `src/route.ts` defines the application routers and derives `prerenderPaths` from
58 them. Both browser navigation and the server use those route definitions.