Skip to content

Configuration

Screenbook uses a screenbook.config.ts file for configuration. This file is auto-generated by screenbook init.

screenbook.config.ts
import { defineConfig } from "screenbook"
export default defineConfig({
// Output directory for generated files
outDir: ".screenbook",
// Glob pattern for screen metadata files
metaPattern: "src/**/screen.meta.ts",
// Glob pattern for route files (for lint/generate commands)
routesPattern: "src/pages/**/page.tsx",
// Patterns to ignore
ignore: ["**/node_modules/**", "**/.git/**"],
// Progressive adoption settings
adoption: {
mode: "full",
},
})

Type: string Default: ".screenbook"

Output directory for generated files (screens.json, graph.mmd, coverage.json).

Type: string Default: "src/**/screen.meta.ts"

Glob pattern for finding screen metadata files.

Type: string Default: undefined

Glob pattern for finding route files. Required for lint and generate commands.

Framework examples:

FrameworkPattern
Next.js (App Router)app/**/page.tsx
Next.js (Pages Router)pages/**/*.tsx
Vite/Reactsrc/pages/**/page.tsx
Remixapp/routes/**/*.tsx
Nuxtpages/**/*.vue
Astrosrc/pages/**/*.astro

Type: string[] Default: ["**/node_modules/**", "**/.git/**"]

Glob patterns to ignore when scanning for files.

Type: AdoptionConfig Default: { mode: "full" }

Progressive adoption settings for gradual rollout.

adoption: {
// "full" = all routes must have screen.meta.ts
// "progressive" = only check coverage within includePatterns
mode: "progressive",
// Patterns to include for coverage checking (progressive mode only)
includePatterns: ["src/pages/billing/**"],
// Minimum coverage percentage required to pass lint
minimumCoverage: 80,
}

Screenbook looks for configuration files in this order:

  1. screenbook.config.ts
  2. screenbook.config.js
  3. screenbook.config.mjs

You can also specify a custom path with the --config flag:

Terminal window
npx screenbook build --config ./config/screenbook.config.ts

The defineConfig function provides full TypeScript support with autocompletion and type checking:

import { defineConfig } from "screenbook"
export default defineConfig({
// TypeScript will provide autocomplete and type checking here
})