Quick Start Guide - Local Development
This guide will help you get UnifiedCron running locally for testing with Supabase.
Prerequisites
- Node.js 18+
- pnpm (or npm)
- PostgreSQL running locally (or Docker)
- A Supabase project (cloud or local)
Step 1: Set Up Environment Variables
-
Copy the example environment file:
cp env.example .env.local -
Generate an encryption key:
openssl rand -base64 32Copy the output.
-
Edit
.env.localand set:DATABASE_URL=postgres://user:password@localhost:5432/unifiedcron ENCRYPTION_KEY=<paste the generated key here> API_PORT=3001 NODE_ENV=development NEXT_PUBLIC_API_URL=http://localhost:3001
Step 2: Set Up Database
For detailed database setup instructions, see Database Setup
Quick setup:
-
Start PostgreSQL (if not already running):
brew services start postgresql@15 # or brew services start postgresql@14 -
Run the automated setup script:
./scripts/setup-database.shOr manually create the database and run migrations:
# Create database psql -d postgres -c "CREATE DATABASE unifiedcron;" # Update DATABASE_URL in .env.local (the script does this automatically) # DATABASE_URL=postgres://$(whoami)@localhost:5432/unifiedcron # Run migrations: cd packages/database pnpm build cd ../.. node packages/database/dist/migrate.jsOr use the pnpm script (if configured):
pnpm db:migrate
Step 3: Start Development Servers
-
Install dependencies (if not already done):
pnpm install -
Build shared packages:
pnpm --filter @unifiedcron/shared build pnpm --filter @unifiedcron/database build pnpm --filter @unifiedcron/integrations build -
Start the servers:
pnpm devThis starts:
Step 4: Set Up Supabase Connection
-
In your Supabase project, run the SQL from
docs/supabase-setup.sql:- Go to SQL Editor in Supabase dashboard
- Copy and paste the SQL
- Run it
-
Get your Supabase credentials:
- Project URL: Settings → API → Project URL
- Anonymous Key: Settings → API → anon public key
-
In UnifiedCron:
- Go to http://localhost:3000 (opens in a new tab)
- Click "Connections" in the navigation
- Click "Add Supabase Connection"
- Enter:
- Label: e.g., "Production Database"
- Project URL: Your Supabase project URL
- Anonymous Key: Your anon key
- Click "Test & Connect"
Troubleshooting
API Won't Start
Error: "ENCRYPTION_KEY environment variable is required"
- Make sure
.env.localexists in the root directory - Verify
ENCRYPTION_KEYis set in.env.local - Restart the API server
Database Connection Issues
Error: "connection refused" or similar
- Verify PostgreSQL is running:
pg_isready - Check DATABASE_URL in
.env.localis correct - Ensure database exists:
psql -l | grep unifiedcron
Frontend Can't Connect to API
Error: "Failed to fetch" or connection errors
- Verify API is running: Check http://localhost:3001/health (opens in a new tab)
- Check browser console for CORS errors
- Verify
NEXT_PUBLIC_API_URLin.env.localmatches API port
Form Submits But Nothing Happens
- Check browser console for errors
- Check API logs for errors
- Verify the API is running and accessible
- Try the health endpoint: http://localhost:3001/health (opens in a new tab)
Connection Test Fails
- Verify Supabase views are created (run SQL from
docs/supabase-setup.sql) - Check Project URL is correct (should end with
.supabase.co) - Verify Anonymous Key is correct (starts with
eyJ...) - Check API logs for detailed error messages
Next Steps
Once connected:
- Go to Dashboard to see discovered jobs
- Click "Refresh Jobs" on a connection to discover cron jobs
- View job details and schedules
Getting Help
- Check API logs: Look at the terminal where
pnpm devis running - Check browser console: Open Developer Tools → Console
- Verify all services are running: Check both API and Web processes