Deployment
Build
npm install
npx next build
Environment
CakeMarket is configured for deployment on Cloudflare (see wrangler.toml and open-next.config.ts).
Key Configuration Files
| File | Purpose |
|---|---|
next.config.ts | Image optimisation, security headers, caching |
wrangler.toml | Cloudflare Workers config |
open-next.config.ts | OpenNext adapter for Cloudflare |
drizzle.config.ts | Database migration config |
Security Headers
Configured in next.config.ts:
- Content-Security-Policy (CSP)
- Strict-Transport-Security (HSTS)
- X-Frame-Options
- X-Content-Type-Options
- Referrer-Policy
CORS
Handled in src/middleware.ts for API routes.
PWA Support
The app is a Progressive Web App with:
public/manifest.json— App manifestpublic/sw.js— Service worker (caches static assets, offline fallback)public/offline.html— Offline page- PWA icons in
public/icons/ - Service worker registration in
src/app/layout.tsx
Cron Jobs
Set up an external scheduler to call these endpoints periodically:
POST /api/requests/expire # Every 5 minutes
POST /api/offers/expire-holds # Every 5 minutes
POST /api/orders/start-work # Hourly — auto-start work 3 days before the due date
POST /api/orders/escrow-release # Every 15 minutes
Email
- Production: Resend API
- Development: Console logging
Configure the Resend API key in your environment variables.