fastware v0.1.0
On this page

Documentation for fastware, a fast batteries-included ASGI framework built on msgspec (10-75x faster JSON) and Granian (Rust-based server).

#fastware

A fast, batteries-included ASGI framework. The FastAPI alternative.

Current version: 0.1.0

#Install

$_ bash
pip install fastware

#Minimal example

python
from fastware import Router, create_app, serve

router = Router()

@router.get("/hello/{name}")
async def hello(request):
    return {"message": f"Hello, {request.path_params['name']}!"}

app = create_app(router)
serve(app, foreground=True, host="127.0.0.1", port=8000)

Run it and visit http://127.0.0.1:8000/hello/world to see {"message": "Hello, world!"}.

#Features

Features
FeatureDescriptionDocs
Routing and RequestsPath parameters with type coercion, query validation, request body parsing, WebSocket routesCore API
SSE BroadcastingTyped server-sent events with per-client queues and automatic disconnect pruningSSE Guide
Middleware SuiteCORS, request tracing, trusted host, request ID, Vite dev proxy -- all pure ASGIMiddleware API
Auth and SecurityJWT tokens, bcrypt password hashing, CSRF double-submit, role-based access, rate limitingAuth API
Server LifecycleGranian integration with PID files, port checks, background mode, status, and hot reloadServer API
Dependency InjectionPer-request DI with sync/async factories, generator cleanup, caching, and test overridesDI Guide
TestingSync and async test clients wrapping httpx with ASGITransport -- no real server neededTesting API
Migration from FastAPISide-by-side comparison and step-by-step guide for porting FastAPI applicationsMigration Guide

#Why fastware?

  • msgspec for JSON -- 10-75x faster serialization than Pydantic. No schema compilation step, no startup penalty.
  • Granian server included -- Rust-based ASGI server with managed lifecycle, PID files, and signal handling. No need to install or configure a separate server.
  • Batteries included -- SSE broadcasting, dependency injection, authentication, middleware suite, test client, background tasks, and structured logging are all built in.
  • Minimal core dependencies -- The framework core depends only on msgspec and granian. Everything else is opt-in via extras.

#Dependencies

The table below lists all runtime and optional dependencies that fastware can install. The core has only 2 required packages (msgspec for JSON serialization and granian for ASGI serving); all others are opt-in via 6 extras groups (auth, logging, dev, testing, mcp, pydantic) that add specific capabilities without bloating the default install:

Dependencies
PackageVersion Constraint
msgspec>=0.21.1
granian>=2.7.4
[auth]
pyjwt*
bcrypt*
[logging]
structlog*
[dev]
httpx>=0.28
watchfiles*
websockets*
[testing]
httpx>=0.28
[mcp]
mcp*
[pydantic]
pydantic*
[all]
fastware[auth]*
fastware[logging]*
fastware[dev]*
fastware[testing]*
fastware[mcp]*
fastware[pydantic]*

#Project structure

The source tree consists of 20 modules organized by feature area (routing, responses, middleware, SSE, server, auth, DI, testing, and more). Each module is independently importable with no circular dependencies, and optional features use late imports to avoid loading unused packages:

fastware/
├── __init__.py
├── __main__.py
├── app.py
├── audit.py
├── auth.py
├── config.py
├── dev.py
├── di.py
├── error_log.py
├── features.py
├── logging.py
├── mcp.py
├── middleware.py
├── request.py
├── responses.py
├── routing.py
├── server.py
├── sse.py
├── tasks.py
├── testing.py
├── types.py
└── websocket.py