Serverless Functions
Deploy individual functions as HTTP endpoints with zero infrastructure management. Functions scale to zero when idle, boot in milliseconds, and bill per invocation -- ideal for webhooks, scheduled tasks, lightweight APIs, and event handlers.
Use cases
| Use Case | Description |
|---|---|
| Webhooks | Handle Stripe, GitHub, or any third-party webhook with zero cold-start concern. |
| Cron tasks | Run scheduled data jobs, reports, or cleanup routines without a persistent process. |
| API endpoints | Lightweight REST endpoints that only run when called. |
| Event handlers | React to RailPush deploy events, queue messages, or database triggers. |
Supported runtimes
- Node.js 20
- Python 3.11
Limits
| Limit | Value |
|---|---|
| Execution timeout | 30 seconds |
| Memory | 512 MB |
| Request payload | 6 MB |
| Concurrency | Unlimited (scale to zero) |
Create a function
API
curl -X POST https://railpush.com/api/v1/functions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "process-webhook",
"runtime": "node20",
"source_type": "git",
"repo": "acme/webhooks",
"branch": "main",
"handler": "index.handler"
}'
# Response:
# {
# "id": "fn-...",
# "invoke_url": "https://fn-process-webhook.railpush.com",
# "status": "deploying"
# }
Invoke a function
curl
# HTTP POST with JSON body
curl -X POST https://fn-process-webhook.railpush.com \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"event": "payment.succeeded", "amount": 4900}'
# HTTP GET with query params
curl "https://fn-process-webhook.railpush.com?id=123"
API reference
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/functions | Create a function |
| GET | /api/v1/functions | List all functions |
| GET | /api/v1/functions/:id | Get function details |
| PATCH | /api/v1/functions/:id | Update function config |
| DELETE | /api/v1/functions/:id | Delete a function |
| POST | /api/v1/functions/:id/invoke | Invoke synchronously (returns response) |