Flameo.

A fast, flexible, less verbose
Python framework

Standard (request, response) handlers, managed database and cache pools and included batteries. The same code runs on Granian’s RSGI and on Uvicorn/Hypercorn’s ASGI.

$ pip install flameo
Python 3.10 – 3.15 ASGI · RSGI v0.1.1 MIT License
main.py
from flameo import Flameo

app = Flameo()

@app.get("/")
async def home(req, res):
    await res.json({"message": "Hello from Flameo 🔥"})

Why Flameo

Built for speed and clarity.

01

Faster by design 🚀

Flameo speaks Granian's native RSGI protocol and also supports Uvicorn/Hypercorn's ASGI protocol. On benchmark it beats the likes of FastAPI, Robyn and Sanic.

02

Named dependencies, not plumbing

Type db, cache, app or state in the handler signature and the managed object arrives.

03

No framework under the framework

The core framework depends only on orjson, pydantic and uvloop (on Linux and macOS). No Starlette, no ASGI toolkit, no wrapper around a wrapper. What you write is what you debug.

04

Batteries included

Managed DB and cache pools, pydantic validation with file uploads, sessions, static files, templates, rate limiting, compression, CORS and OpenAPI docs all out of the box.

Less Verbose

Ask for it by name.

Add db, cache, app or state to a handler and Flameo injects the managed handle. No reaching through req.app.state, no manual pool setup required across PostgreSQL, MySQL, Oracle, SQLite, MongoDB.
cache works seamlessly both with and without Redis

@app.get("/users")
async def get_users(req, res, db):
    rows = await db.fetch("SELECT id, name FROM users")
    await res.json(rows)

db, cache and state can coexist. You can also add other dependencies on your own.

Request validation

One model. JSON or multipart.

In Flameo, pydantic validation also works with files. The same request object can hold File fields.

main.py
from pydantic import BaseModel
from flameo import File

class Product(BaseModel):
    title: str
    price: float
    photo: File
    description: str

@app.post("/listings")
async def create_listing(data: Product, res):
    #your logic here
    await res.json({"title": data.title, "photo": data.photo.filename}, status=201)

You can also include Optional[File], List[File] or even nested models.

Flexible Handler Styles

Decorate it or register it later.

Views don't have to live inside your app file. Define them in any module, import them into your app and register them by name. Clean code, with setup kept apart from request logic.

app.py
from flameo import Flameo

app = Flameo()

@app.get("/hello")
async def hello(req, res):
    await res.json({"message": "Hello from Flameo 🔥"})
or
views.py
async def hello(req, res):
    await res.json({"message": "Hello again"})
app.py
from flameo import Flameo
from views import *

app = Flameo()

app.get("/hello", hello)

Both works. You can also write the two types in the same file.

Features

Everything you need, already included

without the hassle of assembling packages or writing glue code yourself

⛓️

Built-in and Custom Middlewares

Global, router and per-route, sync or async.

💉

Built-in Dependency injection

db, cache, app and state parameters.

✅

Pydantic Validation with Files

Pydantic request bodies and uploaded files with structured errors.

🧰

Interactive CLI

Project scaffolding, router generation and a Granian RSGI runner.

🖼️

Template rendering

Built in with Jinja2.

📁

Static files Serving

Built-in serving with ETag and cache validators.

🗜️

Built-in Compression

Out of the box with gzip, deflate, Brotli and Zstandard.

⚡

Response Caching

Built in both with and without Redis, with framework-managed pools.

🚦

Rate limiting

Per endpoint or per key.

🧭

Lifecycle

Startup and shutdown hooks.

🍪

Sessions and CORS

Signed cookies and configurable CORS.

🗄️

Databases

Framework-managed pools for PostgreSQL, MySQL, Oracle, SQLite and MongoDB.

📚

API docs

OpenAPI with Swagger UI and ReDoc.

🌊

Response Streaming

Chunked responses and Server-Sent Events.

📝

Logger

Built-in logging with exact point of source.

Quick Start

Up and running in minutes.

From install to running app in three steps

1

Install


pip install flameo
2

Create a Project


flameo startproject myproject
# cd myproject
3

Run with CLI


#Granian RSGI
flameo run main:app

#uvicorn ASGI
uvicorn main:app
Optional extras

Install only what you need.

ExtraAdds
postgresPostgreSQL driver (asyncpg)
mysqlMySQL driver (asyncmy + cryptography)
oracleOracle driver (oracledb)
sqliteSQLite driver (aiosqlite)
mongoMongoDB driver (pymongo)
databaseAll five database drivers
cacheRedis client support (works with Redis, Valkey and Dragonfly)
templatesJinja2 template rendering
compressionBrotli and Zstandard codecs
testTest and development dependencies
License

MIT License

Distributed under the MIT License.

Star on GitHub