# SolidJS Documentation System
The SolidJS documentation system is a modern, full-stack web application built with SolidJS and SolidStart that serves comprehensive documentation for the Solid ecosystem. The project manages documentation for four distinct projects (SolidJS core, Solid Router, Solid Start, and Solid Meta) through a unified interface with multi-language support, advanced search capabilities, and LLM-friendly index generation for AI assistants.
This documentation platform leverages Solid's fine-grained reactivity to provide a fast, responsive user experience with server-side rendering (SSR) for optimal performance and SEO. The system features an automated content collection pipeline that transforms MDX documentation files into navigable content trees, generates sitemaps, syncs content with OramaSearch for full-text search functionality, and produces LLM-optimized documentation indexes. Built on Vinxi and deployed to Netlify, the platform supports internationalization, custom theming through Kobalte SolidBase, and includes sophisticated navigation with collapsible sections and tab-based interfaces. Each of the four projects maintains separate navigation trees and flat entry lists, exposed through a unified virtual module system.
## Development Commands
### Start development server
Start the local development server with hot module replacement at localhost:3000. The sync script runs automatically before starting to generate navigation data.
```bash
pnpm dev
```
### Build for production
Build the production-ready application with sitemap generation, LLM index generation, and SSR prerendering. Includes 8GB memory optimization for large documentation sets spanning multiple projects.
```bash
pnpm build
```
The build process executes: `pnpm sync && pnpm build:sitemap && pnpm build:llms && NODE_OPTIONS="--max-old-space-size=8192" vinxi build`
### Generate content collections
Parse MDX files from src/routes and generate navigation trees and flat entry lists in .solid directory. Creates virtual modules for runtime consumption.
```bash
pnpm sync
```
Expected output structure in `.solid/`:
```
.solid/
├── tree.ts # Core navigation tree
├── flat-entries.ts # Core flat entries (TypeScript)
├── entriesList.js # Core flat entries (JavaScript for scripts)
├── solid-router-tree.ts # Router-specific tree
├── solid-router-flat-entries.ts # Router flat entries
├── solid-start-tree.ts # Start-specific tree
├── solid-start-flat-entries.ts # Start flat entries
├── solid-meta-tree.ts # Meta-specific tree
├── solid-meta-flat-entries.ts # Meta flat entries
├── tree-{locale}.ts # Localized trees (e.g., tree-pt-br.ts)
└── flat-entries-{locale}.ts # Localized entries (e.g., flat-entries-pt-br.ts)
```
### Sync search index
Build the site and sync all HTML pages to OramaSearch index for full-text search capability. Requires ORAMA_PRIVATE_API_KEY and ORAMA_PRIVATE_INDEX_ID environment variables.
```bash
pnpm sync:orama
```
### Generate LLM-friendly documentation index
Create a markdown-formatted index of all documentation pages optimized for AI assistants and LLMs. Outputs to public/llms.txt with links to all pages across all four projects.
```bash
pnpm build:llms
```
This generates a structured markdown file with sections for SolidJS, SolidStart, Solid Router, and Solid Meta documentation.
## Content Collection System
### Define documentation structure
Documentation pages are organized using `data.json` files that define the navigation hierarchy. Each directory can contain a data.json to specify page order and section titles.
```json
{
"title": "Basic Reactivity",
"pages": [
"index.mdx",
"create-signal.mdx",
"create-effect.mdx",
"create-memo.mdx"
]
}
```
### Create MDX documentation pages
Documentation pages use MDX format with frontmatter metadata. Each page requires a title and can include optional fields like mainNavExclude and isDeprecated.
```mdx
---
title: createSignal
mainNavExclude: false
isDeprecated: false
---
# createSignal
Signals are the most basic reactive primitive in SolidJS...
```tsx
import { createSignal } from "solid-js"
const [count, setCount] = createSignal(0)
console.log(count()) // 0
setCount(5)
console.log(count()) // 5
```
```
### Build navigation tree programmatically
The buildFileTree function recursively scans directories and MDX files to construct a hierarchical navigation structure from the filesystem.
```javascript
import { buildFileTree } from './scripts/collections/build-file-tree.mjs'
// Build complete navigation tree from src/routes
const tree = await buildFileTree('src/routes')
// Result structure:
// {
// type: "section",
// title: "root",
// pages: ["index.mdx", "quick-start.mdx", "concepts"],
// children: [
// {
// type: "markdown",
// title: "Overview",
// path: "/index",
// slug: "index",
// mainNavExclude: false,
// isTranslated: true
// }
// ]
// }
```
### Generate flat entry lists
Transform hierarchical navigation trees into flat arrays for search, sitemap generation, and navigation rendering.
```javascript
import { createFlatEntryList } from './scripts/collections/create-flat-entry-list.mjs'
const tree = {
learn: [/* nested structure */],
reference: [/* nested structure */]
}
const flatEntries = {
learn: createFlatEntryList(tree.learn, []),
reference: createFlatEntryList(tree.reference, [])
}
// Result: flat array of all pages
// [
// { title: "Overview", path: "/index", mainNavExclude: false },
// { title: "Quick Start", path: "/quick-start", mainNavExclude: false }
// ]
```
## Application Configuration
### Configure SolidStart application
The app.config.ts file defines the complete application configuration including virtual modules for multi-project content collections, markdown processing with Shiki syntax highlighting, package manager presets for npm/pnpm/yarn/bun/deno, and custom Vite plugins for documentation features.
```typescript
import { defineConfig } from "@solidjs/start/config"
import { createWithSolidBase, defineTheme } from "@kobalte/solidbase/config"
// Import all project navigation data
import tree from "./.solid/tree"
import entries from "./.solid/flat-entries"
import solidstartEntries from "./.solid/solid-start-flat-entries"
import solidrouterEntries from "./.solid/solid-router-flat-entries"
import solidMetaEntries from "./.solid/solid-meta-flat-entries"
import solidrouterTree from "./.solid/solid-router-tree"
import solidStartTree from "./.solid/solid-start-tree"
import solidMetaTree from "./.solid/solid-meta-tree"
// Collect all routes for prerendering
const allEntries = [
entries.learn, entries.reference,
solidstartEntries.learn, solidstartEntries.reference,
solidrouterEntries.learn, solidrouterEntries.reference,
solidMetaEntries.learn, solidMetaEntries.reference,
].flat(Infinity).map(x => x.path.replace(/\\/g, "/"))
const theme = defineTheme({
componentsPath: import.meta.resolve("./src/solidbase-theme"),
})
export default defineConfig(
createWithSolidBase(theme)(
{
ssr: true,
middleware: "src/middleware/index.ts",
server: {
preset: "netlify",
prerender: {
crawlLinks: true,
autoSubfolderIndex: false,
failOnError: true,
routes: allEntries,
ignore: [/\{getPath\}/, /.*?emojiSvg\(.*/],
},
},
vite: {
plugins: [docsData(), heroCodeSnippet()],
},
},
{
title: "Solid Docs",
description: "Documentation for SolidJS, the signals-powered UI framework",
editPath: "https://github.com/solidjs/solid-docs/edit/main/:path",
markdown: {
expressiveCode: {
themes: ["min-light", "material-theme-ocean"],
themeCssSelector: (theme) => `[data-theme="${theme.type}"]`,
frames: false,
styleOverrides: {
twoSlash: {
cursorColor: "var(--twoslash-cursor)",
},
},
},
toc: {
minDepth: 2,
},
packageManagers: {
presets: {
npm: {
install: "npm i :content",
"install-dev": "npm i :content -D",
run: "npm run :content",
exec: "npx :content",
},
pnpm: {
install: "pnpm i :content",
"install-dev": "pnpm i :content -D",
run: "pnpm :content",
exec: "pnpx :content",
},
yarn: {
install: "yarn add :content",
"install-dev": "yarn add :content -D",
run: "yarn :content",
exec: "yarn dlx :content",
},
bun: {
install: "bun i :content",
"install-dev": "bun i :content -d",
run: "bun run :content",
exec: "bunx :content",
},
deno: {
install: "deno add npm::content",
run: "deno run :content",
exec: "dpx :content",
},
},
},
},
}
)
)
```
### Create virtual modules for navigation data
Vite plugins expose navigation data as virtual modules that can be imported throughout the application without file I/O at runtime. The system creates two key virtual modules: one for multi-project navigation data and another for hero code snippet syntax highlighting.
```typescript
// Virtual module for multi-project documentation navigation
function docsData() {
const virtualModuleId = "solid:collection"
const resolveVirtualModuleId = "\0" + virtualModuleId
return {
name: virtualModuleId,
resolveId(id: string) {
if (id === virtualModuleId) {
return resolveVirtualModuleId
}
},
async load(id: string) {
if (id === resolveVirtualModuleId) {
return `
export const coreEntries = ${JSON.stringify(entries, null, 2)}
export const routerEntries = ${JSON.stringify(solidrouterEntries, null, 2)}
export const startEntries = ${JSON.stringify(solidstartEntries, null, 2)}
export const metaEntries = ${JSON.stringify(solidMetaEntries, null, 2)}
export const coreTree = ${JSON.stringify(tree, null, 2)}
export const routerTree = ${JSON.stringify(solidrouterTree, null, 2)}
export const startTree = ${JSON.stringify(solidStartTree, null, 2)}
export const metaTree = ${JSON.stringify(solidMetaTree, null, 2)}
`
}
},
}
}
// Virtual module for hero code snippet with syntax highlighting
function heroCodeSnippet() {
const virtualModuleId = "solid:hero-code-snippet"
const resolveVirtualModuleId = "\0" + virtualModuleId
return {
name: virtualModuleId,
resolveId(id: string) {
if (id === virtualModuleId) {
return resolveVirtualModuleId
}
},
async load(id: string) {
if (id === resolveVirtualModuleId) {
const snippet = await readFile(
"./src/ui/layout/hero-code-snippet.code",
"utf-8"
)
const highlightedCode = await codeToHtml(snippet.trim(), {
lang: "tsx",
theme: "material-theme-ocean",
})
return `export const highlightedCode = \`${highlightedCode}\``
}
},
}
}
// Usage in components:
import { coreTree, coreEntries, routerTree, startTree, metaTree } from "solid:collection"
import { highlightedCode } from "solid:hero-code-snippet"
```
## Navigation Components
### Render main navigation with tabs
The MainNavigation component provides a tab-based interface switching between "Learn" and "Reference" documentation sections with collapsible subsections.
```tsx
import { MainNavigation } from "~/ui/layout/main-navigation"
function Layout() {
const tree = {
learn: [
{
title: "Concepts",
path: "/concepts",
children: [
{ title: "Signals", path: "/concepts/signals", mainNavExclude: false }
]
}
],
reference: [
{
title: "Basic Reactivity",
path: "/reference/basic-reactivity",
children: [
{ title: "createSignal", path: "/reference/basic-reactivity/create-signal" }
]
}
]
}
return (
)
}
```
### Handle internationalization
The i18n system provides translation support using context and route-based locale detection for multi-language documentation.
```tsx
import { I18nProvider, useI18n } from "~/i18n/i18n-context"
function App() {
return (