Data directory (src/data/)
src/data/ is the single source of truth for all content in an OlonJS project. Nothing here is generated — every file is human-editable and version-controllable.
src/data/pages/— one JSON file per page (for example,home.json,about.json,blog.json). Each file declares the page’s slug, metadata, and an ordered array of sections with their typed data payloads.src/data/collections/— one JSON file per collection (for example,posts.json,tags.json). Each file is an array of items validated against the collection’s Zod schema.src/data/config/— site-wide configuration files:site.json(name, description, base URL),theme.json(colour tokens, font settings), andmenu.json(navigation structure).
src/data/ via the /api/save-to-file route.
Public directory (public/)
The public/ directory is generated — never edit its contents by hand.
During the prebuild step (which runs automatically before npm run build), OlonJS bakes everything in src/data/ into static files under public/:
public/pages/— fully resolved page bundles, including all collection relations. These are what the visitor-facing catch-all route reads at request time.public/collections/— collection data as static JSON endpoints, served with zero latency.public/schemas/— JSON Schema files derived from your Zod schemas, one per page. Used by Studio and external tooling to validate content.public/config/— a copy ofsite.jsonfor use by the static client without an API round-trip.public/mcp-manifests/— per-page MCP manifest files that describe each page’s schema to AI agents.public/mcp-manifest.json— the master MCP index listing all pages and their manifest URLs.public/sitemap.xmlandpublic/robots.txt— generated from your page index and site configuration.public/llms.txt— a plain-text summary of your site’s content for large language model consumption.
Section components (src/components/)
Each section type lives in its own folder under src/components/. A complete section folder contains four files:
The
ComponentRegistry.tsx in src/lib/ maps each section’s type string (for example, "hero") to its View component. The schemas.ts file exports a SECTION_SCHEMAS record that maps the same type strings to their Zod schemas — this is what the prebuild step and Studio use to validate and introspect section data.
To add a new section, create its folder under src/components/, register it in both ComponentRegistry.tsx and SECTION_SCHEMAS, then use its type string in any page JSON file.
Build scripts
OlonJS ships a set of prebuild scripts in thescripts/ directory that run automatically before every npm run build, in the following order:
sync-pages-to-public— mirrorssrc/data/pages/,src/data/collections/, andsrc/data/config/site.jsonintopublic/so the static file server can read them without an API round-trip.generate-llms-txt— producespublic/llms.txt, a plain-text summary of your site’s content for large language model consumption.bake— resolves all cross-collection relations, validates all schemas, writes fully hydrated page and collection bundles topublic/, and generates per-page MCP manifests and the masterpublic/mcp-manifest.json.sitemap— reads the page index and generatespublic/sitemap.xml.robots— generatespublic/robots.txtbased on your site configuration.
npm run prebuild during development if you need to refresh the baked data without starting a full Next.js build..png?fit=max&auto=format&n=AyzhRn9-CO-nDNc4&q=85&s=63c78e2325701880237e6cbce1399c2a)
.png?fit=max&auto=format&n=AyzhRn9-CO-nDNc4&q=85&s=0db283df6e4d31745079d6d03fd029ed)