UnifiedCron Development Guide
This guide will help you set up and develop UnifiedCron locally.
Prerequisites
- Node.js 18+
- 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
API Endpoints
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 alertsGET /api/alerts/:id- Get alertPATCH /api/alerts/:id/resolve- Resolve alertGET /api/alerts/stats/overview- Get alert statistics
Database Schema
Tables
users- User accountsconnections- Platform connections (encrypted config)jobs- Normalized cron jobsjobRuns- Job execution historyalerts- Failure alerts and notifications
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 background worker runs every 5 minutes to:
- Check Supabase job runs for failures
- Create alerts for failed jobs
- Clean up old data
- Update job statistics
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
MIT License - see LICENSE file for details