Skip to content

Getting started

You need Node.js 24 or newer. pnpm comes with Corepack, so you install nothing else.

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” needs no OAuth setup. In local development (ENVIRONMENT=development), the sign-in page also accepts an email and a password. To try Google or GitHub sign-in, add their client ids and secrets to .dev.vars. Then 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. What you see locally is what runs on Cloudflare.

Start the dev server, then run:

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 uses the SDK like any client and sets the admin role in the local database. If you run it again, it 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()

Each operation in SDK operations is a method on the client. It has typed variables and typed 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 a build of its own, on port 4331