StatikAPI turns filesystem route modules into static JSON endpoints. Use it when you want a simple route-file workflow, local preview, and a clear deployment path.
| Source file | Generated output | Notes |
|---|---|---|
src-api/index.js |
api-out/index.json |
Single top-level route. |
src-api/book.js |
api-out/book.json |
One route file becomes one JSON file. |
src-api/users/index.js |
api-out/users/index.json |
Nested route folders stay nested in output. |
src-api/users/[id].js |
api-out/users/1.json, api-out/users/2.json, api-out/users/3.json |
Dynamic routes expand to one JSON file per discovered route parameter. |
src-api/docs/[...slug].js |
api-out/docs/guide.json, api-out/docs/api/auth.json |
Catch-all routes expand into one JSON file per discovered path. |
src-api/index.js, src-api/users/[id].js, src-api/posts/index.js |
api-out/index.json, api-out/users/1.json, api-out/users/2.json, api-out/posts/index.json |
Multiple source files become multiple generated JSON files in one build. |
Pick the package manager you already use, then either choose the Cloudflare adapter in the prompt or pass --template cloudflare-adapter yourself:
pnpm dlx create-statikapi my-apiyarn dlx create-statikapi my-apinpx create-statikapi my-apiTo start with the Cloudflare scaffold directly:
pnpm dlx create-statikapi my-worker --template cloudflare-adapterAdd or update route modules in src-api/.
// src-api/index.js
export default {
hello: 'world',
};If you want to adjust the local build output, edit statikapi.config.js:
export default {
srcDir: 'src-api',
outDir: 'api-out',
};Use the generated project scripts:
pnpm devThat gives you:
- a watch/build loop
- the preview UI at
/_ui - local JSON output refreshes as you edit routes
When the project is ready:
pnpm buildThat writes the generated API output to api-out/.
If you want the Cloudflare path, choose the Cloudflare adapter during the interactive scaffold prompt or pass --template cloudflare-adapter.
That template gives you a Worker + Static Assets setup with project controls in:
wrangler.tomlfor Static Assets, R2, KV, and runtime vars.dev.varsfor local dev values and local deploy CLI envsstatikapi.config.jsfor Cloudflare project defaults and route visibility
The usual flow is:
pnpm dev
pnpm build
pnpm deployUse the Cloudflare scaffold when you want:
- public routes served from Static Assets
- private routes behind the Worker
- explicit auth-header control for private access
- a deploy path that matches the Cloudflare contract
If you are working on the StatikAPI repository itself, use these links instead of this quick-start guide:
MIT © 2025 StatikAPI contributors
See also SECURITY.md and CODE_OF_CONDUCT.md
