skillfed

mangum

AWS Lambda support for ASGI applications

mangum v0.21.0 6.7M downloads/30d#1,858 on PyPI2,131
Permissive license Active released

What it is and what it does

Mangum is a bridge that lets you run ASGI-based web applications directly on AWS Lambda. It translates Lambda events from various AWS services—API Gateway, Application Load Balancer, Function URLs, and Lambda@Edge—into the ASGI protocol, then converts the ASGI response back into a Lambda-compatible format. This lets you write your application once using a standard ASGI framework and deploy it to Lambda without rewriting for Lambda's native event model.

The package handles practical deployment concerns: binary media types, payload compression (GZip or Brotli), and ASGI lifespan events for startup and shutdown. It integrates with standard deployment tools like Serverless Framework and AWS SAM, making it straightforward to incorporate into existing Lambda workflows. With a single runtime dependency and low install friction, it's designed to be a thin, transparent adapter.

Use it for:

  • Deploy an ASGI REST API to Lambda behind API Gateway without rewriting the application.
  • Migrate an existing ASGI web app from a traditional server to Lambda with minimal code changes.
  • Build serverless web services that handle binary responses via API Gateway.
  • Use Lambda@Edge to serve dynamic content from CloudFront with an ASGI application.
  • Combine Lambda Function URLs with an ASGI framework for simple HTTP endpoints.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Mangum adapts ASGI applications to run on AWS Lambda, handling events from Function URLs, API Gateway (HTTP and REST), Application Load Balancer, and Lambda@Edge.

Yes. Mangum is actively maintained, permissively licensed, and carries no known vulnerabilities. Install it if you need to run an ASGI application on AWS Lambda or are considering Lambda for an existing ASGI codebase. The single dependency and low friction make adoption straightforward.

Install

mangum on PyPI

pip

pip install mangum

uv

uv add mangum

poetry

poetry add mangum

Installing mangum

Before you install

Low friction: pure Python wheel with a single runtime dependency (typing-extensions). Actively maintained with recent commits and a large user base (6749932 monthly downloads).

License in practice

MIT license (permissive) imposes no restrictions on commercial or private use; you may modify and redistribute with attribution.

Quickstart

pip install mangum

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"]],
    })
    await send({"type": "http.response.body", "body": b"Hello, world!"})

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

Requires Python 3.9 or later; the ASGI application itself must be installed separately.

Verify before relying

  • Performance characteristics under high concurrency or large payloads on Lambda.
  • Compatibility matrix with specific versions of major ASGI frameworks.
  • Cold-start overhead compared to native Lambda handlers.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing-extensions
Maintenance actively maintained — 194 days since the last release
Last repo commit
First released
Downloads 6,749,932/month — #1,858 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mangum-0.21.0-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP

Tags

asgi lambda adapterserverless asgi frameworkaws lambda http handlerapi gateway asgilambda function url supportasgi aws deploymentlambda event adapter
aws-lambdaasgi-adapterserverless

More WWW/HTTP packages