uvicornlisted
Install: claude install-skill aiskillstore/marketplace
# 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
uv run uvicorn main:app
# With host/port
uv run uvicorn main:app --host 0.0.0.0 --port 8000
# Development with auto-reload
uv run 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
uv run 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
uv run 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"