Catzilla Documentation

Catzilla - The FastAPI Killer | Lightning Fast Python Web Framework

The fastest Python web framework with C-accelerated routing and async/sync hybrid support

PyPI Version Python Versions Build Status

Catzilla is a modern Python web framework that delivers exceptional performance through its C-accelerated routing engine powered by libuv. Built for developers who demand both speed and simplicity.

πŸš€ Key Features

  • 🏎️ C-Accelerated Routing - Ultra-fast trie-based routing with O(log n) performance

  • ⚑ Async/Sync Hybrid - Seamlessly mix async and sync handlers with automatic detection

  • πŸ“¦ Zero-Copy Operations - Memory-efficient request handling with minimal allocations

  • πŸ” Auto-Validation - Pydantic-compatible models with C-accelerated validation

  • πŸ”— Advanced DI System - Powerful dependency injection with multiple scopes

  • πŸ—„οΈ Multi-Layer Caching - Memory, Redis, and disk caching with intelligent fallbacks

  • πŸ“‘ Streaming Support - Server-sent events and chunked responses

  • πŸ“ File Handling - Optimized upload/download with image processing

  • πŸ”§ Background Tasks - Async task scheduling and monitoring

  • πŸ›‘οΈ Production Ready - Built-in security, monitoring, and error handling

Quick Start

Installation

pip install catzilla

Hello World

from catzilla import Catzilla, JSONResponse

app = Catzilla()

@app.get("/")
def home(request):
    return JSONResponse({"message": "Hello, World!"})

if __name__ == "__main__":
    app.listen(port=8000)

Async/Sync Hybrid Example

from catzilla import Catzilla, JSONResponse, BaseModel
import asyncio

app = Catzilla()

# Sync handler (runs in thread pool)
@app.get("/sync")
def sync_handler(request):
    return JSONResponse({"type": "sync"})

# Async handler (runs in event loop)
@app.get("/async")
async def async_handler(request):
    await asyncio.sleep(0.1)  # Non-blocking I/O
    return JSONResponse({"type": "async"})

class User(BaseModel):
    name: str
    email: str

# Auto-validation with BaseModel
@app.post("/users")
def create_user(request, user: User):
    return JSONResponse({
        "user": {
            "name": user.name,
            "email": user.email
        }
    })

if __name__ == "__main__":
    app.listen(port=8000)

Documentation Structure

Community & Support

License

Catzilla is released under the MIT License. See the LICENSE file for details.

Why Choose Catzilla?

πŸƒβ€β™‚οΈ Migrate from FastAPI in Minutes

Catzilla’s API is designed for seamless FastAPI migration:

# FastAPI code works with minimal changes
from catzilla import Catzilla, BaseModel, JSONResponse  # Just change the import

app = Catzilla()  # Instead of FastAPI()

# Everything else works the same!

πŸš€ Get Exceptional Performance Instantly

No code changes needed - just install Catzilla and watch your API fly!

πŸ”§ Production-Grade Features Out of the Box

  • Built-in caching

  • Background task processing

  • Advanced dependency injection

  • File upload handling

  • Streaming responses

  • Authentication patterns

  • Performance monitoring

Ready to supercharge your Python API? Let’s get started! πŸš€