StatikAPI Documentation

Build APIs from your data — without backend complexity.

StatikAPI helps you combine external APIs with your own content, shape outputs, and publish reliable structured endpoints. These docs cover the open source foundation, with guidance for local CLI workflows, Cloudflare deployment, and hosted platform usage.

StatikAPI App

Use the hosted visual workflow when you want managed publishing, private APIs, and automation.

Open StatikAPI App

The open source CLI stays free and self-hostable. StatikAPI App adds hosted workflows, visual editing, automations, analytics, and private API access.

Last updated: May 2026

Configuration

StatikAPI works without a config file, but you can customize behavior with statikapi.config.js.

Basic example:

js
export default {
  srcDir: 'src-api',
  outDir: 'api-out',
};

Supported top-level config fields

srcDir

  • type: string
  • default: "src-api"

This is the directory that contains route modules.

Supported route file extensions in the regular CLI path:

  • .js
  • .mjs
  • .cjs
  • .ts
  • .tsx

outDir

  • type: string
  • default: "api-out"

This is where the regular CLI writes generated JSON.

It also writes:

  • .statikapi/manifest.json

inside the output directory.

listIndex

  • type: boolean | { enabled?: boolean, pick?: string[] }
  • default: disabled

listIndex controls whether dynamic and catch-all routes also emit a parent collection route.

Examples:

js
export default {
  listIndex: true,
};
js
export default {
  listIndex: {
    enabled: true,
    pick: ['id', 'title'],
  },
};

Effects:

  • dynamic route /posts/[id]
    • item routes: /posts/1, /posts/2
    • collection route: /posts
  • catch-all route /docs/[...slug]
    • item routes: /docs/guide, /docs/api/intro
    • collection route: /docs

When pick is present:

  • each collection item must be a plain object
  • only the listed keys are included in the parent collection route

Route-level config

Routes can also export:

js
export const config = {
  listIndex: true,
};

or:

js
export const config = {
  listIndex: {
    enabled: true,
    pick: ['slug'],
  },
};

Route-level config.listIndex overrides the project default for that route.

In Cloudflare projects, route modules may also export:

js
export const config = {
  cloudflare: {
    public: false,
    webhook: true,
  },
};

See Cloudflare Worker + Static Assets Adapter.


Validation rules

srcDir and outDir:

  • must be non-empty strings
  • must be relative paths
  • must not traverse outside the project
  • must not be the same directory

listIndex:

  • true means enabled with defaults
  • false means disabled
  • pick must be an array of non-empty strings

If config validation fails, the CLI exits with a config error before building.


CLI overrides

The regular CLI can override config per invocation.

Build

bash
pnpm statikapi build --srcDir api --outDir public/api --listIndex=true

Dev

bash
pnpm statikapi dev --srcDir api --outDir public/api --port 8788

Supported override flags include:

  • --srcDir
  • --outDir
  • --listIndex
  • --listIndexPick

Dev-server notes

statikapi dev:

  • serves the preview UI at /_ui/
  • updates .statikapi/manifest.json
  • watches route files for changes
  • deletes stale outputs when routes disappear

Advanced environment overrides:

  • STATIKAPI_UI_DIR
    • custom prebuilt UI directory
  • STATIKAPI_FORCE_DEV=1
    • force long-running dev behavior in non-TTY environments

Common patterns

Custom directories

js
export default {
  srcDir: 'api',
  outDir: 'public/api',
};

Global collection indexes

js
export default {
  listIndex: {
    enabled: true,
    pick: ['id', 'title'],
  },
};

Monorepo package-local config

Put statikapi.config.js in the package root where you run the CLI.

The CLI resolves config relative to the current working directory.

Get started

Ready to publish your first API?

Start locally with the CLI or use StatikAPI Cloud when you want managed publishing and automation.

Get Started View examples