Skip to content

Repository files navigation

Akhada

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

Architecture

One Astro project, one Cloudflare Worker:

  • Astro pages SSR-render HTML and call src/backend/db/client.ts directly (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>).

Prerequisites

Setup

bun install

1. Create D1 database

bunx wrangler login
bunx wrangler d1 create akhada-db

Copy the returned database_id into wrangler.jsonc (replace REPLACE_WITH_YOUR_DATABASE_ID).

2. Run migrations

bun run db:migrate:local    # local dev database
bun run db:migrate:remote   # remote Cloudflare D1

3. Seed exercises (optional)

The 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.sql

Development

bun run dev

Open http://localhost:4321.

API health check: http://localhost:4321/api/health

Scripts

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

Project structure

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/

Deploy

bun run deploy

About

Workout Logger - Heavy Alternative - Runs directly in the browser!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages