Skip to main content

AstraAPI framework, high performance, easy to learn, fast to code, ready for production

Project description

AstraAPI

AstraAPI

FastAPI-compatible. C++ core. Built-in workers. No gunicorn needed.

PyPI License Python C++20


AstraAPI is a drop-in replacement for FastAPI with a compiled C++20 core. Same decorators. Same Pydantic models. Same OpenAPI docs. But 5-10x faster — no external server required.

from astraapi import AstraAPI

app = AstraAPI()

@app.get("/")
def hello():
    return {"message": "Hello World"}

if __name__ == "__main__":
    app.run(port=8000, workers=4)

Output:

C++ HTTP server running on http://127.0.0.1:8000
Press Ctrl+C to stop

Why AstraAPI?

FastAPI + Uvicorn AstraAPI
HTTP parser httptools (Python) llhttp (C++, Node.js)
JSON orjson yyjson + SIMD serializer
Workers gunicorn/uvicorn Built-in fork/spawn
Keep-alive Per-connection timers Batch sweep
Compression zlib libdeflate (2-3x faster)
Throughput ~45k req/s ~236k req/s

Install

pip install astraapi

Python 3.14+

Quick Start

python -m astraapi --help

Or write a file:

from astraapi import AstraAPI
from pydantic import BaseModel

app = AstraAPI()

class Item(BaseModel):
    name: str
    price: float

@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}

@app.post("/items/")
def create_item(item: Item):
    return item

if __name__ == "__main__":
    app.run(port=8000, workers=4)

Features

  • 100% FastAPI compatible — same @app.get, Depends, BaseModel, Query, Path, File, UploadFile, WebSocket, BackgroundTasks
  • Built-in multi-worker serverSO_REUSEPORT, CPU affinity, auto-restart. No gunicorn.
  • C++ HTTP core — llhttp parser, radix trie router, yyjson, SIMD string escape, ryu float formatting
  • Zero-copy transport — direct send() for small responses, writev() for WebSockets
  • Native middleware — CORS, GZip (libdeflate), TrustedHost, HTTPSRedirect, RateLimiting
  • Real TestClient — starts actual C++ HTTP server on ephemeral port
  • Hot reloadapp.run(reload=True) watches files via watchfiles

Documentation

Visit https://astraapi.dev or the docs folder.

License

MIT — see LICENSE.

Made with ⚡ by Lumos Labs HQ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astraapi-0.2.11.tar.gz (3.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

astraapi-0.2.11-cp314-cp314-win_amd64.whl (514.5 kB view details)

Uploaded CPython 3.14Windows x86-64

astraapi-0.2.11-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

astraapi-0.2.11-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

astraapi-0.2.11-cp314-cp314-macosx_14_0_arm64.whl (944.3 kB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

File details

Details for the file astraapi-0.2.11.tar.gz.

File metadata

  • Download URL: astraapi-0.2.11.tar.gz
  • Upload date:
  • Size: 3.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for astraapi-0.2.11.tar.gz
Algorithm Hash digest
SHA256 36d85689cab20438b59cb705e3efb6e2b0f5954e7d614ff3b8292dc03bce3419
MD5 df429782692f61ae965e213c2a38b809
BLAKE2b-256 7ea7448fa02037eac8bac7b81b4e7ba73841cdc03904af316ecdd45a5b9280fe

See more details on using hashes here.

File details

Details for the file astraapi-0.2.11-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: astraapi-0.2.11-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 514.5 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for astraapi-0.2.11-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3461686ecf471e8c52fb548eef2ec10d71023e9a849b9a5494dfbe1bfa3b700f
MD5 009638d8e725e827ad4a08e626652333
BLAKE2b-256 ef7726252251ec4802f34c3e4146b9107530de77c8ea587885cb6ca47ab9f890

See more details on using hashes here.

File details

Details for the file astraapi-0.2.11-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for astraapi-0.2.11-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c461f0a9682e15d839a6708292a883381647ba0830f73af25fe08dea2f20f71
MD5 9110197ad79dc4b0295b1fb80309eb63
BLAKE2b-256 a03f53c0f5de6c8b44bbd661fb117942914e2c57e173ed8eb5b67a97e47fb3fc

See more details on using hashes here.

File details

Details for the file astraapi-0.2.11-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for astraapi-0.2.11-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 db2f52fbc131310886e19bb96b26d52b0fa0914cdae0c4b6bda12fa490b4fe23
MD5 33abd7d1b5392f5ba2f54731af8c2bad
BLAKE2b-256 a7e0d6c3e338814f1f529a9d55db77b9bc30d4bdb68df0c5b6c850df903005e1

See more details on using hashes here.

File details

Details for the file astraapi-0.2.11-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for astraapi-0.2.11-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d379312ea68eccfdb15725e61af23802f239f31d6eabbaa11ac3f72ce6ae7723
MD5 792352cb81bafe30abecd5a0a1f9732d
BLAKE2b-256 b5bc2d7ae20cd1adffb19fa2e2ea57cc3a211fc11dbb0034a19c64c8dbb963be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page