Skip to content
fastware
Edit
On this page

#fastware

A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client

Current version: 0.6.3

#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,<3.0
strictcli>=0.41.0
[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
├── _assets/
├── _assets.py
├── _fswrite.py
├── _scope.py
├── app.py
├── audit.py
├── auth.py
├── cli.py
├── config.py
├── dev.py
├── devconfig.py
├── di.py
├── error_log.py
├── features.py
├── logging.py
├── mcp.py
├── middleware.py
├── request.py
├── responses.py
├── routing.py
├── server.py
├── sse.py
├── supervise.py
├── tasks.py
├── testing.py
├── types.py
└── websocket.py

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search