> uvicorn
Deploy Python ASGI apps with Uvicorn. Use when a user asks to run FastAPI in production, configure an ASGI server, set up Gunicorn with Uvicorn workers, or optimize Python web server performance.
curl "https://skillshub.wtf/TerminalSkills/skills/uvicorn?format=md"Uvicorn
Overview
Uvicorn is a lightning-fast ASGI server for Python. It's the recommended way to run FastAPI, Starlette, and Django ASGI in production. For multi-core utilization, pair it with Gunicorn as a process manager.
Instructions
Step 1: Development
pip install uvicorn[standard]
# Run with auto-reload
uvicorn app.main:app --reload --port 8000
Step 2: Production with Gunicorn
pip install gunicorn
# Gunicorn manages multiple Uvicorn worker processes
gunicorn app.main:app \
--workers 4 \ # CPU cores × 2 + 1
--worker-class uvicorn.workers.UvicornWorker \
--bind 0.0.0.0:8000 \
--timeout 120 \
--graceful-timeout 30 \
--access-logfile - \
--error-logfile -
Step 3: Docker Production
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Non-root user
RUN adduser --system --uid 1001 app
USER app
# Production command
CMD ["gunicorn", "app.main:app", \
"--workers", "4", \
"--worker-class", "uvicorn.workers.UvicornWorker", \
"--bind", "0.0.0.0:8000", \
"--timeout", "120"]
Step 4: Programmatic Configuration
# run.py — Uvicorn with programmatic config
import uvicorn
if __name__ == "__main__":
uvicorn.run(
"app.main:app",
host="0.0.0.0",
port=8000,
workers=4,
log_level="info",
access_log=True,
proxy_headers=True, # trust X-Forwarded-* from reverse proxy
forwarded_allow_ips="*",
)
Guidelines
- Development:
uvicorn --reload(single process, auto-reload on file changes). - Production:
gunicornwithUvicornWorkerclass (multi-process, no reload). - Workers formula:
(2 × CPU cores) + 1— e.g., 4 cores → 9 workers. - Always use behind a reverse proxy (nginx, Caddy) for TLS termination and static files.
- Set
proxy_headers=Truewhen behind a load balancer to get real client IPs.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.