🚧 This documentation is not complete yet as Lagon is in development.
Static files

Static files are automatically served by Lagon, without additional logic or configuration needed.

When deploying a Function, you can add static files using the --public or -p flag. It accepts a path to a directory, which will be then served by Lagon at the root of your Function's URL.

Automatic static files serving

Let's say you have a Function inside an index.ts file, with a favicon and an image:


To deploy this Function with these static files, you can use the -p or --public flag:

lagon deploy ./index.ts -p public

Your Function is now deployed to example.lagon.dev. You can access the favicon and the image at the following URLs:

  • example.lagon.dev/favicon.ico
  • example.lagon.dev/images/image.png

In your HTML, you can reference these files using relative paths:

<link rel="icon" href="/favicon.ico" />
<!-- ... -->
<img src="/images/image.png" />


All static files are automatically compressed with Gzip (opens in a new tab). A Cache-Control header is automatically set to max-age=604800 (7 days) to enable caching by browsers.