一键导入
deploy-fullstack-vercel
Build and deploy a full-stack app (React frontend + Python/FastAPI backend) to Vercel as a serverless demo with seeded data
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build and deploy a full-stack app (React frontend + Python/FastAPI backend) to Vercel as a serverless demo with seeded data
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Spawn external coding agents via the Agent Client Protocol (ACP)
Build interactive apps, dashboards, calculators, games, trackers, tools, landing pages, and data visualizations with Preact/TypeScript/CSS
Drive a specific named macOS app via raw input bypassing the Accessibility tree
Control the macOS desktop
Manage contacts, communication channels, access control, and invite links
Write, draft, or compose long-form text (blog posts, articles, essays, reports, guides)
| name | deploy-fullstack-vercel |
| description | Build and deploy a full-stack app (React frontend + Python/FastAPI backend) to Vercel as a serverless demo with seeded data |
| compatibility | Designed for Vellum personal assistants |
| metadata | {"emoji":"🚀","vellum":{"display-name":"Deploy Fullstack to Vercel"}} |
Deploy a full-stack app with a React/Vite frontend and Python/FastAPI backend to Vercel as a serverless demo. No auth required - meant for demos, portfolio pieces, and quick showcases.
npm install -g vercel) and authenticated (vercel login)cd <project>/frontend
npm install
npx vite build
This produces static files in frontend/dist/.
<project>/vercel-deploy/
├── api/
│ ├── index.py ← FastAPI app wrapper (entry point)
│ ├── database.py ← DB config (use /tmp for SQLite)
│ ├── models.py
│ ├── schemas.py
│ ├── seed_data.py ← Must seed ALL required data (users, etc.)
│ ├── routers/
│ │ ├── __init__.py
│ │ └── *.py
│ └── requirements.txt ← Python deps (fastapi, sqlalchemy, pydantic)
├── index.html ← From frontend/dist/
├── assets/ ← From frontend/dist/assets/
└── vercel.json
Key steps:
mkdir -p <project>/vercel-deploy/api
# Copy frontend build output to deploy root
cp -r <project>/frontend/dist/* <project>/vercel-deploy/
# Copy backend files into api/
cp <project>/backend/models.py <project>/vercel-deploy/api/
cp <project>/backend/database.py <project>/vercel-deploy/api/
cp <project>/backend/schemas.py <project>/vercel-deploy/api/
cp <project>/backend/seed_data.py <project>/vercel-deploy/api/
cp -r <project>/backend/routers <project>/vercel-deploy/api/
cp <project>/backend/requirements.txt <project>/vercel-deploy/api/
import sys, os
sys.path.insert(0, os.path.dirname(__file__))
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from database import engine, Base, SessionLocal
from seed_data import seed_exercises, seed_default_user # all seed functions
from routers import users, exercises, workouts, schedule, progress
# Create tables and seed on EVERY cold start
Base.metadata.create_all(bind=engine)
db = SessionLocal()
try:
seed_exercises(db)
seed_default_user(db) # IMPORTANT: seed all required data
finally:
db.close()
app = FastAPI(title="MyApp")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(users.router)
# ... other routers
@app.get("/api/health")
def health_check():
return {"status": "ok"}
Critical: Vercel serverless functions can only write to /tmp. Update the SQLite path:
SQLALCHEMY_DATABASE_URL = "sqlite:////tmp/app.db"
This is the #1 gotcha. Since /tmp is ephemeral, every cold start gets a fresh database. If your frontend assumes certain data exists (like user ID 1), you MUST seed it:
def seed_default_user(db: Session):
count = db.query(UserProfile).count()
if count > 0:
return
user = UserProfile(name="Demo User", ...)
db.add(user)
db.commit()
{
"rewrites": [
{ "source": "/api/(.*)", "destination": "/api/index.py" },
{ "source": "/((?!assets/).*)", "destination": "/index.html" }
]
}
This routes:
/api/* → Python serverless functioncd <project>/vercel-deploy
vercel --yes --prod
curl -s <deployed-url>/api/health
# Should return: {"status":"ok"}
| Issue | Solution |
|---|---|
| SQLite resets on cold start | Seed ALL required data in index.py startup |
| No persistent storage | Acceptable for demos. For production, use Vercel Postgres or Supabase |
| No auth | Fine for demos/portfolios. Add auth layer for real apps |
requirements.txt location | Must be inside api/ folder (next to index.py) |
| Module imports in routers | Use sys.path.insert(0, os.path.dirname(__file__)) in index.py |
| CORS | Set allow_origins=["*"] for demo deployments |
--name flag deprecated | Don't use --name with Vercel CLI, just deploy from the directory |
npm install -g vercel # Install
vercel login # Authenticate (opens browser)
vercel --yes --prod # Deploy to production (skip prompts)
vercel logs --project <name> # Check function logs