Skip to content

Serving static files and SPAs with Sillo.

Sillo no longer includes a built-in FrontendApp or app.frontend() helper.

For serving static files and single-page applications, use one of the following approaches:

The recommended production setup is to serve static assets from a reverse proxy or CDN in front of the Sillo application:

Terminal window
# nginx example
location / {
proxy_pass http://127.0.0.1:8000;
}
location /static/ {
alias /path/to/dist/;
expires 1y;
}

For development or simple deployments, mount Starlette’s StaticFiles directly:

from starlette.staticfiles import StaticFiles
app = SilloApp()
app.mount("/static", StaticFiles(directory="dist"), name="static")

For SPA fallback routing, write a small ASGI middleware or mount a custom BaseRouter subclass. This gives you full control over caching, fallback behaviour, and security headers.