LinuxCommandLibrary

hypercorn

TLDR

Run ASGI application

$ hypercorn [app:app]
copy
Specify host and port
$ hypercorn [app:app] --bind [0.0.0.0:8000]
copy
Run with multiple workers
$ hypercorn [app:app] --workers [4]
copy
Enable reload for development
$ hypercorn [app:app] --reload
copy
Use HTTPS
$ hypercorn [app:app] --certfile [cert.pem] --keyfile [key.pem]
copy
HTTP/2 support
$ hypercorn [app:app] --certfile [cert.pem] --keyfile [key.pem]
copy

SYNOPSIS

hypercorn [options] module:application

DESCRIPTION

Hypercorn is an ASGI server supporting HTTP/1.1, HTTP/2, and WebSockets. It runs ASGI applications like FastAPI, Starlette, and Quart with optional HTTP/2 and HTTPS support.
Hypercorn supports multiple async frameworks (asyncio, uvloop, trio) and provides production-ready features including worker processes and graceful shutdown.

PARAMETERS

module:application

Python module and ASGI app variable.
--bind, -b address
Address to bind (host:port).
--workers, -w n
Number of worker processes.
--reload
Auto-reload on code changes.
--access-log file
Access log file.
--error-log file
Error log file.
--certfile file
SSL certificate.
--keyfile file
SSL key file.
--worker-class class
Worker type: asyncio, uvloop, trio.
--graceful-timeout seconds
Graceful shutdown timeout.

CAVEATS

HTTP/2 requires HTTPS. uvloop gives better performance. Reload mode for development only. Reverse proxy recommended for production.

HISTORY

Hypercorn was created by Philip Jones (pgjones), who also created Quart. It was designed as an ASGI-native server supporting modern HTTP protocols.

SEE ALSO

uvicorn(1), gunicorn(1), daphne(1)

Copied to clipboard