bonsai/hermes-skills/fastapi-vercel-serverless

Claude Code and agent skill by bonsai/hermes-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Deploy FastAPI apps to Vercel as serverless functions with static site, SQLite DB, and ASGI handler.

Install

npx vskill@latest install bonsai/hermes-skills/fastapi-vercel-serverless

SKILL.md

The same SKILL.md was published earlier as bonsai/hermes-skills/fastapi-vercel-serverless.

FastAPI Vercel Serverless Deploy

Pattern

Deploy FastAPI backend + static frontend together on Vercel:

  • api/index.py → Serverless function (mangum handler)
  • public/ → Static files (CDN)
  • vercel.json → Route splitting

Project Structure

project/
├── api/
│ └── index.py # FastAPI app + Mangum handler
├── public/
│ ├── index.html # Static landing
│ └── ... # JS, CSS, assets
├── requirements.txt # +mangum, must be top-level
└── vercel.json # Route config

api/index.py

python
from fastapi import FastAPI
from mangum import Mangum
import os
# SQLite MUST write to /tmp/ (read-only filesystem otherwise)
os.environ["DB_PATH"] = "/tmp/app.db"
app = FastAPI()
@app.get("/")
def root():
return {"ok": True}
# ASGI handler for serverless
handler = Mangum(app, lifespan="off")

vercel.json

json
{
"builds": [
{"src": "api/index.py", "use": "@vercel/python"}
],
"routes": [
{"src": "/api/(.*)", "dest": "/api/index.py"},
{"src": "/(.*)", "dest": "/public/$1"}
]
}

requirements.txt

fastapi>=0.118.0
pydantic>=2.0.0
mangum>=0.17.0
asgiref>=3.7.0
# + your deps (numpy, etc.)

Deploy

bash
# Push code first (Vercel auto-connects GitHub)
git push origin main
# Or manual deploy
vercel --yes
vercel --prod

Pitfalls

  • SQLite thread error: Use sqlite3.connect(path, check_same_thread=False) — required for multi-threaded contexts (TestClient, serverless workers).
  • Writes fail: Vercel functions have read-only filesystem except /tmp/. Put DB files there.
  • Cold-start re-seed: Stateless serverless means DBs reset on each cold start. Either use external DB (Turso, PlanetScale) or accept in-memory re-seeding for light workloads.
  • Mangum missing: Must add mangum to requirements.txt. Common oversight.
  • Route priority: Put /api/(.*) BEFORE /(.*) in vercel.json routes array.
  • 401 Protected: Disable Deployment Protection in Vercel dashboard → Settings → Overview → Deployment Protection, or run vercel deployment-protection disable.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/bonsai/hermes-skills/fastapi-vercel-serverless/badge)](https://verified-skill.com/skills/bonsai/hermes-skills/fastapi-vercel-serverless)

Something wrong with this skill or its page? Tell us.