Getting Started Runbook
This runbook covers local development setup for a Factory app Worker.Prerequisites
- Node.js 20+
- Wrangler CLI (
npm install -g wrangler) - Access to the GitHub Packages registry (
@adrper79-dot/*) - Neon Postgres connection string (or access to factory-admin to retrieve it)
1. Clone the repo
2. Authenticate with GitHub Packages
Create (or reuse) a GitHub Personal Access Token withread:packages scope.
3. Install dependencies
4. Create .dev.vars
Wrangler loads .dev.vars as secrets during wrangler dev. Never commit this file.
For app-specific bindings (Hyperdrive, KV, R2), add them towrangler.jsoncunder[dev]bindings or use remote dev mode (wrangler dev --remote).
5. Verify local environment configuration
Before starting the Worker, run the app’s environment verification if it exists. This catches missing bindings, wrong secret names, and environment mixups beforewrangler dev starts.
6. Start the local dev server
http://localhost:8787.
7. Verify the health endpoint
8. Running tests
9. TypeScript typecheck
Troubleshooting
| Problem | Fix |
|---|---|
401 Unauthorized on npm install | Re-check GitHub PAT scope and .npmrc |
ETARGET No matching version | Run npm install @adrper79-dot/{pkg}@latest |
Wrangler InvalidSymbol in wrangler.jsonc | Ensure all JSON keys are quoted |
process.env not available | Use c.env.VAR / env.VAR (Cloudflare bindings only) |
Buffer is not defined | Replace with TextEncoder / Uint8Array |
| Environment mismatch or missing binding | Run the local verifier and compare with Environment Verification Setup |