Framework Examples
Screenbook provides example projects demonstrating integration with popular frontend frameworks.
Available Examples
Section titled “Available Examples”| Framework | Directory | Routing |
|---|---|---|
| Next.js App Router | examples/nextjs-app-router/ | File-based (src/app/**/page.tsx) |
| Vite + React | examples/vite-react/ | React Router (src/pages/**/index.tsx) |
Next.js App Router
Section titled “Next.js App Router”The Next.js example uses the App Router with colocated screen.meta.ts files:
src/app/├── page.tsx├── screen.meta.ts├── dashboard/│ ├── page.tsx│ └── screen.meta.ts└── settings/ ├── page.tsx └── screen.meta.tsConfiguration
Section titled “Configuration”import { defineConfig } from "screenbook"
export default defineConfig({ metaPattern: "src/app/**/screen.meta.ts", routesPattern: "src/app/**/page.tsx",})Running the Example
Section titled “Running the Example”cd examples/nextjs-app-routerpnpm installpnpm screenbook:buildpnpm screenbook:devVite + React
Section titled “Vite + React”The Vite example uses React Router with a pages directory structure:
src/├── App.tsx # Route definitions└── pages/ ├── Home/ │ ├── index.tsx │ └── screen.meta.ts ├── Dashboard/ │ ├── index.tsx │ └── screen.meta.ts └── Settings/ ├── index.tsx └── screen.meta.tsConfiguration
Section titled “Configuration”import { defineConfig } from "screenbook"
export default defineConfig({ metaPattern: "src/pages/**/screen.meta.ts", routesPattern: "src/pages/**/index.tsx",})Running the Example
Section titled “Running the Example”cd examples/vite-reactpnpm installpnpm screenbook:buildpnpm screenbook:devCommon Patterns
Section titled “Common Patterns”Both examples demonstrate:
- Screen metadata:
id,title,route,owner,tags,description - Navigation relationships:
entryPoints,next - API dependencies:
dependsOn - 100% coverage: All routes have corresponding
screen.meta.tsfiles
Screen Definition Example
Section titled “Screen Definition Example”import { defineScreen } from "screenbook"
export const screen = defineScreen({ id: "dashboard", title: "Dashboard", route: "/dashboard", owner: ["platform"], tags: ["analytics", "dashboard"], description: "Main dashboard showing analytics and metrics", entryPoints: ["home"], next: ["settings"], dependsOn: ["AnalyticsAPI.getStats", "AnalyticsAPI.getRevenue"],})Adapting for Your Framework
Section titled “Adapting for Your Framework”To integrate Screenbook with other frameworks:
- Identify your route file pattern (e.g.,
pages/**/*.vuefor Nuxt) - Configure
routesPatterninscreenbook.config.ts - Create
screen.meta.tsfiles alongside your routes - Run
screenbook buildto generate metadata
See the Configuration guide for more options.