FastAPI frontends and static files, served with app.frontend() or StaticFiles , are now promoted to the Vercel CDN at build time. Requests for those paths are served directly from the CDN, without invoking your Vercel Function.
app = FastAPI ( )
app . frontend ( "/" , directory = "dist" )
app . mount ( "/assets" , StaticFiles ( directory = "assets" ) , name = "assets" )
Frontend and StaticFiles, both promoted to the CDN.
FastAPI evaluates routes in declaration order. A route declared before a StaticFiles mount takes priority over any CDN file at that path. This precedence is preserved.
@app . get ( "/static/manifest.json" ) # served by your Vercel Function
def manifest ( ) : . . .
app . mount ( "/static" , StaticFiles ( directory = "static" ) , name = "static" )
A route that takes precedence over StaticFiles.
Promoted source directories remain in the function bundle so the app can read from them at runtime.…