FastAPI frontends and static files served from the CDN
FastAPI static files and frontends now bypass the Vercel Function and load straight from the CDN, with route precedence and middleware checks preserved.
Static files and frontends served through FastAPI's app.frontend() or StaticFiles are now promoted to the Vercel CDN at build time, so matching requests are served directly from the CDN instead of invoking the Vercel Function.
- Route precedence is preserved: a route declared before a StaticFiles mount still takes priority over any CDN file at that path.
- Promoted source directories stay in the function bundle by default so the app can still read them at runtime; setting tool.vercel.fastapi.static.exclude = true in pyproject.toml excludes them and serves only from the CDN.
- Frontends behind dependency guards and static files behind middleware are kept on the function, since the CDN cannot run those checks. Setting tool.vercel.fastapi.static.cdn = true forces CDN promotion anyway, and setting it to false opts out of the CDN entirely.
Full details are in the announcement.
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →