Skip to main content

NexusServer

A lightweight, pure-Python HTTP server and web framework: routing, middleware, cookies, sessions, SQLite helpers. No dependencies beyond the standard library.

Version 26.2.0 (see CHANGELOG) · Python 3.9+ · MIT

Install

pip install -e .

Quick start

from nexusserver import Application

app = Application()

@app.get("/")
def index(request):
    return "Hello, world!"

if __name__ == "__main__":
    app.run()

Run it with the CLI (the target is module:attribute):

python -m nexusserver examples.hello_server:app --port 8080
# or, after pip install:
nexusserver examples.hello_server:app --port 8080

Features

  • Threaded HTTP/1.1 server (one request per connection)
  • Decorator routing with <int:id>, <str:name>, <path:rest>
  • Handlers return str, bytes, dict/list (JSON), Response, or (body, status[, headers])
  • Middleware: CORS, security headers, sessions, gzip, request logging (+ your own)
  • Cookies, form and JSON bodies, query strings
  • SQLite helper with one-shot, idempotent migrations
  • Static file helpers with path-traversal protection

Documentation

Guide Covers
Getting started Install, first app, CLI, running tests
Routing Paths, converters, methods, HEAD/405 behaviour
Requests and responses Request API, return values, cookies, errors
Middleware Built-ins, options, ordering, writing your own
Database SQLite, migrations, threading
Configuration Config fields and CLI flags
Limitations What it does not do yet, production notes

Examples

All in examples/, each runnable with python -m nexusserver examples.<name>:app:

File Shows
hello_server.py Minimal app
routes.py Path params, query strings, redirects, custom status/headers
json_api.py In-memory CRUD with GET/POST/PUT/DELETE and validation
static_site.py Safe static file serving
database_app.py Basic SQLite usage
sessions_app.py Sessions, login/logout
middleware_app.py Configured CORS + gzip and a custom middleware
notes_api.py Everything together: migrations, lifecycle hooks, CORS, validation

Tests

pip install pytest
pytest

pypi-AgEIcHlwaS5vcmcCJGNjN2MyODg1LTNkNDQtNDlhMS05NGNhLWM2YzBlNGZkNTdhOQACKlszLCIwYWUwZTUyNi04YWZjLTRmNjMtOGQ0Yy01Yjc5NWUxNjFlODgiXQAABiC-8FJ1b5b0XxmJs8JSqMtzvkRMZNr6S_DNj51gbBB69Q

pypi-AgENdGVzdC5weXBpLm9yZwIkYTc1MzA2NWYtMDdjMi00YWI0LThjMzUtZTViMzI0NWFlNTczAAIqWzMsImNmOGYxMDM3LWYzYTgtNGQ2OS04YjgxLWZlZWFhOTY2NjNhOCJdAAAGIO1A8STfMWdTusfzQ-RiGKSyhosPK4lVE5X34uTbq-bo

$secureToken = Read-Host "pypi-AgENdGVzdC5weXBpLm9yZwIkYTc1MzA2NWYtMDdjMi00YWI0LThjMzUtZTViMzI0NWFlNTczAAIqWzMsImNmOGYxMDM3LWYzYTgtNGQ2OS04YjgxLWZlZWFhOTY2NjNhOCJdAAAGIO1A8STfMWdTusfzQ-RiGKSyhosPK4lVE5X34uTbq-bo" -AsSecureString $env:TWINE_USERNAME = "token" $env:TWINE_PASSWORD = [System.Net.NetworkCredential]::new("", $secureToken).Password

python -m twine upload --verbose --repository testpypi dist/*

Remove-Item Env:TWINE_USERNAME -ErrorAction SilentlyContinue Remove-Item Env:TWINE_PASSWORD -ErrorAction SilentlyContinue Remove-Variable secureToken -ErrorAction SilentlyContinue

Metadata

Release files for nexusserver 26.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexusserver 26.2.0
File Size Uploaded Provenance Actions
nexusserver-26.2.0.tar.gz 26.1 kB Without provenance Details for nexusserver-26.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nexusserver 26.2.0
File Interpreter ABI Platform Actions
nexusserver-26.2.0-py3-none-any.whl Python 3 none any Details for nexusserver-26.2.0-py3-none-any.whl

Total release size: 56.2 kB

Release files / nexusserver-26.2.0.tar.gz

Download URL nexusserver-26.2.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
633172e76a50de1d2e180723f5305dfa65c189cb32be0d9f307c1fbf44c1fa16
BLAKE2b-256 checksum
How to use checksums
01124f0f4660e6edfefc1bf11a4525e4a52c2d51e70d5b2146a0193dc0c1f22d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / nexusserver-26.2.0-py3-none-any.whl

Download URL nexusserver-26.2.0-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9eb9b971e6ee60c39d04bbf8826a199a8fdea75a5dd30d48a7a6a5d9c241fe3d
BLAKE2b-256 checksum
How to use checksums
cab815b7753ade045a0fd411d68ea17ff7f7f40997883e41a9c68b077437f04f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for nexusserver 26.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

26.2.0 This release

2 release files No provenance

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