Skip to main content

Modern lightweight framework for building async APIs on top of Django

Project description

🍋 MangoAPI

MangoAPI is a lightweight meta-framework that lets you build modern, clean and asynchronous APIs inside a traditional Django project.

It integrates Starlette for async routing, while preserving Django’s admin, ORM, and all core functionality.


🚀 Features

  • Clean sintaxis.
  • Powered by Starlette for async support.
  • Fully compatible with Django admin, ORM, and views.
  • Minimal and zero-boilerplate setup.

🔧 Django Integration

  • Your Django project continues to work as usual (/admin, ORM, templates).
  • Async routes are automatically mounted under /api.

🎯 Why MangoAPI?

Because you want the best of both worlds:

  • Django’s power and ecosystem.
  • The speed and modernity of async APIs.

⚙️ Installation

pip install mangoapi-framework

🧪 Quick Example

1- Create a django project:

django-admin startproject project .

2- Create a api django app:

python3 manage.py startapp appname

3- Add de app in your settings:

# project/settings.py
INSTALLED_APPS = [
    ....

    "api",
]

4- Create inside your project directory a api.py file:

# project/api.py
from mangoapi import MangoAPI
from api.routes.hello import router as hello_router

app = MangoAPI()
app.include_router(hello_router)

5- Delete all in asgi.py and add te MangoAPI app inside:

# project/asgi.py
from project.api import app

application = app

6- Create a new endpoint

# api/routes/hello.py
from mangoapi import Router

router = Router(prefix="/hello")

@router.get("/")
async def say_hello(name: str = "world") -> dict[str, str]:
    return {"message": f"Hello {name} 👋"}

Or if you use Pydantic

# api/schemas/hello.py
from pydantic import BaseModel


class HelloResponse(BaseModel):
    message: str
# api/routes/hello.py
from mangoapi import Router

from api.schemas.hello import HelloResponse

router = Router(prefix="/hello")

@router.get("/")
async def say_hello(name: str = "world") -> HelloResponse:
    return {"message": f"Hello {name} 👋"}

The return type is mandatory!

6- Run the app

mangoapi run

7- Test

GET http://localhost:8000/api/hello/?name=Mango

👤 Author

Built by Leandro Carriego(https://github.com/leandrocarriego)


📄 License

Apache-2.0

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

mangoapi_framework-0.1.0a2.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

mangoapi_framework-0.1.0a2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file mangoapi_framework-0.1.0a2.tar.gz.

File metadata

  • Download URL: mangoapi_framework-0.1.0a2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for mangoapi_framework-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 29c9b103ee01db810436d3282786fedf0b2ce0d8065ea7eab36eab8802fa9a31
MD5 fca4eb3d042d1cfbfe0055665fb4c242
BLAKE2b-256 ffd0536c528f0b0dc3473df63011ba4d3aad21eef95d4c06f806b4a640d88236

See more details on using hashes here.

File details

Details for the file mangoapi_framework-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for mangoapi_framework-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 9654ef38333492296f3a8ea1e82e6a828170b8b2ae014cd46cda16adddbfd4d8
MD5 9f1c749b00ec63ae8073e495356b86ba
BLAKE2b-256 04fa0685cddde38acdcb2d7a07cfaaaf3c57a17715461d0965acf914a0387699

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