Arkos.js v1.7-rc is out 🥳
GuidesFile Handling

Static Files

Available from v1.7.0-beta

Arkos automatically serves files from a public/ folder in your project root. Any file placed there is accessible directly by its path — no route configuration required.

GET /public/logo.svg
GET /favicon.ico

Static files are not prefixed with globalPrefix. A file at public/logo.svg is served at /logo.svg, not /api/logo.svg.

How it works

On startup, Arkos checks for the configured static folder. If it doesn't exist, it creates it and emits a warning. To disable static file serving entirely, set staticFiles.enabled = false in your config.

Configuration

All fields are optional and deep-merged with defaults.

KeyTypeDescriptionDefault
enabledbooleanWhether to enable static file servingtrue
folderstringFolder to serve, relative to project root"public"
prefixstringURL prefix under which files are served"/"
expressStaticobjectOptions passed to express.static() — deep-merged with defaultsSee below

expressStatic defaults:

{
  maxAge: "1y",
  etag: true,
  lastModified: true,
  dotfiles: "ignore",
  fallthrough: true,
  index: false,
  cacheControl: true,
}
arkos.config.ts
import { defineConfig } from "arkos";

export default defineConfig({
  staticFiles: {
    folder: "assets",
    prefix: "/static",
    expressStatic: {
      maxAge: "7d",
    },
  },
});

Opting out

arkos.config.ts
import { defineConfig } from "arkos";

export default defineConfig({
  staticFiles: {
    enabled: false,
  },
});