Skip to content

Patera logo

Patera

Patera is a modular, async-first ASGI web framework for Python with a structure inspired by Java frameworks: class-based controllers, decorators for routing and HTTP semantics, dependency injection of application services, and typed configuration objects.

from pydantic import BaseModel

from patera import HttpStatus, MediaType, Request, Response
from patera.controller import Controller, consumes, get, path, post, produces

from app import App


class Greeting(BaseModel):
    name: str


@path("/api/v1/greetings")
class GreetingApi(Controller[App]):
    @get("/")
    async def hello(self, req: Request) -> Response:
        return req.res.json({"message": "Hello, World!"})

    @post("/")
    @consumes(MediaType.APPLICATION_JSON)
    @produces(MediaType.APPLICATION_JSON, HttpStatus.CREATED)
    async def greet(self, req: Request, greeting: Greeting) -> Response:
        return req.res.json({"message": f"Hello, {greeting.name}!"})

Beta

Patera is in beta. Until version 1.0, a minor release may contain breaking changes; each one is listed in the changelog. The AI interface and the desktop packages are experimental.

What is included

The core package (patera) handles:

Optional extension packages add SQL databases, migrations, authentication, caching, scheduled tasks, e-mail, declarative API clients, JoltUI server components, an admin dashboard, an AI interface and desktop applications.

Where to start

  • Getting started

    Install Patera and build your first application in a few minutes.

  • Guide

    Every core feature explained with examples: controllers, services, middleware and more.

  • Extensions

    Databases, authentication, caching, task scheduling, admin and more.

  • Reference

    Configuration options, CLI commands and the Python API.

Requirements

  • Python 3.13 or newer
  • Any ASGI server; patera dev uses Uvicorn and patera prod uses Granian

License

Patera and its extension packages are released under the MIT License.