axion User Guide
Welcome to the axion documentation. This guide is a practical manual for building web applications with axion, a lightweight, modular, and fast web framework written in Python using native sockets.
axion supports both server-side rendering (Jinja2 templates) and API development (Pydantic validation, DRF-style serializers), with optional out-of-the-box SQLAlchemy database support.
Table of Contents
Start with Getting Started, then follow the topics that match what you are building.
First steps
- Getting Started — install axion, scaffold a project, write your first route, and run the server.
- Routing — routes, path parameters, HTTP methods, async handlers, error handling, and modular routers.
Core concepts
- Request & Response — the
RequestandResponseobjects, sending JSON/HTML, headers, cookies, and status codes. - Middleware — global, path-scoped, and per-route middleware, including callable and hook-object styles.
- Database & ORM — SQLAlchemy models, request-scoped sessions, automatic commits/rollbacks, and dependency injection.
- Serializers — DRF-style request/response serialization with per-field and cross-field validation hooks.
Building a full site
-
Commands & Queries (CQRS) — an application-architecture playbook for separating reads from writes.
- Templates & Static Files — server-side rendering with Jinja2 and serving CSS, JS, and images.
- Security — CSRF protection and CORS.
- Configuration — every framework setting and how to override it.
- Command-Line Interface —
axion startproject,axion run, and hot reloading.
Example Application
A fully working example that demonstrates all of the above is available in the
example/ directory (SSR homepage, a REST API with nested
serializers, middleware in all three styles, and SQLite persistence).
Run it from inside the example directory:
cd example
python main.py
Then open http://127.0.0.1:8000/.
Support
- Report issues and bugs on the issue tracker.
- This project is licensed under the MIT License.