Skip to main content

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

OOOC Fête Finder is designed for deployment on Vercel with PostgreSQL as the primary data store. This guide covers environment setup, deployment configuration, and post-deploy verification.

Prerequisites

1

Create a Vercel project

Connect your repository to Vercel and configure the project settings.
2

Provision PostgreSQL database

Use Vercel Postgres or any compatible PostgreSQL provider (Neon, Supabase, etc.).
3

Generate secrets

Generate required secrets before configuring environment variables.
# Generate AUTH_SECRET (required)
openssl rand -base64 48

# Generate ADMIN_KEY (recommended)
openssl rand -hex 24

# Generate CRON_SECRET (optional)
openssl rand -base64 48

# Generate DEPLOY_REVALIDATE_SECRET (optional)
openssl rand -base64 48

Required environment variables

Configure these in both Preview and Production environments:
# Core configuration
NODE_ENV=production
DATA_MODE=remote
AUTH_SECRET=your-generated-auth-secret-here
ADMIN_KEY=your-generated-admin-key-here

# Database
DATABASE_URL=postgresql://user:pass@host:5432/dbname?sslmode=require

# Public URLs
NEXT_PUBLIC_SITE_URL=https://your-domain.com
NEXT_PUBLIC_BASE_PATH=

# Cron protection (recommended)
CRON_SECRET=your-generated-cron-secret-here
DEPLOY_REVALIDATE_SECRET=your-generated-deploy-secret-here
See the Environment Variables reference for a complete list of optional configuration.

Deployment configuration

The application includes a vercel.json configuration file that defines:

Cron jobs

vercel.json
{
  "crons": [
    { "path": "/api/cron/cleanup-admin-sessions", "schedule": "0 4 * * *" },
    { "path": "/api/cron/cleanup-rate-limits", "schedule": "10 4 * * *" },
    { "path": "/api/cron/backup-event-store", "schedule": "20 4 * * *" }
  ]
}
All cron endpoints require Authorization: Bearer <CRON_SECRET> header. Set CRON_SECRET in your environment variables.

Function timeouts

vercel.json
{
  "functions": {
    "app/api/og/route.tsx": { "maxDuration": 10 }
  }
}

Cache headers

vercel.json
{
  "headers": [
    {
      "source": "/api/og",
      "headers": [
        { "key": "Cache-Control", "value": "s-maxage=86400, stale-while-revalidate=604800" },
        { "key": "Content-Type", "value": "image/png" }
      ]
    }
  ]
}

Deploy steps

1

Bootstrap the database

After first deployment, initialize the database schema and seed data:
# Local bootstrap (requires DATABASE_URL)
DATABASE_URL="your-database-url" pnpm bootstrap:postgres-store
This script:
  • Creates required tables (app_kv_store, app_event_store_*)
  • Migrates legacy KV data if present
  • Seeds from data/events.csv if tables are empty
  • Initializes user collection
2

Verify database connection

Check database health via the admin panel or CLI:
# Via CLI
DATABASE_URL="your-database-url" pnpm db:cli status

# Via admin panel
# Navigate to /admin/operations
3

Access admin panel

Navigate to /admin and authenticate with your ADMIN_KEY.The admin dashboard shows:
  • Runtime status and data source
  • Database connectivity
  • Current event count
  • Backup status
4

Load initial data

From /admin/operations, you can:
  • Upload CSV to PostgreSQL
  • Import from Google Sheets backup
  • Review event data in sheet editor
5

Configure deploy hook (optional)

Set up automatic cache invalidation after deploys:
  1. Add DEPLOY_REVALIDATE_SECRET to environment variables
  2. Configure Vercel Deploy Hook to call:
    POST https://your-domain.com/api/revalidate/deploy
    Authorization: Bearer <DEPLOY_REVALIDATE_SECRET>
    

Post-deploy verification

1

Check application health

curl https://your-domain.com/api/admin/health \
  -H "x-admin-key: your-admin-key"
Expected response:
{
  "status": "healthy",
  "database": "connected",
  "dataMode": "remote",
  "eventCount": 123
}
2

Verify cron jobs

Check Vercel dashboard > Cron Jobs to confirm:
  • All three cron jobs are registered
  • Schedules match vercel.json
  • First runs are scheduled
3

Test event data

Visit the homepage and verify:
  • Events load correctly
  • Map coordinates display
  • Filters function properly
4

Test admin operations

From /admin/operations:
  • Create a backup (“Backup Now”)
  • Verify backup appears in recent snapshots
  • Check runtime status cards show correct source

Common deployment issues

Runtime errors in preview/production

If you see runtime errors, verify these in order:
  1. Database connection: Confirm DATABASE_URL is set in both Preview and Production
  2. Data mode: Verify DATA_MODE=remote is explicitly set
  3. Secrets: Confirm AUTH_SECRET is at least 32 characters
  4. Cron secrets: If using cron jobs, verify CRON_SECRET is set
  5. Node runtime: Verify route handlers use Node runtime where needed

Database not initialized

If the database is empty after deployment:
# Re-run bootstrap script
DATABASE_URL="your-production-url" pnpm bootstrap:postgres-store

Stale cache after publish

If homepage doesn’t reflect saved changes:
  1. From /admin/operations, click “Save and Revalidate Homepage”
  2. Verify runtime source in “Live Runtime Snapshot”
  3. If needed, call the deploy revalidation endpoint manually

Deploy hook integration

Automate cache invalidation on every deploy:
1

Create deploy hook in Vercel

Project Settings > Git > Deploy Hooks > Create Hook
  • Name: “Post-Deploy Revalidate”
  • Branch: “main” (or your production branch)
2

Configure webhook target

Use your application’s revalidation endpoint:
POST https://your-domain.com/api/revalidate/deploy
Authorization: Bearer <DEPLOY_REVALIDATE_SECRET>
3

Test the webhook

Trigger a test deploy and verify:
  • Webhook receives 200 response
  • Cache is invalidated
  • New data appears on homepage

Monitoring

Monitor your deployment using:
  • Vercel Logs: Real-time function logs and errors
  • Admin health endpoint: /api/admin/health for application status
  • Database CLI: pnpm db:cli status for database diagnostics
  • Health check script: pnpm health:check for comprehensive diagnostics

Next steps

Build docs developers (and LLMs) love