A quiet lab exploring software craft, good code, and better ways to think.
Goodlab is a SvelteKit project for research notes, experiments, and visual series about ideas behind software. It is meant to be read and built slowly.
bun install
bun run devbun run check
bun run lint
bun run buildsrc/routescontains the app pagessrc/lib/contentcontains series and episodessrc/lib/visualscontains reusable visual primitivessrc/lib/componentscontains shared interface componentsdocs/researchcontains research notes and source-backed briefs
This app reads Better Auth settings from Cloudflare runtime bindings through event.platform.env.
Cloudflare's current Wrangler docs support local secrets in either .env or .dev.vars. This project uses .env only.
For local app secrets, copy .env.example to .env and fill in the values:
cp .env.example .envRequired local values:
BETTER_AUTH_SECRET="generate-a-long-random-secret"
BETTER_AUTH_URL="http://localhost:5173"
GITHUB_CLIENT_ID="..."
GITHUB_CLIENT_SECRET="..."For production, set the same values as Cloudflare Worker secrets. These are not read from .env in production:
bunx wrangler secret put BETTER_AUTH_SECRET
bunx wrangler secret put BETTER_AUTH_URL
bunx wrangler secret put GITHUB_CLIENT_ID
bunx wrangler secret put GITHUB_CLIENT_SECRETUse your production origin for BETTER_AUTH_URL, for example https://your-domain.com.
Configure these callback URLs in the GitHub OAuth app:
http://localhost:5173/api/auth/callback/github
https://your-domain.com/api/auth/callback/githubDo not commit .env or .env.* files. The committed .env.example file is a template only.
Do not create .dev.vars in this project. Wrangler gives .dev.vars precedence for local Worker secrets, which would prevent .env values from being included in the local Worker env object.
.env.example contains optional Cloudflare API variables for Wrangler automation or drizzle-kit D1 HTTP usage. You do not need a Cloudflare API token for normal local commands if you are already logged in with Wrangler.
The normal migration flow for this project is Wrangler-based:
bunx drizzle-kit generate
bunx wrangler d1 migrations apply goodlab-local --local
bunx wrangler d1 migrations apply goodlab-prod --env production --remoteThe default configured D1 binding is goodlab-local, which is used with Wrangler's local D1 simulation. The production environment overrides the same DB binding to use the remote goodlab-prod database.