FastAPI frontends and static files served from CDN
FastAPI frontends and static files are now automatically promoted to the Vercel CDN at build time, serving requests directly from the CDN without invoking your Function. Route precedence and runtime access are preserved, with configuration options to exclude directories or override CDN behavior.
FastAPI frontends and static files, served with or , are now promoted to the at build time. Requests for those paths are served directly from the CDN, without invoking your Vercel Function.app.frontend()StaticFilesVercel CDN
FastAPI evaluates routes in declaration order. A route declared before a mount takes priority over any CDN file at that path. This precedence is preserved.StaticFiles
Promoted source directories remain in the function bundle so the app can read from them at runtime. To exclude them and serve only from the CDN, set in .tool.vercel.fastapi.static.exclude = truepyproject.toml
Frontends guarded by are kept on the function as the CDN cannot run dependency checks. Similarly, static files which sit behind are also kept on the function. To override this and always promote to CDN, set . To opt out of the CDN entirely, set it to instead.dependenciesmiddlewaretool.vercel.fastapi.static.cdn = truefalse
For more information see the .Vercel FastAPI documentation
Source: original entry ↗