Overview
Every event-driven AI implementation follows the same pattern, regardless of framework:
- Register a webhook endpoint in ModelRiver that points to your backend
- Verify the signature on every incoming webhook
- Process the AI response: run custom logic (database, APIs, validation)
- Call back to the
callback_urlwith your enriched data
The guides below show idiomatic implementations for each framework, including signature verification, async processing, error handling, and callback patterns.
Supported frameworks
| Framework | Language | Highlights | Guide |
|---|---|---|---|
| Next.js | TypeScript | API routes, server actions, edge functions | View guide → |
| Nuxt.js | TypeScript | Server routes, Nitro engine, auto-imports | View guide → |
| Django | Python | Views, Celery tasks, Django REST Framework | View guide → |
| FastAPI | Python | Async handlers, BackgroundTasks, Pydantic | View guide → |
| Laravel | PHP | Queued jobs, middleware, event broadcasting | View guide → |
| Rails | Ruby | Active Job, Action Controller, credentials | View guide → |
| Phoenix | Elixir | GenServer, channels, Oban background jobs | View guide → |
| Spring Boot | Java | RestController, async processing, WebClient | View guide → |
| .NET | C# | Minimal APIs, hosted services, HttpClient | View guide → |
Common pattern
Every framework implementation follows this structure:
POST /webhooks/modelriver ← ModelRiver delivers AI result │ ├─ Verify mr-signature header ├─ Check type === "task.ai_generated" ├─ Return 200 immediately (acknowledge receipt) │ └─ Background process: ├─ Extract ai_response, event, callback_url, customer_data ├─ Execute your custom business logic └─ POST enriched data to callback_urlNext steps
- Serverless Databases: Supabase, PlanetScale, Neon, Convex
- Webhooks reference: Signature verification, retries, and delivery
- Event-driven AI overview: Architecture and flow