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.3.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.3-cp314-cp314-win_amd64.whl (527.3 kB view details)

Uploaded CPython 3.14Windows x86-64

astraapi-0.2.3-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.3-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.3-cp314-cp314-macosx_14_0_arm64.whl (952.9 kB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: astraapi-0.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 65768275c1034a925eb1cc4e4f6c9fef83ac99a723e351ff3ca942f68088954e
MD5 32db9122e31b6f2b74bdf593cf832142
BLAKE2b-256 b62a4909ba9a79f1239acebae6c06390ef5dd4cf07e504a3e6632e4a5d837958

See more details on using hashes here.

File details

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

File metadata

  • Download URL: astraapi-0.2.3-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 527.3 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.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 cd52b5615cc115a233a4f43ff770c73dd9b1b3233124fe9dfb09337963ccc844
MD5 171cd42266320998c3e6bc01e1b4880e
BLAKE2b-256 ccda35b6947896dc07e3936725a81e3e9fe1c8062ee005d9b52cee7fcd7d8a26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astraapi-0.2.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 20366fe85c1e571f7c8660648df7837430ffebe6f751e9d6690b0492552c47e5
MD5 9229403c6cf180e525c3e5c317b09cfa
BLAKE2b-256 d0324037642f6be14aa5265ceaf92442edd683112b36567c08dd5f96a9c39b73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astraapi-0.2.3-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b09db8c8a267f4b264c15ef918861361344c620c0ae1e89797b7fece74d9198b
MD5 35454eb1181963deb234ca8f1c81b627
BLAKE2b-256 6e38494c460bb33430bd67617131e8dd1564420df9753f299627b0ff6a63349b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astraapi-0.2.3-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 0b059a3ba240acd15d460aa875b5aa81d40f6f87c80659015489aa8090f57f76
MD5 05eb25c87cb59f3b7e966bdece167582
BLAKE2b-256 7abcfc86476679a57a32fbad91282626840422559c3b41afa70e1544bf18f6c7

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