Skip to main content
Glama
egafossojm

fastapi-mcp-todo

by egafossojm
README.md
# Cloud deployment guides

Deploy this **FastAPI Todo API + MCP server** (`/mcp`) from GitHub.

| Guide | Platform | Default storage | Scale-out option |
|-------|----------|-----------------|------------------|
| [Render](./deploy-render.md) | Render Web Service | SQLite (1 instance) | Render Postgres |
| [AWS App Runner](./deploy-aws-app-runner.md) | App Runner | SQLite (1 instance) | RDS / Aurora Postgres |
| [AWS ECS Fargate](./deploy-aws-ecs-fargate.md) | ECS on Fargate | SQLite (1 task) | RDS / Aurora Postgres |

## Shared project files

| File | Used by |
|------|---------|
| [`../Dockerfile`](../Dockerfile) | App Runner, ECS (and optional Render Docker runtime) |
| [`../render.yaml`](../render.yaml) | Render Blueprint |
| [`../requirements.txt`](../requirements.txt) | All platforms |
| [`../main.py`](../main.py) | Application + MCP mount |

## Important

While using **local SQLite** (`todos.db`):

- Keep **one** compute unit only (1 Render instance / 1 App Runner instance / 1 ECS task).
- Expect **data loss on redeploy** unless you attach durable storage (Render disk) or migrate to Postgres.
- `/mcp` is public unless you add authentication.

## `PYTHONUNBUFFERED=1`

The project `Dockerfile` sets:

```dockerfile
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1
```

| Variable | Purpose |
|----------|---------|
| `PYTHONUNBUFFERED=1` | Disables stdout/stderr buffering so uvicorn and app logs appear **immediately** in Render / CloudWatch / App Runner logs (same idea as `python -u`). |
| `PYTHONDONTWRITEBYTECODE=1` | Skips writing `.pyc` files in the container (cleaner, slightly less disk I/O). |
| `PIP_NO_CACHE_DIR=1` | Avoids keeping pip’s download cache in the image layers. |

For **non-Docker** Render Python deploys, set `PYTHONUNBUFFERED=1` in the service **Environment** variables so platform logs stay real-time. Docker-based App Runner / ECS already inherit it from the image.