Skip to content

Zenith Framework

A Python web framework with built-in authentication, database models, and API documentation

Zenith is a batteries-included Python web framework designed for building production-ready APIs quickly.

from zenith import Zenith
from zenith.db import ZenithModel
from sqlmodel import Field
from typing import Optional
# Create application with automatic configuration
app = Zenith()
# Optional: Add built-in features
app.add_auth() # JWT authentication
app.add_admin() # Admin dashboard
app.add_api("My API", "1.0.0") # Adds /docs and /redoc endpoints
# Define models with intuitive query methods
class User(ZenithModel, table=True):
id: Optional[int] = Field(primary_key=True)
email: str = Field(unique=True, index=True)
name: str
# Create endpoints with automatic session management
@app.post("/users")
async def create_user(email: str, name: str):
user = await User.create(email=email, name=name)
return {"user": user.model_dump()}
@app.get("/users")
async def list_users():
users = await User.all()
return {"users": [u.model_dump() for u in users]}

Automatic Configuration

Zero-config setup with intelligent defaults for development and production environments.

ZenithModel

Enhanced SQLModel with chainable queries, automatic sessions, and intuitive database methods.

Built-in Features

One-line setup for authentication, admin dashboards, and API documentation.

Type Safety

Full type hints and Pydantic validation throughout the framework.

Zenith comes with everything you need for production APIs:

  • ZenithModel: Enhanced SQLModel with intuitive query methods
  • Automatic sessions: Request-scoped database sessions
  • Built-in serialization: Pydantic’s model_dump() method
  • Migration support: Alembic integration
  • JWT authentication: app.add_auth() for complete auth system
  • Password hashing: Argon2 password hashing (modern, secure)
  • Security middleware: CORS, CSRF, security headers
  • Interactive documentation: Auto-generated Swagger UI and ReDoc
  • Admin dashboard: app.add_admin() for system monitoring
  • Hot reload: Development server with automatic reloading
  • CLI tools: Project generation and management
  • High performance: Fast async architecture with production-tested throughput
  • Automatic middleware: Production-ready CORS, rate limiting, logging
  • Environment detection: Development vs production configuration
  • Health checks: Built-in monitoring endpoints
Terminal window
# Install Zenith
pip install zenithweb
# Create a new project
zen new my-api
cd my-api
# Start development server
zen dev

Here’s a complete task API with authentication:

from zenith import Zenith
from zenith.db import ZenithModel
from zenith import Auth
from sqlmodel import Field
from typing import Optional
from datetime import datetime
app = Zenith()
app.add_auth()
app.add_admin()
app.add_api("Task API", "1.0.0") # Interactive docs at /docs
class Task(ZenithModel, table=True):
id: Optional[int] = Field(primary_key=True)
title: str
completed: bool = Field(default=False)
user_id: int
created_at: datetime = Field(default_factory=datetime.now)
@app.get("/tasks")
async def list_tasks(user=Auth):
"""List tasks for authenticated user."""
tasks = await Task.where(user_id=user.id).all()
return {"tasks": [t.model_dump() for t in tasks]}
@app.post("/tasks")
async def create_task(title: str, user=Auth):
"""Create a new task."""
task = await Task.create(title=title, user_id=user.id)
return {"task": task.model_dump()}
@app.patch("/tasks/{task_id}/complete")
async def complete_task(task_id: int, user=Auth):
"""Mark task as completed."""
task = await Task.find_or_404(task_id)
await task.update(completed=True)
return {"task": task.model_dump()}

This gives you:

  • JWT authentication at /auth/login
  • Protected endpoints with user=Auth
  • Admin dashboard at /admin
  • Interactive docs at /docs
  • Automatic database sessions and transactions
  • Type-safe request/response handling

Zenith provides sensible defaults that work out of the box while remaining fully customizable when needed.

Every API is designed to be intuitive, with helpful error messages and excellent IDE support.

Built-in security, monitoring, and performance features ensure your APIs are ready for production.

While opinionated about structure, Zenith doesn’t lock you in - use any database, cache, or external service.

  • High throughput: 12,000+ requests per second
  • Low latency: Sub-millisecond response times
  • Memory efficient: Optimized for concurrent requests
  • Async throughout: Non-blocking I/O for better scalability

Ready to build your next API? Check out our Quick Start Guide or explore the Tutorial for a step-by-step walkthrough.

  • GitHub: github.com/nijaru/zenith
  • Issues: Report bugs and request features
  • Discussions: Get help and share your projects