Production-grade multi-tenant SaaS backend framework. Generate, deploy, and operate with AI agents.
Project description
Rook
Production-grade multi-tenant SaaS backend framework. Zero to production in 15 minutes.
Generate, deploy, and operate production SaaS backends — with built-in support for AI agents.
pip install rook-framework
rook init my-app
rook resource generate Invoice --fields "client_id:fk(Client) status:enum(draft,sent,paid) amount:int"
rook dev
What you get in one command
rook init generates a complete production backend:
- Multi-tenant with RLS — row-level security at the database level, not just application filtering
- FastAPI + SQLAlchemy 2.0 + PostgreSQL — async, typed, production-ready
- Auth (JWT + Clerk), billing (Stripe), email (Resend), webhooks (HMAC + retry)
- Background jobs (ARQ), rate limiting, idempotency, feature flags
- CI pipeline — ruff, mypy, migration safety, schema drift, N+1 detection, security audit
- Deploy pipeline — snapshot → migrate → deploy → health gate → auto-rollback
- CLAUDE.md — AI agent context for every generated project
- MCP server — 30+ tools for AI agents to build, deploy, and operate your backend
Code generation
rook resource generate Order --fields "customer_id:fk(Customer) status:enum(pending,paid) total:decimal"
One command creates 7 files: model (with FK relationships + enum binding), schemas, service, controller, tests, factory, and migration (with RLS policies). Routes auto-registered. Migration auto-chained.
Production patterns included
| Pattern | What it does |
|---|---|
| Row-Level Security | Database-enforced tenant isolation |
| TxnManager | Auto-commit, auto-rollback, RLS via SET LOCAL |
| Outbox pattern | Reliable webhook delivery |
| Expand/contract migrations | Zero-downtime schema changes |
| N+1 detection | Per-request query counting with warnings |
| Schema drift detection | rook db doctor catches model/DB mismatches |
| Migration linting | rook db lint catches dangerous patterns |
| Idempotency middleware | Dedup POST/PUT/PATCH by Idempotency-Key |
| Health-gated deploys | Auto-rollback if deploy fails health check |
Agent-native
Rook is designed from the ground up to be operated by AI agents:
rook mcp serve
Exposes 30+ tools via Model Context Protocol. An AI agent can:
- Generate resources and wire them up
- Run migrations safely
- Deploy with checkpoints and rollback
- Detect schema drift and fix it
- Monitor query performance
Stack
| Layer | Default |
|---|---|
| Backend | FastAPI + SQLAlchemy 2.0 (async) |
| Database | PostgreSQL + pgvector |
| Auth | JWT (Clerk optional) |
| Billing | Stripe |
| Resend | |
| Jobs | Redis + ARQ |
| Storage | Cloudflare R2 |
| Monitoring | Sentry + structlog |
| CI/CD | GitHub Actions (generated) |
Documentation
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rook_framework-0.1.0.tar.gz.
File metadata
- Download URL: rook_framework-0.1.0.tar.gz
- Upload date:
- Size: 499.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1276ec8a08c7659d19ac6bf421ddac6bbe6eb4d5af4d24599a6084a84b1aa4b1
|
|
| MD5 |
c1712adb0044b4e857a12ffd74665c41
|
|
| BLAKE2b-256 |
c2ec790d5da569b0996821a6b2de24d7061e7a58e1a8298741312b1df772a314
|
File details
Details for the file rook_framework-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rook_framework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 301.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d897344816de563d61dadad4eac5941623f36fa87a46d3e87a37a4a6e3729e66
|
|
| MD5 |
23f74fa659e78a90e052b09107fdb4b9
|
|
| BLAKE2b-256 |
a12cb5a648094e362be6fd839015b297a5147b15dcef7797fc37a871faa72a95
|