
๐งฉ One of 7 skills in the vercel-labs/academy-skills package โ works on its own, and pairs well with its siblings.
This is the playbook your agent receives when the skill activates โ you don't need to read it to use the skill, but it's here to audit before installing.
Python on Vercel
Companion skill for the Python on Vercel course. Ship a FastAPI backend and a Next.js 16 frontend as a single Vercel project, on the hobby plan, under one domain.
Commands
/python-on-vercel learn
Start the guided learning loop. Six lessons across three sections: setup, connecting the apps, and deploying to Vercel.
/python-on-vercel new
Scaffold a Python + Next.js project on Vercel:
- Clone the starter repo (
vercel-labs/python-on-vercel-academy) - Install Node deps with
npm installand Python deps viapyproject.toml - Install and authenticate the Vercel CLI (
vercel login) - Run both apps together with
vercel dev - Verify
/renders mock data and/api/itemsreturns JSON
/python-on-vercel submit
Evaluate the current implementation against the active lesson's outcomes.
Content source
https://vercel.com/academy/python-on-vercel.md โ course overview
https://vercel.com/academy/python-on-vercel/<lesson>.md โ lesson contentCore concepts
One project, two runtimes
- Next.js 16 at the project root (
app/,package.json,next.config.ts) - FastAPI in
api/index.pywithapp = FastAPI()at module level - Python deps in
pyproject.tomlat the root (norequirements.txt) - No
vercel.jsonโ Vercel auto-detects Next.js at the root and Python inapi/
Local development with vercel dev
- One command serves both apps under
http://localhost:3000 - Same-origin requests mean no CORS configuration
- Mirrors the production routing exactly
Routing into FastAPI
- Vercel routes
/api/*toapi/index.py - FastAPI route patterns must include the
/apiprefix (e.g.,@app.get("/api/items")) - Routes at just
/or/itemswill not match
Server-side fetch from Next.js
- Server components need an absolute URL โ
fetch("/api/items")only works in the browser - Build the base URL from
process.env.VERCEL_URL(auto-injected on every deployment) VERCEL_URLis hostname-only โ prependhttps://and fall back tohttp://localhost:3000for local dev
Deploy
vercel deploy --prodships both halves under one domain- Hobby plan is sufficient for the entire course
Progress detection
| Signal | Lesson area |
|---|---|
| Vercel CLI not installed or not authenticated | Setup (1.1) |
api/index.py runs locally with fastapi dev | FastAPI tour (1.2) |
app/page.tsx shows mock furniture data in the browser | Next.js tour (1.3) |
vercel dev serves both apps on localhost:3000 | Connect (2.1) |
app/page.tsx is async function Home() and calls /api/items | Wired (2.2) |
| Asks about deploy verification or production URLs | Deploy (3.1) |
Common fixes
- 404 on
/api/itemsโ route inapi/index.pyis missing the/apiprefix. Check for@app.get("/api/items"), not@app.get("/items"). - Server fetch fails in Next.js โ relative URL from a server component. Build an absolute URL from
process.env.VERCEL_URLwith a localhost fallback. - Deploy fails with
appnot found โ the FastAPI variable must be namedappat module level. Vercel looks forappat supported entrypoints (app.py,index.py,server.py, plussrc/andapp/variants). Renaming it toapi,server, orapplicationbreaks deploy detection. fastapiimport error โ Python deps missing frompyproject.toml, or wrong Python version. Pinrequires-python = ">=3.12".vercel devdoes not expose/api/*โ confirm the command is run from the project root and Python files live inapi/.
Teaching guidelines
- Six lessons total, target a 60-minute end-to-end run
- Course is hobby-plan compatible โ do not introduce Services or other Pro/Enterprise features into the core flow
- Do not require
vercel.jsonโ the project structure is the config - Keep examples tied to the Hazel Home furniture theme
- Flask and Django are mentioned only as a one-paragraph aside in the deploy lesson
Copy & paste โ that's it
npx skills add https://github.com/vercel-labs/academy-skills --skill Python on VercelRun this in your project โ your agent picks the skill up automatically.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.