Skip to content

Getting started

You need Node.js 24 or newer. pnpm comes through Corepack, so there’s nothing else to install.

Terminal window
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
corepack pnpm install
cp apps/web/.dev.vars.example apps/web/.dev.vars # set BETTER_AUTH_SECRET to 32+ random characters
corepack pnpm --filter @gymgym/web db:migrate:local
corepack pnpm dev

Open http://localhost:4321. “Continue as guest” works without any OAuth setup, and in local development (ENVIRONMENT=development) the sign-in page also takes an email and password. To try Google or GitHub sign in, add their client ids and secrets to .dev.vars and register http://localhost:4321/api/auth/callback/google (or /github) as the callback URL.

The dev server runs the real Worker in workerd, with a local D1 database, so what you see locally is what runs on Cloudflare.

With the dev server running:

Terminal window
corepack pnpm seed # add --reset to replace the demo data
Account Password What it has
demo@gymgym.test gymgym-dev-password A push/pull/legs plan, four weeks of workouts, body-weight readings and a goal
admin@gymgym.test gymgym-dev-password The admin role: Settings → Admin dashboard

The script goes through the SDK like any client and sets the admin role in the local database. Running it again leaves existing data alone.

import { createGymClient } from '@gymgym/sdk'
const gym = createGymClient({ baseUrl: 'http://localhost:4321' })
await gym.auth.signIn.anonymous()
const { viewer } = await gym.me()

Every operation in SDK operations is a method on the client, with typed variables and results.

Terminal window
corepack pnpm contract # print schema.graphql and regenerate the SDK
corepack pnpm typecheck
corepack pnpm test # unit tests and Workers tests
corepack pnpm check:features # every catalogued feature has a tagged test
corepack pnpm test:e2e # Playwright against the running dev server