Skip to content

Examples Overview

Reading API documentation alone rarely provides the complete picture. You need to see how concepts work together in practice, understand common patterns, and learn from real implementations.

If you want to get productive fast:

Learn to build production-ready APIs:

Build interactive applications:

Build complete applications:

We automatically generate documentation from our example files to ensure they’re always up-to-date:

Browse All Auto-Generated Examples →

Highlights from Auto-Generated Collection:

Section titled “Highlights from Auto-Generated Collection:”
Terminal window
# Clone the repository
git clone https://github.com/nijaru/zenith
cd zenith
# Install Zenith
pip install -e .
# Run any example
python examples/00-hello-world.py
Terminal window
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install zenithweb
# Run example
python examples/03-modern-developer-experience.py

Most examples follow this pattern:

from zenith import Zenith
app = Zenith() # Zero-config setup
@app.get("/")
async def root():
return {"message": "Hello World"}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)

Many examples include test code:

Terminal window
# Run the example
python examples/16-testing-patterns.py
# In another terminal, test the API
curl http://localhost:8000/

We welcome new examples! When creating examples:

  1. Keep it focused - One concept per example
  2. Add comments - Explain non-obvious code
  3. Include a docstring - Describe what the example demonstrates
  4. Test it works - Ensure the example runs without errors
  5. Follow conventions - Use consistent style with other examples

After exploring examples:


Examples are the fastest way to learn Zenith. Start with Hello World and build your way up!