Nexora
A modular Python web framework — MVC + ORM + Middleware + Dependency Injection.
Structure
- core/foundation -> Front Controller, bootstrap
- core/routing -> Router
- core/http -> Request / Response
- core/container -> Dependency Injection
- controllers -> Controllers (MVC)
- views/engine -> View Engine
- views/templates -> Templates
- models -> Models (ORM entities)
- database/connection -> DB connection
- database/query_builder -> Query Builder / DQL
- database/orm -> ORM
- database/migrations -> Migrations
- middleware -> Middleware pipeline
- auth -> Authentication
- validation -> Validation
- session -> Sessions / Cookies
- security/csrf -> CSRF protection
- cli -> CLI tools
- tests -> Testing
- config -> Configuration files
Template engine
Nexora includes its own dependency-free engine in views/engine:
from views.engine import TemplateEngine
views = TemplateEngine()
html = views.render("pages/home.html", {"title": "Accueil", "user": user})
Templates escape variables by default ({{ user.name }}) and support safe,
upper, and lower filters, {% if %}, {% for %}, {% include %}, and
layout inheritance through {% extends %} / {% block %}. Include paths are
resolved from views/templates; parent-template paths are relative to the
template that declares them.
Forms
from forms import EmailField, Form, PasswordField
form = Form(action="/login", csrf_token=request.csrf_token)
form.add(EmailField("email", required=True)).add(PasswordField("password", required=True))
if request.method == "POST" and form.bind(request).is_valid():
authenticate(**form.cleaned_data)
return form.render("Connexion")
Available fields: TextField, EmailField, PasswordField, TextAreaField,
SelectField, CheckboxField, and HiddenField.
Environment
Copy .env.example into a local .env file, then configure the values for your
environment. The .env file is ignored by Git. Configuration can be read with:
from config import env, load_settings
settings = load_settings()
debug = env("APP_DEBUG", cast=bool)
Database
app.bootstrap() exposes the configured database as app.make("database").
The SQLite engine provides safe parameterized queries, nested transactions,
migrations, and a fluent query builder:
users = app.make("database").table("users")
users.insert({"name": "Ada", "age": 36})
active_users = users.where("age", 18, ">=").order_by("name").get()
Create a project
Install Nexora in a virtual environment once, then create an application just as you would with Symfony or Laravel:
cd ~/Bureau/Nexora
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
nexora new my-blog
cd my-blog
nexora serve
Do not use --break-system-packages: Ubuntu protects its system Python through
PEP 668. Without installation, run the local equivalent:
python3 bin/nexora new my-blog.
Use as a Python framework
Nexora exposes a stable public package. Application code should import from
nexora, rather than the internal core, database, or views folders:
from nexora import Application, Request, Response
app = Application().bootstrap()
@app.get("/")
def home(request: Request):
return Response("Hello from Nexora")
After activating the virtual environment, python -m pip install -e . makes
both import nexora and the nexora command available in any project.
For a global installation with pipx, see the installation guide.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nexora_framework-0.1.0.tar.gz.
File metadata
- Download URL: nexora_framework-0.1.0.tar.gz
- Upload date:
- Size: 37.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e76d96da4149ff960bf0b2617131b71a0ded3dbae441d07c5de51bd03ee48a6f
|
|
| MD5 |
3097caa7ed3aa2ffb271ad870553a65f
|
|
| BLAKE2b-256 |
437d771fe0c083cbcbd972a30d0b145400c010acf4f7ffb5ddbac03f5f661aad
|
File details
Details for the file nexora_framework-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nexora_framework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 46.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b046e746eb52f5b1d165c7f5cea2b38406cf02e753deb1a575d546aa4f26c7f6
|
|
| MD5 |
393302c9f2317b21ccc807cfa70f5cbe
|
|
| BLAKE2b-256 |
db8d0fe0589c22970571a0ecdb61ac7723ffc821c232ea0b8e810a249ea5a7dd
|