Last updated: 2026-03-18 20:19:29 MDT
Turn PDFs and document images into structured data using a Cloudflare Worker.
- A Cloudflare account
- Node.js 18+
- This repo cloned locally
- Install dependencies
npm install- Log in to Cloudflare
npx wrangler login- Create your D1 database (one time)
npx wrangler d1 create easyextract-db- Update
wrangler.toml
- Set
database_idto the ID returned by the create command. - Keep
binding = "DB".
- Create required secrets (one time)
npx wrangler secret put OPENAI_API_KEY
npx wrangler secret put GCP_SA_KEY
npx wrangler secret put GCP_PROJECT_ID- Deploy safely
npm run deploy:safeThat command runs typecheck, verifies required secrets, deploys, and checks /api/health.
- Add local vars in
.dev.vars
OPENAI_API_KEY=...
GCP_SA_KEY={...json...}
GCP_PROJECT_ID=...- Start local server
npm run devnpm run dev # local app
npm run typecheck # TypeScript check
npm run deploy:safe # production deploy with health validationIf your database was created before bucket template defaults were removed, run this once first:
npm run db:migrate:remove-bucket-template
npm run db:migrateThis preserves existing bucket rows and removes the legacy bucket-level template_id column.
Missing required secret: runnpx wrangler secret put <NAME>no such table: ensure your D1 DB is created anddatabase_idis correct inwrangler.toml- Deploy health failure: open
/api/healthand confirm all services aretrue