Skip to content

Latest commit

 

History

History
106 lines (68 loc) · 2.92 KB

File metadata and controls

106 lines (68 loc) · 2.92 KB

Configuration Reference

Configuration and deployment setup for devJournal.

wrangler.json - Cloudflare Workers Configuration

Cloudflare Workers configuration for devJournal deployment.

Structure

Assets

  • binding: ASSETS - Worker binding name for static files
  • directory: ./public - Static assets location
  • html_handling: auto-trailing-slash - Automatically handle trailing slashes
  • run_worker_first: true - Run Worker logic before serving static assets (enables auth middleware)

Compatibility Date

2026-01-17 - Cloudflare Workers runtime compatibility date

D1 Databases

Development environment uses devjournal-db (default)

Environments

Production (--env=production)

  • name: devjournal
  • database: devjournal-db-production (dedicated production database)
  • redirect_uri: https://devjournal.tforster.com/auth/callback
  • deployment: npx wrangler deploy --env=production

Staging (--env=staging)

  • name: devjournal-staging
  • database: devjournal-db (shared with development)
  • redirect_uri: https://devjournal-staging.tforster.workers.dev/auth/callback
  • deployment: npx wrangler deploy --env=staging

Local Development (default)

  • name: devjournal (preview only)
  • database: devjournal-db (local)
  • redirect_uri: https://localhost:8787/auth/callback (placeholder - use Cloudflare Tunnel URL)
  • run: npm run dev (starts tunnel + wrangler dev)

Main Entry Point

src/index.js - Worker entry point

Observability

Enabled for all environments (Cloudflare Workers Analytics)

Environment Variables

Required secrets (managed via wrangler secret put):

  • FRESHBOOKS_CLIENT_ID - FreshBooks OAuth app client ID
  • FRESHBOOKS_CLIENT_SECRET - FreshBooks OAuth app secret
  • FRESHBOOKS_USER_ID - FreshBooks user ID for authentication restriction
  • JWT_SECRET - JWT signing secret (32+ characters)

Public variables (in wrangler.json):

  • FRESHBOOKS_REDIRECT_URI - OAuth callback URL (environment-specific)

Local development (.dev.vars file):

FRESHBOOKS_CLIENT_ID=your_client_id
FRESHBOOKS_CLIENT_SECRET=your_client_secret
FRESHBOOKS_USER_ID=your_user_id
JWT_SECRET=dev-secret-change-in-production

Database IDs

Database IDs are stable and should not be changed after initial creation:

  • Development/Staging: eb331392-5fed-42ea-b1ef-393ccb948619
  • Production: 99188f89-411a-4e6b-bddb-056544c80c79

Deployment Commands

# Local development
npm run dev

# Deploy to staging
npx wrangler deploy --env=staging

# Deploy to production
npx wrangler deploy --env=production

# Run migrations
./devops/db-migrate.sh [production|staging]

See Also