Overview
InsForge Schedules lets you run serverless functions on a recurring cron schedule. Jobs are managed entirely in PostgreSQL using the pg_cron extension, which executes HTTP requests to your function endpoints at the specified intervals.
Technology Stack
Core Components
| Component | Technology | Purpose |
|---|
| Scheduler | pg_cron | PostgreSQL-native cron job scheduling |
| HTTP Client | pg http extension | Execute HTTP requests from within PostgreSQL |
| Encryption | pgcrypto (AES) | Encrypt sensitive headers at rest |
| Job Store | PostgreSQL | Job definitions and execution logs |
| Service Layer | Node.js | Cron validation, secret resolution, CRUD |
How It Works
When a schedule is created:
- The cron expression is validated (5-field format, no seconds)
- Secret placeholders (
${{secrets.KEY}}) in headers are resolved and encrypted
- A pg_cron job is registered that calls
execute_job() on the cron schedule
When pg_cron fires:
execute_job() fetches the job definition and decrypts headers
- An HTTP request is made to the function endpoint
- The result (status code, duration, success/failure) is logged to
schedules.job_logs
Execution Flow
Cron Expressions
Standard 5-field format — seconds are not supported.
| Expression | Schedule |
|---|
*/5 * * * * | Every 5 minutes |
0 * * * * | Every hour |
0 0 * * * | Daily at midnight |
0 9 * * 1 | Every Monday at 9am |
0 0 1 * * | First of every month |
Secret Management
Headers support ${{secrets.KEY_NAME}} template syntax. Secrets are resolved at creation time, encrypted with pgcrypto, and decrypted only at execution time. Template headers (without secret values) are stored separately for safe display in the dashboard.
If a referenced secret is deleted, scheduled jobs using it will fail. Update or disable affected schedules after removing secrets.
Best Practices
- Test First: Invoke your function manually before scheduling it
- Use Secrets: Pass API keys via header secrets instead of hardcoding
- Stay Fast: Functions should complete within the 30-second timeout
- Monitor Logs: Check execution logs for failures and unexpected status codes
- Disable, Don’t Delete: Pause schedules temporarily instead of recreating them
Limitations
- Minimum Interval: 1 minute (pg_cron limitation)
- No Seconds: 5-field cron expressions only
- Admin Only: Schedules are managed by project admins
- No Retry: Failed executions are logged but not automatically retried