Examples & Recipes¶
Learn by doing
Every example below is a complete, runnable application. Clone the repo, pick a recipe, and have it running in seconds. Examples are organized by difficulty so you can progress at your own pace.
Run an Example¶
Get any example running in under a minute.
# Clone the repository
git clone https://github.com/jagadeesh32/cello.git
cd cello
# Set up the environment
python -m venv .venv && source .venv/bin/activate
pip install -e .
# Run any example
python examples/hello.py
Live reload for development
Add --reload to automatically restart when you edit the file:
Beginner¶
Start here if you are new to Cello. These examples cover the fundamentals with minimal code.
-
Hello World
Beginner { .md-tag }
The simplest possible Cello app -- one route, one response. Understand the core pattern that every Cello application follows.
Features used:
App@app.get()dict response -
REST API
Beginner { .md-tag }
Build a complete CRUD API with JSON validation, proper status codes, and error handling. The bread and butter of web development.
Features used:
BlueprintResponse.json()request.json()status codes -
Form Handling
Beginner { .md-tag }
Accept form submissions and file uploads with multipart support. Covers both URL-encoded forms and file uploads.
Features used:
request.form()multipartfile uploads
Intermediate¶
Ready to build real applications? These examples combine multiple Cello features into production-worthy patterns.
-
Full-Stack App
Intermediate { .md-tag }
A complete web application with HTML templates, static file serving, form handling, and database integration. Everything you need for a traditional web app.
Features used:
TemplatesStatic filesSessionsBlueprintsCSRF -
Microservices
Intermediate { .md-tag }
Break your application into independent services that communicate via HTTP and message queues. Includes service discovery and health checks.
Features used:
gRPCMessage queuesHealth checksCircuit breakerOpenTelemetry -
Real-time Dashboard
Intermediate { .md-tag }
Live-updating dashboard using WebSocket and Server-Sent Events. Push data to connected clients in real time with automatic reconnection.
Features used:
WebSocketSSEBackground tasksPrometheus metrics
Enterprise¶
Battle-tested patterns for large-scale production systems. These examples demonstrate how Cello handles the complexity of enterprise software.
-
Multi-tenant SaaS
Advanced { .md-tag }
Tenant isolation at the middleware level with per-tenant databases, RBAC, and custom domain routing. The foundation for any SaaS product.
Features used:
Guards (RBAC)MiddlewareJWTDependency injectionData partitioning -
API Gateway
Advanced { .md-tag }
A centralized API gateway with authentication, rate limiting, request transformation, and upstream load balancing. Control all traffic in one place.
Features used:
Rate limitingJWT authCORSCircuit breakerPrometheusRequest ID tracing -
Event Sourcing
Advanced { .md-tag }
Event-driven architecture with CQRS, an append-only event store, and the Saga pattern for distributed transaction coordination.
Features used:
Event storeCQRSSaga patternBackground tasksMessage queues
Example Architecture¶
How Cello's features layer together in a typical application.
graph LR
A[Client Request] --> B[Middleware Pipeline]
B --> C{Router}
C -->|Blueprint A| D[Auth Guards]
C -->|Blueprint B| E[Public Handler]
D --> F[Handler + DI]
F --> G[Response]
E --> G
G --> H[Middleware Pipeline]
H --> I[Client Response]
style A fill:#1A1A1A,stroke:#E65100,color:#FF9100
style I fill:#1A1A1A,stroke:#E65100,color:#FF9100
style C fill:#1A1A1A,stroke:#E65100,color:#FF9100
style D fill:#1A1A1A,stroke:#424242,color:#ab47bc Feature Matrix¶
Which features are demonstrated in each example?
| Feature | Hello World | REST API | Forms | Full-Stack | Microservices | Dashboard | SaaS | Gateway | Events |
|---|---|---|---|---|---|---|---|---|---|
| Routing | |||||||||
| Blueprints | |||||||||
| Middleware | |||||||||
| Guards / RBAC | |||||||||
| JWT Auth | |||||||||
| WebSocket / SSE | |||||||||
| Dependency Injection | |||||||||
| Background Tasks | |||||||||
| Prometheus Metrics |
More Examples¶
Browse the full collection of examples in the GitHub repository. Contributions are welcome -- see the Contributing Guide to add your own example.