Skip to main content

A technology-neutral, async-first Python backend framework

Project description

Flaxon

A technology-neutral, async-first Python backend framework License Code style: ruff

Flaxon combines Flask-like ease, structured large-application development, async-first networking, readable debugging, optional Jinja2 templates, and complete freedom over your frontend and client technologies.

from flaxon import Flaxon

app = Flaxon("my-api", debug=True)

@app.get("/")
async def home():
    return {"message": "Hello from Flaxon"}

@app.get("/users/<int:user_id>")
async def get_user(user_id: int):
    return {"id": user_id, "name": "Example User"}

Features

  • Async-first ASGI architecture — Built for high-concurrency I/O workloads
  • Flask-style route decorators — Familiar and intuitive
  • Optional modular structure — Start simple, scale to large applications
  • Request validation — Declarative schemas with automatic 422 responses
  • WebSocket support — Real-time communication with room broadcasting
  • Jinax templates — Optional Jinja2 integration (lazy-loaded)
  • Middleware stack — CORS, request IDs, security headers, rate limiting
  • Readable debugger — Explains failures in plain language
  • Technology neutral — Use any frontend, database, ORM, or client
  • CLI tools — Run, inspect, doctor, and generate projects
  • Testing utilities — Sync and async test clients

Quick Start

Installation

pip install flaxon

Or with just the core:

pip install flaxon

Create an application

# app.py
from flaxon import Flaxon

app = Flaxon("hello-world", debug=True)

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

Run it

flaxon run app:app --reload

Visit http://localhost:8000 to see your API.

Documentation

Example: Validation

from flaxon import Flaxon
from flaxon.validation import Schema, fields

app = Flaxon("user-api")

class CreateUser(Schema):
    name = fields.String(required=True, min_length=2)
    email = fields.Email(required=True)
    age = fields.Integer(minimum=13, maximum=120)

@app.post("/users")
async def create_user(data: CreateUser):
    return {"success": True, "user": data.to_dict()}

Example: WebSocket Chat

@app.websocket("/ws/chat/<room_id>")
async def chat(socket, room_id: str):
    await socket.accept()
    await socket.join(room_id)

    async for message in socket.iter_json():
        await socket.broadcast_json(room_id, {
            "event": "chat.message",
            "data": message,
            "room": room_id,
        })

Example: Optional Templates (Jinax)

from flaxon import Flaxon
from flaxon.jinax import Jinax

app = Flaxon("website", debug=True)
app.use_templates(Jinax("templates", auto_reload=True))

@app.get("/")
async def home(request):
    return await request.render("home.html", {
        "title": "Welcome",
        "products": await product_service.list()
    })

Philosophy

Simple applications remain simple; large applications gain structure without losing technology choice.

  • Small applications start in one file without generators or mandatory architecture
  • Large applications can introduce routers, services, middleware, and plugins
  • HTML rendering is optional; JSON APIs are a first-class default
  • Framework APIs are explicit enough to debug and profile without hidden magic

Comparative Overview

Feature Flask Django Node.js Flaxon
Async core ⚠️
Flask-style routing ⚠️
Optional structure ⚠️
WebSocket support ⚠️
Technology neutral
Readable debugging ⚠️ ⚠️ ⚠️
Mobile backend ready ⚠️

Production Readiness

Flaxon is currently in alpha. It is suitable for evaluation, experimentation, and learning. Production use is possible with careful testing and monitoring, but the API is not yet stable.

Roadmap

  • 0.2 — Protocol hardening, multipart uploads, ASGI conformance
  • 0.3 — Sessions, OpenAPI, health checks, logging
  • 0.4 — Plugin system, SQLAlchemy, Redis, authentication
  • 0.5 — Distributed tasks, queues, Redis broadcast
  • 1.0 — Stable API, security audit, production-ready

Contributing

We welcome contributions! Please see our Contributing Guide.

git clone https://github.com/aldanedev-create/Flaxon-Backend-Framework.git
cd Flaxon-Backend-Framework
python -m venv .venv
source .venv/bin/activate
pip install -e ".[standard,dev]"
pytest

License

MIT License — see LICENSE for details.

Community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flaxon-0.1.1.tar.gz (222.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flaxon-0.1.1-py3-none-any.whl (307.8 kB view details)

Uploaded Python 3

File details

Details for the file flaxon-0.1.1.tar.gz.

File metadata

  • Download URL: flaxon-0.1.1.tar.gz
  • Upload date:
  • Size: 222.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for flaxon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9714532f58188bc49ebba4bca9c8e1423d29738203533c2339da3d378b928155
MD5 907bdbf90a1f7ba2b0df562ef5464a58
BLAKE2b-256 64ecf175c53455fc9a1de72e7e0d04a62d8f18cf5f1d4342b9e6f6bdfe9d5f09

See more details on using hashes here.

File details

Details for the file flaxon-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flaxon-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 307.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for flaxon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2876613f5a559998c025264f3859d9f92975b8e49b9c2f2a5fe89be6e481cf26
MD5 622d8776ea24a10205682df93b68749e
BLAKE2b-256 9bc9440dd04606fb4ecd83e1578a2a66c488dc2e2fc3632b35df0848f20e4ef8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page