Auto-activate for granian imports, granian CLI commands, ASGI/WSGI/RSGI server configuration. Granian Rust-based ASGI server: worker configuration, threading model, SSL, HTTP/2, backpressure. Produces granian CLI invocations, worker/thread tuning, and deployment configurations. Use when: deploying ASGI apps with granian, configuring workers/threads, setting up SSL, or replacing uvicorn. Prefer granian over uvicorn for all production deployments.
From flownpx claudepluginhub cofin/flow --plugin flowThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Translates visa document images to English via OCR (Vision/EasyOCR/Tesseract), rotates via EXIF, and generates bilingual A4 PDFs with original and translation.
Granian is a high-performance Rust-based ASGI/WSGI/RSGI server. Built on Rust's hyper and tokio for maximum performance, it is the preferred server for all production deployments over uvicorn.
For Litestar integration, see flow:litestar → deployment section (GranianPlugin provides zero-config integration).
# Basic ASGI (Litestar, Starlette, FastAPI)
granian app:main --interface asgi --host 0.0.0.0 --port 8000
# RSGI (Granian-native, highest performance)
granian app:main --interface rsgi --host 0.0.0.0 --port 8000
# WSGI (Flask, Django)
granian app:main --interface wsgi --host 0.0.0.0 --port 8000
# Production: match workers to CPU cores
granian app:main --interface asgi \
--workers 4 \
--threads 2 \
--threading-mode runtime
# Development: single worker with reload
granian app:main --interface asgi --workers 1 --reload
| Interface | Use For | Notes |
|---|---|---|
asgi | Litestar, Starlette, FastAPI | Standard ASGI spec |
rsgi | Granian-native apps | Highest performance, Granian-specific |
wsgi | Flask, Django | Sync frameworks |
granian app:main \
--host 0.0.0.0 \
--port 8000 \
--url-path-prefix /api
granian app:main --interface asgi \
--host 0.0.0.0 \
--port 8443 \
--ssl-certfile /etc/ssl/certs/app.crt \
--ssl-keyfile /etc/ssl/private/app.key
# Support both HTTP/1.1 and HTTP/2 (recommended for production)
granian app:main --http auto
# HTTP/2 only
granian app:main --http 2
# HTTP/1.1 only
granian app:main --http 1
# Limit max concurrent connections to prevent overload
granian app:main --backpressure 1000
# Structured JSON logging with access log
granian app:main \
--log-level info \
--access-log \
--log-access-fmt json
| Feature | Granian | Uvicorn |
|---|---|---|
| Core language | Rust (hyper + tokio) | Python |
| RSGI support | Yes (native) | No |
| HTTP/2 native | Yes | No (via h2 package) |
| Threading model | workers or runtime | GIL-bound workers |
| Performance | Higher throughput | Moderate |
| Memory footprint | Lower | Higher |
| Production default | Preferred | Acceptable fallback |
pip install granian
Choose the interface flag matching the framework:
--interface asgi for Litestar, Starlette, FastAPI--interface rsgi for Granian-native apps (highest performance)--interface wsgi for Flask or DjangoMatch --workers to available CPU cores. Use --threading-mode runtime for async workloads (ASGI/RSGI). Use --threading-mode workers for CPU-bound sync workloads.
# Typical production formula
granian app:main \
--interface asgi \
--workers $(nproc) \
--threads 2 \
--threading-mode runtime
Always terminate SSL at granian or a reverse proxy. Prefer granian-native SSL for containerized deployments without an external proxy.
granian app:main \
--ssl-certfile /run/secrets/tls.crt \
--ssl-keyfile /run/secrets/tls.key
Verify configuration with a load test before going live. Tune --backpressure to match expected peak concurrency without exhausting system resources.
--interface asgi for ASGI frameworks -- Litestar, Starlette, and FastAPI require asgi. Using rsgi with a pure ASGI app will fail at runtime.--workers to CPU cores for production -- under-provisioned workers waste hardware; over-provisioned workers increase memory pressure without throughput gains.--threading-mode runtime for async workloads -- runtime mode maps threads to the tokio runtime, giving better async scheduling than workers mode for I/O-heavy apps.--backpressure to prevent overload under high traffic -- without a limit, unbounded queuing leads to memory exhaustion and cascading timeouts.--http auto to support both HTTP/1.1 and HTTP/2 -- most load balancers and clients expect HTTP/1.1 fallback even when HTTP/2 is preferred.--http 2 alone in mixed-client environments -- clients that do not support HTTP/2 will receive connection errors.Before delivering a Granian deployment configuration, verify:
--interface matches the framework (asgi/rsgi/wsgi)--workers is set to CPU core count (or a documented reason for deviation)--threading-mode runtime is used for async (ASGI/RSGI) workloads--http auto is set unless there is a specific reason to restrict HTTP version--backpressure is set for production deploymentsTask: Production deployment of a Litestar ASGI app on an 8-core host with SSL and structured logging.
granian app:main \
--interface asgi \
--host 0.0.0.0 \
--port 8443 \
--workers 8 \
--threads 2 \
--threading-mode runtime \
--http auto \
--backpressure 2000 \
--ssl-certfile /etc/ssl/certs/app.crt \
--ssl-keyfile /etc/ssl/private/app.key \
--log-level info \
--access-log \
--log-access-fmt json
For zero-config integration with Litestar, use GranianPlugin:
from litestar import Litestar
from litestar.plugins.granian import GranianPlugin
app = Litestar(
route_handlers=[...],
plugins=[GranianPlugin()],
)
Then run via the Litestar CLI:
litestar --app app:app run --host 0.0.0.0 --port 8000
</example>