Metadata-Version: 2.4
Name: rook-framework
Version: 0.1.0
Summary: Production-grade multi-tenant SaaS backend framework. Generate, deploy, and operate with AI agents.
Author: SJ Kim
License: MIT
License-File: LICENSE
Keywords: agent,fastapi,framework,mcp,multi-tenant,saas
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.11
Requires-Dist: alembic>=1.14
Requires-Dist: arq>=0.26
Requires-Dist: asyncpg>=0.30.0
Requires-Dist: fastapi>=0.115.0
Requires-Dist: httpx>=0.28
Requires-Dist: jinja2>=3.1
Requires-Dist: psycopg2-binary>=2.9
Requires-Dist: pydantic-settings>=2.1
Requires-Dist: pydantic>=2.5
Requires-Dist: pyjwt>=2.8
Requires-Dist: python-dotenv>=1.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: redis>=5.0
Requires-Dist: rich>=13.0
Requires-Dist: sentry-sdk[fastapi]>=2.0
Requires-Dist: sqlalchemy[asyncio]>=2.0
Requires-Dist: structlog>=24.0
Requires-Dist: typer[all]>=0.15
Requires-Dist: uvicorn[standard]>=0.34.0
Provides-Extra: agent
Requires-Dist: anthropic>=0.40; extra == 'agent'
Requires-Dist: mcp>=1.20; extra == 'agent'
Provides-Extra: ai
Requires-Dist: anthropic>=0.40; extra == 'ai'
Requires-Dist: pgvector>=0.3; extra == 'ai'
Provides-Extra: billing
Requires-Dist: stripe>=11.0; extra == 'billing'
Provides-Extra: dev
Requires-Dist: aiosqlite>=0.20.0; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pre-commit>=4.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: email
Requires-Dist: resend>=2.0; extra == 'email'
Provides-Extra: mcp
Requires-Dist: mcp>=1.20; extra == 'mcp'
Description-Content-Type: text/markdown

# 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.**

```bash
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

```bash
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:

```bash
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 |
| Email | Resend |
| Jobs | Redis + ARQ |
| Storage | Cloudflare R2 |
| Monitoring | Sentry + structlog |
| CI/CD | GitHub Actions (generated) |

## Documentation

- [Getting Started](docs/getting-started.md)
- [CLI Reference](docs/cli-reference.md)
- [Roadmap](docs/ROADMAP_V2.md)

## License

MIT
