uvicorn

ASGI server for Python web applications - Fast, production-ready server for async frameworks

16 stars

Best use case

uvicorn is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

ASGI server for Python web applications - Fast, production-ready server for async frameworks

Teams using uvicorn should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/uvicorn/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/uvicorn/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/uvicorn/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How uvicorn Compares

Feature / AgentuvicornStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

ASGI server for Python web applications - Fast, production-ready server for async frameworks

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Uvicorn Skill Guide

Uvicorn is a lightning-fast ASGI server implementation, using uvloop and httptools. It's the go-to server for modern Python async web frameworks.

## Quick Start

### Basic Usage

```bash
# Run ASGI app
uvicorn main:app

# With host/port
uvicorn main:app --host 0.0.0.0 --port 8000

# Development with auto-reload
uvicorn main:app --reload
```

## Common Patterns

### 1. Simple ASGI Application

```python
# main.py
async def app(scope, receive, send):
    assert scope['type'] == 'http'

    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!',
    })
```

### 2. FastAPI Application

```python
# main.py
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello World"}
```

```bash
uvicorn main:app --reload
```

### 3. Application Factory Pattern

```python
# main.py
from fastapi import FastAPI

def create_app():
    app = FastAPI()
    # Configure app
    return app

app = create_app()
```

```bash
uvicorn --factory main:create_app
```

### 4. Programmatic Server Control

```python
import uvicorn

# Simple run
if __name__ == "__main__":
    uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
```

```python
import asyncio
import uvicorn

async def main():
    config = uvicorn.Config("main:app", port=5000, log_level="info")
    server = uvicorn.Server(config)
    await server.serve()

if __name__ == "__main__":
    asyncio.run(main())
```

### 5. Configuration with Environment Variables

```bash
export UVICORN_HOST="0.0.0.0"
export UVICORN_PORT="8000"
export UVICORN_RELOAD="true"
uvicorn main:app
```

## Production Deployment

### Multi-Process Workers

```bash
# Use multiple worker processes
uvicorn main:app --workers 4

# Note: Can't use --reload with --workers
```

### Gunicorn + Uvicorn

```bash
# Install gunicorn
pip install gunicorn

# Run with Gunicorn process manager
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker
```

### HTTPS/SSL

```bash
uvicorn main:app --ssl-keyfile=./key.pem --ssl-certfile=./cert.pem
```

### Unix Socket

```bash
uvicorn main:app --uds /tmp/uvicorn.sock
```

## Configuration Options

### Common CLI Flags

```bash
uvicorn main:app \
  --host 0.0.0.0 \
  --port 8000 \
  --reload \
  --reload-dir ./app \
  --log-level info \
  --access-log \
  --workers 4
```

### Key Settings

- `--host`: Bind host (default: 127.0.0.1)
- `--port`: Bind port (default: 8000)
- `--reload`: Enable auto-reload for development
- `--workers`: Number of worker processes
- `--log-level`: Logging level (critical, error, warning, info, debug)
- `--access-log`: Enable access logging
- `--factory`: Treat app as application factory

## Docker Integration

### Dockerfile

```dockerfile
FROM python:3.12-slim
WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt

# Copy application
COPY . .

# Run with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
```

### Docker Compose with Hot Reload

```yaml
services:
  app:
    build: .
    ports:
      - "8000:8000"
    environment:
      - UVICORN_RELOAD=true
    volumes:
      - .:/app
    command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
```

## Troubleshooting

### Common Issues

1. **Port already in use**: Change port or kill existing process
2. **Module not found**: Check PYTHONPATH or use `--app-dir`
3. **Reload not working**: Ensure watching correct directories with `--reload-dir`
4. **Worker count**: Use `--workers` for production, avoid with `--reload`

### Debug Mode

```bash
uvicorn main:app --reload --log-level debug
```

### Health Checks

```python
@app.get("/health")
async def health():
    return {"status": "healthy"}
```

Related Skills

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

vuejs-best-practices

16
from diegosouzapw/awesome-omni-skill

Vue 3 and Nuxt 3 performance optimization and best practices. This skill should be used when writing, reviewing, or refactoring Vue.js code to ensure optimal performance patterns. Triggers on tasks involving Vue components, Nuxt pages, Composition API, Pinia state management, or performance improvements.

vue

16
from diegosouzapw/awesome-omni-skill

Vue 组件开发与代码审查技能 - 开发模式:描述需求时生成高质量 Vue 组件/Composable - 审查模式:/vue <path> 审查该路径下所有 Vue 文件

vue-writer

16
from diegosouzapw/awesome-omni-skill

Skill for creating and editing Vue.js components following Prowi conventions. Use when writing Vue files, creating components, or refactoring frontend code. Enforces modern patterns like defineModel(), TypeScript, and Composition API.

vue-skill

16
from diegosouzapw/awesome-omni-skill

Vue/TypeScriptの実装に関するAgent

vue-playwright-testing

16
from diegosouzapw/awesome-omni-skill

Comprehensive guide for testing Vue 3 applications with Playwright (2025). This skill should be used when writing end-to-end tests or component tests for Vue apps, testing Vue Router navigation, reactive state changes, authentication flows, or setting up Playwright in Vue projects.

vr-ar

16
from diegosouzapw/awesome-omni-skill

VR/AR development principles. Comfort, interaction, performance requirements.

vps-memory

16
from diegosouzapw/awesome-omni-skill

Access Flo's long-term memory on the VPS (OpenClaw). ALWAYS use when the user says "memory", "memories", "remember", "souviens-toi", "rappelle-toi", "save memory", "search memory", "VPS memory", "OpenClaw", or mentions saving/searching past sessions or knowledge.

vpn-localhost-fix

16
from diegosouzapw/awesome-omni-skill

Fix VPN proxy conflicts with local development tools. Use when apps like OpenCode Desktop, VS Code, or other Electron/Tauri-based applications fail to start or connect to their local servers when a VPN proxy is enabled. Symptoms include "Failed to spawn server" errors, connection refused to 127.0.0.1 ports, or apps hanging on startup. Supports Clash Verge and other system proxy VPNs on macOS.

voice-assistant

16
from diegosouzapw/awesome-omni-skill

AI-powered voice assistant combining ElevenLabs Conversational AI with Twilio telephony. Build two-way voice agents for any scenario: birthday bots, sales assistants, customer support, appointment booking, surveys, and more. Supports agent versioning, A/B testing, knowledge bases, custom tools, and 30+ languages.

vitest-testing

16
from diegosouzapw/awesome-omni-skill

Vitest unit testing for TypeScript/JavaScript in Oh My Brand! theme. Test setup, Web Component testing, mocking patterns, and coverage. Use when writing unit tests for frontend code.

vite-config

16
from diegosouzapw/awesome-omni-skill

Generates vite.config.ts for building and serving the Vue 3 application. Configures dev server, API proxy, build format, and plugins.