Skip to main content

Flaxon

flaxon Logo

PyPI version License: MIT Code style: ruff

Principal Author: Aldane Hutchinson

Flaxon is an async-first ASGI framework for JSON APIs, WebSockets, and server-rendered applications. It provides the HTTP boundary; you choose the database, frontend, queue, and deployment platform.

i Would love for other Developers to help me maintain this codebase

Run full test suite well make sure if add or change something it not broken and benchmarks as well .

Status: Production/stable.

it says Stable but am adding things still and api may change a little but not alot.

check out Teloce-py it complier that complies .vel single components to vanilla js for browser serving. is works well with flaxon or flask or any.

Install

Flaxon requires Python 3.11 or newer.

pip install "flaxon[standard]"

standard installs the recommended ASGI server and template dependencies. For framework development, install pip install -e ".[standard,dev]" instead.

Your first API

Create app.py:

from flaxon import Flaxon

app = Flaxon("hello-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"}

Start the development server:

flaxon run app:app --reload

Open http://127.0.0.1:8000/. For a production process, use flaxon run without --reload or run the same ASGI application with Uvicorn.

Validate JSON input

Use Schema parameters for JSON request bodies. Field names use the full *Field spelling.

from flaxon.validation import Schema, fields


class CreateUser(Schema):
    name = fields.StrField(required=True, min_length=2, max_length=80)
    email = fields.EmailField(required=True)
    age = fields.IntField(minimum=13, maximum=120)


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

Available field classes are StrField, IntField, FloatField, BoolField, EmailField, DateField, DateTimeField, DecimalField, UUIDField, ListField, ChoiceField, NestedField, and AnyField.

WebSockets

from flaxon.websocket import WebSocket


@app.websocket("/ws/chat/<room_id>")
async def chat(socket: WebSocket, room_id: str):
    await socket.accept()
    await socket.join(room_id)
    try:
        async for message in socket.iter_json():
            await socket.broadcast_json(room_id, {"event": "chat.message", "data": message})
    finally:
        await socket.leave(room_id)

The default room manager is in-process. Use shared infrastructure for cross-worker or multi-instance broadcasts.

Server-rendered HTML with Jinax

Install the template extra if it is not already included through standard:

pip install "flaxon[templates]"
from flaxon.jinax import Jinax

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


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

Jinax uses Jinja2 autoescaping for HTML templates. Only mark content safe when it has been produced by a trusted sanitizer.

What Flaxon includes

  • HTTP routing, typed path parameters, request parsing, responses, and streams.
  • Schema validation and validation decorators.
  • Middleware for CORS, request IDs, security headers, trusted hosts, body limits, compression, logging, recovery, sessions, and timeouts.
  • Sessions, JWT, API keys, authentication, roles, permissions, CSRF, and rate limiting.
  • WebSocket routes, JSON messaging, rooms, and broadcast helpers.
  • Jinax templates, caching helpers, database adapters/transactions, background tasks, plugins, OpenAPI, GraphQL, health checks, and metrics.
  • TestClient and AsyncWebSocketClient for application tests.
  • Built in admin and Cms and Plugins there some not alot search flaxon and find some plugins.

Documentation and examples

The runnable example applications live in docs/examples/: a basic API, React backend, Android backend, and Jinax site.

Production checklist

  • Set DEBUG=False and a strong FLAXON_SECRET_KEY.
  • Use explicit allowed origins and trusted hosts.
  • Run multiple workers only after moving shared state (sessions, cache, task coordination, and WebSocket fan-out) to durable/shared infrastructure.
  • Run behind TLS and a reverse proxy or managed load balancer.
  • Add database migrations, backups, health checks, metrics, structured logs, and load tests for your deployment topology.

See the deployment guide for the complete checklist.

Contributing

git clone https://github.com/aldanedev-create/Flaxon-Backend-Framework.git
cd Flaxon-Backend-Framework
python -m venv .venv
# Activate the environment, then:
pip install -e ".[standard,dev]"
pytest

Flaxon is released under the MIT License.

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.2.5.tar.gz (344.8 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.2.5-py3-none-any.whl (400.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaxon-0.2.5.tar.gz
  • Upload date:
  • Size: 344.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for flaxon-0.2.5.tar.gz
Algorithm Hash digest
SHA256 983ec85c69665f58e09f256faefc474172d6f270dc331a70dd51d0a40fa6e443
MD5 9df4836e8046fc8d522ff83fb27612e6
BLAKE2b-256 e8a2c7dffc1d45bb4ecfb62dc79bdddd757502d9da16365464e8d2195f069bbe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaxon-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 400.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for flaxon-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 012a5fc620d7c9ee847c26587fab761c00035ce3147da2cf8235a912e5b465e2
MD5 947c0ae2075cbbf950ed0f4465fef458
BLAKE2b-256 b39a3e6b7a4e9467a2ea8261589e41729a761f0e5c6a720941fda4b4cd0c51b4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page