/docs section/api/chat living next to your documentationentry to the holocron plugin pointing to your Spiceflow server file:123456789// vite.config.ts import { defineConfig } from 'vite' import { holocron } from '@holocron.so/vite' export default defineConfig({ plugins: [ holocron({ entry: './src/server.tsx' }), ], })
.use():1234567891011121314151617181920212223242526// src/server.tsx import { Spiceflow } from 'spiceflow' import { app as holocronApp } from '@holocron.so/vite/app' export const app = new Spiceflow() // your middleware runs on every request, including docs pages .use(async ({ request }, next) => { const res = await next() if (res) res.headers.set('x-custom-header', 'yes') return res }) // your own API routes .get('/api/hello', () => ({ hello: 'world' })) .get('/api/echo/:name', ({ params }) => ({ name: params.name })) // your own pages with your own layouts .layout('/dashboard', ({ children }) => ( <html lang='en'> <head><title>Dashboard</title></head> <body>{children}</body> </html> )) .page('/dashboard', () => <h1>My Dashboard</h1>) // mount holocron last — it handles all docs pages .use(holocronApp) void app.listen(3000)
docs.json navigation. Your own routes take priority because they're registered first..use() before .use(holocronApp) runs on every request, including doc pages. This is useful for auth checks, analytics headers, or request logging.123456export const app = new Spiceflow() .use(async ({ request }, next) => { console.log(request.method, request.url) return next() }) .use(holocronApp)
@import 'tailwindcss' in your own CSS files. A second import creates duplicate style layers that break layout, spacing, and cascade order.@reference instead. It gives your CSS access to Tailwind's theme variables, @apply, and @variant without emitting duplicate styles:123456789101112/* src/globals.css */ @reference "tailwindcss"; :root { --primary: #e11d48; --background: #fafafa; @variant dark { --background: #0a0a0a; --primary: #fb7185; } }
global.css or style.css at the project root, import it normally in your server entry:1import './globals.css'