Ultrafast mobile-first workout webapp on the Cloudflare stack.
- Frontend: Astro SSR + Preact islands + Tailwind CSS v4
- API: Hono mounted inside Astro (
/api/*) - Runtime: Cloudflare Workers (single deploy)
- Database: Cloudflare D1 (SQLite)
- Tooling: Bun
One Astro project, one Cloudflare Worker:
- Astro pages SSR-render HTML and call
src/backend/db/client.tsdirectly (no self-HTTP for initial loads). - Hono handles client-side API calls via
src/pages/api/[...path].ts. - Typed client calls use Hono RPC (
hc<AppType>).
- Bun 1.3+
- Cloudflare account
- Wrangler CLI (installed via project dependencies)
bun installbunx wrangler login
bunx wrangler d1 create akhada-dbCopy the returned database_id into wrangler.jsonc (replace REPLACE_WITH_YOUR_DATABASE_ID).
bun run db:migrate:local # local dev database
bun run db:migrate:remote # remote Cloudflare D1The seed file is large and lives at src/backend/db/queries/exercises_insert_sqlite.sql.
bunx wrangler d1 execute akhada-db --local --file=src/backend/db/queries/exercises_insert_sqlite.sql
bunx wrangler d1 execute akhada-db --remote --file=src/backend/db/queries/exercises_insert_sqlite.sqlbun run devOpen http://localhost:4321.
API health check: http://localhost:4321/api/health
| Command | Description |
|---|---|
bun run dev |
Start Astro dev server with Cloudflare platform proxy |
bun run build |
Build for production |
bun run deploy |
Build and deploy to Cloudflare Workers |
bun run lint |
Run Biome linter |
bun run format |
Format code with Biome |
bun run db:migrate:local |
Apply D1 migrations locally |
bun run db:migrate:remote |
Apply D1 migrations to remote D1 |
bun run generate-types |
Generate Wrangler binding types |
src/
├── backend/ # Hono app + D1 query layer
│ ├── app.ts
│ ├── routes/
│ └── db/
│ ├── client.ts
│ ├── migrations/
│ └── queries/
├── components/ # Preact islands
├── layouts/
├── lib/ # Typed Hono client
├── pages/
│ ├── index.astro
│ └── api/[...path].ts
└── styles/
bun run deploy