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.
- Clean sintaxis.
- Powered by Starlette for async support.
- Fully compatible with Django admin, ORM, and views.
- Minimal and zero-boilerplate setup.
- Your Django project continues to work as usual (
/admin, ORM, templates). - Async routes are automatically mounted under
/api.
Because you want the best of both worlds:
- Django’s power and ecosystem.
- The speed and modernity of async APIs.
pip install mangoapi-framework1- Create a django project:
django-admin startproject project .2- Create a api django app:
python3 manage.py startapp appname3- 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 = app6- 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 run7- Test
GET http://localhost:8000/api/hello/?name=MangoBuilt by Leandro Carriego(https://github.com/leandrocarriego)