Zenith Framework

A modern Python web framework with intuitive developer experience and exceptional performance.
π― Modern DX: Zero-config setup, database models with chainable queries, one-liner features, and clean architecture patterns - making Python web development incredibly productive.
What is Zenith?
Zenith brings together exceptional productivity, outstanding performance, and full type safety:
- π Zero-config setup -
app = Zenith() just works with intelligent defaults
- ποΈ Intuitive models -
User.where(active=True).order_by('-created_at').limit(10)
- β‘ One-liner features -
app.add_auth(), app.add_admin(), app.add_api()
- π― Enhanced DX - No session management, ZenithModel handles it automatically
- ποΈ High performance - Fast async architecture with production-tested throughput
- π‘οΈ Production-ready - Security, monitoring, and middleware built-in
π Zero-Config Quick Start
pip install zenithweb
from zenith import Zenith
from zenith import Session
from zenith.db import ZenithModel
from sqlmodel import Field
from pydantic import BaseModel
from typing import Optional
app = Zenith()
app.add_auth()
app.add_admin()
app.add_api("My API", "1.0.0")
class User(ZenithModel, table=True):
id: Optional[int] = Field(primary_key=True)
name: str = Field(max_length=100)
email: str = Field(unique=True)
active: bool = Field(default=True)
class UserCreate(BaseModel):
name: str
email: str
active: bool = True
@app.get("/")
async def home():
return {"message": "Modern DX in Python!"}
@app.get("/users")
async def list_users():
users = await User.where(active=True).order_by('-id').limit(10).all()
return {"users": [user.model_dump() for user in users]}
@app.post("/users")
async def create_user(user_data: UserCreate):
user = await User.create(**user_data.model_dump())
return {"user": user.model_dump()}
@app.get("/users/{user_id}")
async def get_user(user_id: int):
user = await User.find_or_404(user_id)
return {"user": user.model_dump()}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)
Run with:
uvicorn main:app --reload
π― Modern DX Features
π Zero-Config Setup (for Development)
app = Zenith()
- Intelligent defaults - Development uses SQLite, auto-generated dev keys
- Production ready - Set
DATABASE_URL and SECRET_KEY env vars for production
- Automatic middleware - Security, CORS, logging configured automatically
- Environment-aware - Uses
ZENITH_ENV or intelligent detection
ποΈ Intuitive Database Models
users = await User.where(active=True).order_by('-created_at').limit(10).all()
user = await User.find_or_404(123)
user = await User.create(name="Alice", email="alice@example.com")
- ZenithModel - Modern ORM with chainable queries
- Automatic sessions - No manual database session management
- Type-safe queries - Full async support with SQLModel integration
β‘ One-Liner Features
app.add_auth()
app.add_admin()
app.add_api()
- Instant features - Complex functionality in single lines
- Production-ready - Each feature includes monitoring and security
- Configurable - Sensible defaults with full customization options
π― Clean Dependency Injection
@app.get("/users")
async def get_users(session: AsyncSession = Session):
users = await User.all()
return users
- Simple patterns -
Session for database, Auth for current user
- Service injection -
Inject(ServiceClass) for business logic
- Type-safe - Full IDE support and autocompletion
ποΈ High Performance
- Fast async architecture - Thousands of requests per second
- Production-tested - Comprehensive benchmark suite validates throughput
- Async-first - Full async/await with Python 3.12+ optimizations
- Optimized - Connection pooling, slotted classes, efficient middleware
π‘οΈ Production-Ready
- Security by default - CSRF, CORS, security headers automatic
- Built-in monitoring -
/health, /metrics, request tracing
- Error handling - Structured errors with proper HTTP status codes
- Testing framework - Comprehensive testing utilities included
π Full-Stack Support
- Serve SPAs (React, Vue, SolidJS) with
app.spa("dist")
- WebSocket support with connection management
- Static file serving with caching
- Database integration with async SQLAlchemy
π Project Structure
Clean organization with zero configuration:
your-app/
βββ main.py # app = Zenith() + routes
βββ models.py # ZenithModel classes
βββ services.py # Business logic (optional)
βββ migrations/ # Database migrations (auto-generated)
βββ tests/ # Testing with built-in TestClient
Or traditional clean architecture:
your-app/
βββ main.py # Application entry point
βββ models/ # ZenithModel classes
βββ services/ # Service classes with @Service decorator
βββ routes/ # Route modules (optional)
βββ middleware/ # Custom middleware
βββ tests/ # Comprehensive test suite
Performance
Zenith delivers high-performance async request handling with production-tested throughput.
Run your own benchmarks:
uv run pytest tests/performance/ -v
The framework is optimized with connection pooling, slotted classes, and efficient middleware. Performance varies by hardware, middleware configuration, and application complexity.
Documentation
π Examples
π₯ Modern DX Examples:
π Complete Examples:
CLI Tools
zen new my-api
zen keygen
zen config --all
zen generate model User
zen generate service UserService
zen generate graphql UserSchema
zen dev
zen serve --workers 4
Installation
pip install zenithweb
pip install "zenithweb[production]"
pip install "zenithweb[dev]"
Production Deployment
Docker
FROM python:3.12-slim
WORKDIR /app
COPY . .
RUN pip install "zenithweb[production]"
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Environment Configuration
from zenith import Zenith
app = Zenith()
from zenith.config import Config
app = Zenith(
config=Config(
database_url=os.getenv("DATABASE_URL"),
redis_url=os.getenv("REDIS_URL"),
secret_key=os.getenv("SECRET_KEY")
)
)
Contributing
We welcome contributions! Please see our Contributing Guide.
git clone https://github.com/nijaru/zenith.git
cd zenith
pip install -e ".[dev]"
pytest
Status
Latest Version: v0.0.11
Python Support: 3.12-3.14
Test Suite: 100% passing (899 tests)
Performance: High-performance async architecture with production-tested throughput
Architecture: Clean separation with Service system and simple dependency patterns
Zenith is production-ready with comprehensive middleware, performance optimizations, and clean architecture patterns for modern Python applications.
License
MIT License. See LICENSE for details.