holocron() to your Vite config, the plugin automatically adds the Spiceflow Vite plugin, React, and Tailwind CSS. You don't configure any of these separately. Holocron creates a Spiceflow app internally that registers routes for every page in your docs.json navigation.vite.config.ts │ ▼ holocron() plugin │ ├── spiceflow() vite plugin (auto-added) ├── @vitejs/plugin-react (auto-added) ├── @tailwindcss/vite (auto-added) │ └── creates Spiceflow app internally │ ├── page routes from docs.json ├── layout with sidebar, navbar, search ├── MDX rendering pipeline └── static assets (CSS, icons, fonts)
holocron() plugin handles everything.docs.json.use().entry to the holocron plugin:123456789// vite.config.ts import { defineConfig } from 'vite' import { holocron } from '@holocron.so/vite' export default defineConfig({ plugins: [ holocron({ entry: './src/server.tsx' }), ], })
1234567891011121314// src/server.tsx import { Spiceflow } from 'spiceflow' import { app as holocronApp } from '@holocron.so/vite/app' export const app = new Spiceflow() // API routes .get('/api/health', () => ({ status: 'ok' })) .post('/api/webhook', async ({ request }) => { const body = await request.json() // process webhook... return { received: true } }) // mount holocron last — it handles all docs pages .use(holocronApp)
Request ──► your middleware ──► your routes ──► holocronApp │ docs pages, search, sidebar, MDX rendering
.use(holocronApp) runs on every request, including docs pages. This is useful for auth, analytics, or headers:12345678export const app = new Spiceflow() .use(async ({ request }, next) => { console.log(request.method, new URL(request.url).pathname) const res = await next() if (res) res.headers.set('x-docs-version', '2.0') return res }) .use(holocronApp)
123456789101112131415export const app = new Spiceflow() .use(async ({ request }, next) => { const url = new URL(request.url) // public pages if (url.pathname === '/' || url.pathname.startsWith('/api/')) { return next() } // check auth for all other pages const session = await getSession(request) if (!session) { return Response.redirect(new URL('/login', url.origin).href) } return next() }) .use(holocronApp)
llms.txt file for AI agents or adding redirects that need custom logic:123456789101112import readmeRaw from '../README.md?raw' export const app = new Spiceflow() .get('/llms.txt', () => { return new Response(readmeRaw, { headers: { 'Content-Type': 'text/plain' }, }) }) .get('/gh', ({ request }) => { return Response.redirect('https://github.com/example/repo', 302) }) .use(holocronApp)
default export with a fetch handler:123456789101112import { Spiceflow } from 'spiceflow' import { app as holocronApp } from '@holocron.so/vite/app' export const app = new Spiceflow() .get('/api/hello', () => ({ hello: 'world' })) .use(holocronApp) export default { async fetch(request: Request): Promise<Response> { return app.handle(request) }, }
123456789101112131415import { cloudflare } from '@cloudflare/vite-plugin' import { holocron } from '@holocron.so/vite' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ holocron({ entry: './src/server.tsx' }), cloudflare({ viteEnvironment: { name: 'rsc', childEnvironments: ['ssr'], }, }), ], })
wrangler.jsonc setup and build commands./llms.txt and /gh redirect alongside holocron docs, deployed to Cloudflare Workers.