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

Uploaded CPython 3.14Windows x86-64

astraapi-0.2.1-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.1-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.1-cp314-cp314-macosx_14_0_arm64.whl (943.5 kB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: astraapi-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 48911924a96a5703729ed054b88e91ce008c2d055a81acdd3908d176727fa8a7
MD5 c3c0f0efef2c08d656dc618bc8ec1f4b
BLAKE2b-256 cb98db30d2150e8880f3b529bae915b7ab0f96e45d340b40299836616703fd84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: astraapi-0.2.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 513.6 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.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 8594f334914986f75d10be48d158eb9eec14d6168304260b80eb09d838595695
MD5 84b4f6c5b0085336e24b49f3e67b7ff8
BLAKE2b-256 8dcfdb1eaf862dbff87cee219e8f53e08799e7a61064ac09720c5c5daf906447

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astraapi-0.2.1-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 115071fe94fc031ae9647d2863f40a3e04cf02ddf831d0bd14ab26e2c419b9e2
MD5 11f960691ce4594d39f43adb5e05eb9c
BLAKE2b-256 bcadf04bc8f8817c7874d0a594bdd87708996add959857c63174cd3b41735b43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astraapi-0.2.1-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1ae3a0a9b3f709810b67aeb998344e2c4b5b88ff018676d594ebb456fc062359
MD5 79d401d8d6f1226420e63c3c544b85fd
BLAKE2b-256 96c3aec1395169a92dafe005777644eea4a5109e3d09ef9997d3fd40ab991acb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astraapi-0.2.1-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 0dca17e537f34e786f077e3b19dee5ab26845a44ad7811a0a60e7e70044c6d74
MD5 99017dda1bcc040f56cd3ac2a021cf68
BLAKE2b-256 0f188b3eef1b520cce28bf1627fa45a6521100877f0b9aaa8fc6167025aefc27

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