Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KingPsychopath/oooc-fete-finder/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This runbook defines production and preview runtime policies for OOOC Fête Finder on Vercel. These policies ensure secure, reliable operation in ephemeral serverless environments.Runtime policy
OOOC Fête Finder enforces the following runtime rules:PostgreSQL-backed storage
KV/runtime store in deployed serverless environments must be PostgreSQL-backed. File system storage is not persistent and must not be relied upon for event or coordinate data.
Database health
DATABASE_URL must be healthy and accessible from all serverless functions. Application startup validates database connectivity.Token-protected endpoints
Cron routes and deploy revalidation routes must be token-protected using environment variable secrets.
Data mode configuration
The application operates in one of three modes:Remote mode (production)
- Primary source: PostgreSQL event store
- Fallback source: Local CSV (
data/events.csv) if store read fails - Google Sheets: Admin backup/preview only
- Required for production/preview environments
Local mode (development)
- Primary source: Local CSV (
data/events.csv) - No database required
- Useful for offline development
- Never use in production
Test mode
- Uses in-memory mock data
- No external dependencies
- Used by test suite
Event and revalidation flow
The application follows this data flow in production:Cron endpoints
Configured invercel.json:
Cleanup admin sessions
Endpoint:GET /api/cron/cleanup-admin-sessionsSchedule: Daily at 04:00 UTC
Purpose: Remove expired admin authentication sessions
Cleanup rate limits
Endpoint:GET /api/cron/cleanup-rate-limitsSchedule: Daily at 04:10 UTC
Purpose: Prune expired rate limit buckets from KV store
Backup event store
Endpoint:GET /api/cron/backup-event-storeSchedule: Daily at 04:20 UTC
Purpose: Create automatic snapshot of event store and featured schedule
All cron endpoints require
Authorization: Bearer <CRON_SECRET> header. Set CRON_SECRET in both Preview and Production environments.Deploy revalidation endpoint
Endpoint:POST /api/revalidate/deploy (or GET)Purpose: Invalidate cache after deployments
Configure webhook
Create Vercel Deploy Hook
Project Settings > Git > Deploy Hooks > Create Hook
- Name: “Post-Deploy Revalidate”
- Branch: “main”
Security hardening
Environment variable validation
The application validates required variables at startup:Cron authentication
All cron routes verify the bearer token:Admin authentication
Admin endpoints requirex-admin-key header:
Rate limiting
Public endpoints use in-memory rate limiting:Node runtime enforcement
Some routes require Node.js runtime (not Edge):Edge Runtime is faster but has limitations. Use Node runtime for routes that need full Node.js APIs.
Failure checks
If runtime errors appear in preview/production:Verify DATABASE_URL
Confirm
DATABASE_URL exists in both Preview and Production environments in Vercel dashboard.Cache control headers
The application sets appropriate cache headers:API routes (no caching)
- Admin endpoints
- Cron jobs
- Revalidation endpoints
- User session endpoints
OG image route (aggressive caching)
vercel.json
- 24 hours fresh (s-maxage=86400)
- 7 days stale-while-revalidate
Monitoring and alerts
Health check script
Run comprehensive diagnostics:- PostgreSQL connectivity
- KV store key count
- Event table row counts
- Admin health endpoint response
- Postgres KV endpoint response
Vercel metrics
Monitor in Vercel dashboard:- Function execution duration
- Function error rate
- Function invocation count
- Edge cache hit ratio
- Bandwidth usage
Custom logging
The application logs key events:Disaster recovery
In case of critical failure:Restore from backup
- Navigate to
/admin/operations - Restore latest backup or selected snapshot
- Revalidate homepage
- Verify runtime source
Production checklist
Before going live, verify:-
DATA_MODE=remotein Production and Preview -
DATABASE_URLset and tested -
AUTH_SECRETis at least 32 characters -
ADMIN_KEYis set and documented -
CRON_SECRETis set and matches Vercel cron config - All three cron jobs are registered in Vercel
- Deploy revalidation webhook is configured
- Health check script runs successfully
- Backup cron job has executed at least once
- Admin panel is accessible and shows healthy status
- Homepage loads events from PostgreSQL (check runtime source)
Next steps
- Configure logging for production monitoring
- Set up backups for disaster recovery
- Deploy to production with confidence