OFICIAL Vercel Blog

FastAPI frontends and static files served from the CDN

What happened
Based on Vercel Blog · Sep 10, 2026

Vercel now promotes FastAPI frontends and static files to its CDN at build time, serving them directly without invoking functions unless routes or middleware require runtime checks.

FastAPI frontends and static files served from the CDN
Vercel Blog — Vercel
Key points
·
FastAPI frontends and static files are now promoted to Vercel CDN at build time for direct edge delivery.
·
Route precedence follows FastAPI declaration order, overriding CDN files if declared earlier.
·
Static files behind middleware or dependency checks remain in the function unless explicitly overridden in pyproject.toml.

FastAPI frontends and static files configured with app.frontend() or StaticFiles are now automatically promoted to the Vercel CDN during the build process. This means requests for these paths are handled directly by the CDN edge network instead of triggering a Vercel Function, reducing latency and compute costs for static content delivery.

Route precedence is maintained according to FastAPI’s declaration order, where routes defined before StaticFiles mounts take priority over any CDN-served files at the same path. This ensures existing application logic remains intact while benefiting from CDN acceleration for static assets.

Promoted source directories remain included in the function bundle by default, allowing the application to read from them at runtime. Developers can exclude these directories from the bundle and rely solely on the CDN by setting tool.vercel.fastapi.static.exclude = true in the project’s pyproject.toml configuration file.

Static files behind dependency checks or middleware are retained in the function by default, as the CDN cannot perform these runtime validations. To force promotion to the CDN regardless, developers can set tool.vercel.fastapi.static.cdn = true, or opt out entirely by setting the value to false.

Original source → Deals on Clipraptor.com →