UnifiedCron Development Guide
This guide will help you set up and develop UnifiedCron locally.
Prerequisites
- Node.js 20+
- pnpm (recommended) or npm
- PostgreSQL database
- Git
Quick Start
-
Clone and setup:
git clone <repository-url> cd unifiedcron chmod +x scripts/setup.sh ./scripts/setup.sh -
Configure environment:
cp env.example .env.local # Edit .env.local with your database URL and other settings -
Set up database:
# Make sure PostgreSQL is running createdb unifiedcron # Run migrations pnpm db:migrate -
Start development servers:
pnpm dev
This will start:
- Frontend at http://localhost:3000 (opens in a new tab)
- API at http://localhost:3001 (opens in a new tab)
- Background worker (in a separate terminal)
Project Structure
unifiedcron/
├── apps/
│ ├── web/ # Next.js frontend
│ ├── api/ # Express.js backend
│ └── worker/ # Background worker
├── packages/
│ ├── shared/ # Shared types and utilities
│ ├── database/ # Database schema and client
│ └── integrations/ # Platform-specific parsers
├── docs/ # Documentation
└── scripts/ # Setup and utility scriptsDevelopment Commands
# Install dependencies
pnpm install
# Start all development servers
pnpm dev
# Start individual services
pnpm dev:web # Frontend only
pnpm dev:api # API only
pnpm dev:worker # Worker only
# Build all packages
pnpm build
# Run tests
pnpm test
# Lint code
pnpm lint
# Type check
pnpm type-check
# Database migrations
pnpm db:migratePlatform Integration
Supabase
- Run the SQL in
docs/supabase-setup.sqlin your Supabase SQL editor - Get your project URL and anonymous key from Supabase dashboard
- Add connection in UnifiedCron with these credentials
GitHub Actions
- Create a Personal Access Token with
reposcope - Add connection with repository name (owner/repo) and token
Vercel/Netlify
- These require GitHub integration for automatic discovery
- Add GitHub connection first, then Vercel/Netlify can parse config files
n8n
- Get your n8n instance URL and API key
- Add connection with base URL and API key
Note: GitHub Actions, Vercel, Netlify, and n8n integrations are planned but not yet implemented in the current release.
API Endpoints
Authentication
POST /api/auth/register- Register userPOST /api/auth/login- Login userGET /api/auth/me- Get current user from bearer tokenGET /api/users/me- Get authenticated user profile
Connections
GET /api/connections- List connectionsPOST /api/connections- Create connectionGET /api/connections/:id- Get connectionPUT /api/connections/:id- Update connectionDELETE /api/connections/:id- Delete connectionPOST /api/connections/:id/test- Test connection
Jobs
GET /api/jobs- List jobsGET /api/jobs/:id- Get job detailsPOST /api/jobs/:connectionId/refresh- Refresh jobsGET /api/jobs/:id/runs- Get job runsGET /api/jobs/:id/stats- Get job statistics
Alerts
GET /api/alerts- List alerts (status=open|resolved,type=failure)GET /api/alerts/:id- Get alertPATCH /api/alerts/:id/resolve- Resolve alertGET /api/alerts/stats/overview- Get alert statistics
Notifications
GET /api/notifications/webhooks- List webhook endpointsPOST /api/notifications/webhooks- Create webhook endpointPATCH /api/notifications/webhooks/:id- Edit or pause endpoint; rotate signing secretDELETE /api/notifications/webhooks/:id- Delete webhook endpointPOST /api/notifications/webhooks/:id/test- Queue test event (HTTP 202)GET /api/notifications/deliveries- Filtered, paginated delivery historyGET /api/notifications/deliveries/:id- Delivery detail and attempt historyGET /api/notifications/metrics- Current user's delivery status counts
See Webhook Notifications for signing verification, retries and destination policy.
Database Schema
Tables
users- User accountsconnections- Platform connections (encrypted config)jobs- Normalized cron jobsjobRuns- Job execution historyalerts- Failure alerts and notificationsnotification_endpoints- Webhook endpoint configurationnotification_deliveries- Webhook delivery attempts and retriesnotification_delivery_attempts- Per-attempt outcomes and lease recovery historyingestion_state- Stream cursors, freshness and connection retry stateingestion_gaps- Possible upstream history gaps
Views
job_details- Jobs with connection and statistics
Security
- All connection credentials are encrypted using AES-256-GCM
- Database uses camelCase column names
- API includes proper error handling and validation
- Frontend uses secure HTTP practices
Monitoring
The worker normally polls each Supabase connection once per minute, with jitter, bounded concurrency and error backoff. It rediscovers stable job IDs, pages numerically by runid, refreshes unfinished statuses and commits run changes with cursor checkpoints. Initial backfill is bounded; upstream purge gaps and catch-up state remain visible. Missing jobs are archived, and names are display-only. Failures accumulate in one open incident per job/type; a newer successful run resolves it. Notifications fire on open/resolve, not on each failure.
Webhook dispatch runs independently every 15 seconds, including when monitoring is disabled. Database leases prevent concurrent claims; retries use 1/5/15/30/60-minute backoff. The sixth unsuccessful attempt is terminal. Outbox reconciliation repairs missed enqueue operations.
Worker observability endpoints:
GET http://localhost:3003/healthGET http://localhost:3003/metrics
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Troubleshooting
Database Connection Issues
- Ensure PostgreSQL is running
- Check DATABASE_URL in .env.local
- Verify database exists and user has permissions
Platform Connection Issues
- Verify credentials are correct
- Check platform-specific setup requirements
- Review API rate limits
Build Issues
- Clear node_modules and reinstall:
rm -rf node_modules && pnpm install - Check Node.js version compatibility
- Ensure all packages are built:
pnpm build
Environment Variables
Required:
DATABASE_URL- PostgreSQL connection stringENCRYPTION_KEY- 32-byte base64 key for encrypting secrets
Optional:
API_PORT- API server port (default: 3001)NODE_ENV- Environment (development/production)NEXT_PUBLIC_API_URL- Frontend API URLTEST_*- Test credentials for development
License
AGPL-3.0 License