| 1 | # Cloudflare Website: Foldkit |
| 2 | |
| 3 | Deploys a [Foldkit](https://foldkit.dev) app to Cloudflare Workers with |
| 4 | `Cloudflare.Website.Foldkit` — no `main` entry, build command, or |
| 5 | Wrangler configuration. Foldkit apps are client-only Vite projects: |
| 6 | Alchemy runs Vite with the project's own `vite.config.ts` and serves |
| 7 | the client build as static assets — no Worker code runs at request |
| 8 | time. |
| 9 | |
| 10 | - `src/main.ts` holds the Elm-architecture model/update/view; the page |
| 11 | renders a `card` view function (`src/components/Card.ts`) written in |
| 12 | plain TypeScript with `foldkit/html`. |
| 13 | - Tailwind CSS v4 is wired through `@tailwindcss/vite` in the project's |
| 14 | own `vite.config.ts`, alongside `@foldkit/vite-plugin`. |
| 15 | - Unmatched paths serve `index.html` (SPA fallback) by default, so deep |
| 16 | links boot the app and Foldkit routes on the client. |
| 17 | |
| 18 | ## Deploy |
| 19 | |
| 20 | ```sh |
| 21 | bun install |
| 22 | bun run deploy |
| 23 | ``` |
| 24 | |
| 25 | Unchanged sources skip the Vite build entirely on subsequent deploys — |
| 26 | the input files are content-hashed (scoped by `memo.include`). |
| 27 | |
| 28 | ## Local development |
| 29 | |
| 30 | ```sh |
| 31 | bun run dev |
| 32 | ``` |
| 33 | |
| 34 | `alchemy dev` runs Vite's own dev server — Foldkit's HMR and devtools |
| 35 | wiring work unchanged. |
| 36 | |
| 37 | ## Destroy |
| 38 | |
| 39 | ```sh |
| 40 | bun run destroy |
| 41 | ``` |