Kludex/mangum

AWS Lambda support for ASGI applications

Python

2,142

489 commits

updated Oct 9, 2026

See the code

README

Mangum

Package version PyPI - Python Version

Mangum is an adapter for running ASGI applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.

Documentation: https://mangum.fastapiexpert.com/

Features

Installation

pip install mangum

Example

from mangum import Mangum

async def app(scope, receive, send):
    await send(
        {
            "type": "http.response.start",
            "status": 200,
            "headers": [[b"content-type", b"text/plain; charset=utf-8"]],
        }
    )
    await send({"type": "http.response.body", "body": b"Hello, world!"})


handler = Mangum(app, lifespan="off")

Or using a framework:

from fastapi import FastAPI
from mangum import Mangum

app = FastAPI()


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


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

handler = Mangum(app, lifespan="off")
api-gateway
asgi
asyncio
aws
aws-lambda
django
fastapi
lambda
python
python3
quart
sanic
serverless
starlette

Kludex/mangum

AWS Lambda support for ASGI applications

Python

2,142

489 commits

updated Oct 9, 2026

See the code

README

Mangum

Package version PyPI - Python Version

Mangum is an adapter for running ASGI applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.

Documentation: https://mangum.fastapiexpert.com/

Features

Installation

pip install mangum

Example

from mangum import Mangum

async def app(scope, receive, send):
    await send(
        {
            "type": "http.response.start",
            "status": 200,
            "headers": [[b"content-type", b"text/plain; charset=utf-8"]],
        }
    )
    await send({"type": "http.response.body", "body": b"Hello, world!"})


handler = Mangum(app, lifespan="off")

Or using a framework:

from fastapi import FastAPI
from mangum import Mangum

app = FastAPI()


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


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

handler = Mangum(app, lifespan="off")
api-gateway
asgi
asyncio
aws
aws-lambda
django
fastapi
lambda
python
python3
quart
sanic
serverless
starlette

Project health

PyPI

Latest release

0.22.0 · Aug 22, 2026

Releases this year

3

Significant stargazers

Sebastián Ramírez

32,342 followers · starred Jan 2019

Miguel Grinberg

12,947 followers · starred May 2023

Fanyi Pu

166 followers · starred Feb 2026

Chris Adams

398 followers · starred Feb 2022