Skip to content

Commit e3de391

Browse files
docs: generate an llms.txt index for the docs site (#770)
## Summary - VitePress 2.0.0-alpha.20 does not generate `llms.txt` yet, so the docs build uses `vitepress-plugin-llms`. - The build publishes `/llms.txt`, `/llms-full.txt`, and a Markdown copy of each page at `https://void.cloud`. - The index follows the [llmstxt.org](https://llmstxt.org/) proposal: a title, a summary, and links to the Markdown pages. ## Example This is the `llms.txt` produced by `vp run --filter ./docs build`: ```markdown # Void > Build with Vite. Deploy with Void. Void is a CLI, platform, and full-stack SDK that unifies building & deploying apps. ## Table of Contents ### Installation - [Install a Void Platform](https://void.cloud/guide/self-hosted-platform.md): Install a shared deployment environment in your Cloudflare account so your team can deploy without account credentials. - [Prerequisites](https://void.cloud/guide/platform/installation/prerequisites.md): Check the Cloudflare account, domain, and API token permissions you need before installing a Void platform. - [Credentials](https://void.cloud/guide/platform/installation/credentials.md): Save the credentials an installation asks for, and see which values belong in a password manager or the shell. - [Install and Configure Login](https://void.cloud/guide/platform/installation/setup.md): Install a Void platform and choose how administrators and developers sign in. - [First Deployment](https://void.cloud/guide/platform/installation/first-deployment.md): Open the platform URL, connect the CLI, and deploy the first app into the shared Cloudflare account. - [Domains and Resources](https://void.cloud/guide/platform/installation/domains.md): Add an application domain to an installed platform, including its DNS, routing, and HTTPS certificate. - [Maintenance and Recovery](https://void.cloud/guide/platform/installation/maintenance.md): Resume, repair, upgrade, or recover an installation, including when the keychain or API is unavailable. - [Install from CI](https://void.cloud/guide/platform/installation/ci.md): Install or update a Void platform from CI after you have configured it once interactively. - [Disable and Uninstall](https://void.cloud/guide/platform/installation/uninstall.md): Disable a platform without deleting its data, or uninstall it and remove its Cloudflare resources. ### Administration - [Platform Administration](https://void.cloud/guide/platform-administration.md): Manage people, projects, deployment logs, and platform health from the terminal with void platform. - [Sign-in and Access](https://void.cloud/guide/platform/administration/access.md): Sign in to the admin UI, create the first administrator, and control who can access the platform. - [Connected apps](https://void.cloud/guide/platform/administration/connected-apps.md): Register a separate application as an OAuth client so its users can sign in on Void and choose whether to connect it. - [Users and Projects](https://void.cloud/guide/platform/administration/projects.md): Find users, inspect their projects and usage, and change the plan assigned to an account. - [Plans and Limits](https://void.cloud/guide/platform/administration/plans.md): Define resource limits for accounts on your platform. Plans do not bill users or purchase Cloudflare services. - [Project Zero Trust](https://void.cloud/guide/platform/administration/zero-trust.md): Require Cloudflare Access sign-in on project hostnames, including custom domains, before visitors reach an app. - [Email](https://void.cloud/guide/platform/administration/email.md): Manage platform email, including the shared sender, who mail may reach, and project sending domains. - [Operations](https://void.cloud/guide/platform/administration/operations.md): Preview platform changes, follow logs, and check health from an administrator session. ### Development & Customization - [Developing a Void Platform](https://void.cloud/guide/platform-development.md): Change the platform in this repository, test it locally, and deploy a runtime built from your fork. - [Local Development](https://void.cloud/guide/platform/development/local.md): Clone the repository, install workspace dependencies, and run the platform locally with Vite+. - [Runtime and Source Builds](https://void.cloud/guide/platform/development/runtime.md): Build a platform runtime from your checkout and deploy that build into your Cloudflare account. - [Schema and CI](https://void.cloud/guide/platform/development/schema-ci.md): Change the platform database schema, generate a migration, and see how CI checks that schema. ### Getting Started - [What is Void?](https://void.cloud/guide.md): Void is a full-stack framework for Cloudflare Workers, powered by Vite. It connects routing, data, and deployment in one project. - [Quickstart](https://void.cloud/guide/quickstart.md): Create a Void app, run it locally, and deploy it. You can also add Void to an existing Vite app. - [Supported App Types](https://void.cloud/guide/app-types.md): Build a Void app, keep a meta framework, or deploy a static site. Void provisions resources and deploys each of them. ### Routing & Rendering - [Server Routing](https://void.cloud/guide/server-routing.md): Add an endpoint by creating a file in routes/ and exporting a handler for each HTTP method. - [Custom SSR](https://void.cloud/guide/ssr.md): Bring your own router, data loading, HTML shell, and hydration, or use Pages Routing to have Void handle them. - [Static Site Generation (SSG)](https://void.cloud/guide/ssg.md): Prerender every page at build time by setting the static output mode in void.config.ts. #### Pages Routing - [Pages Routing](https://void.cloud/guide/pages-routing/overview.md): Turn files in pages/ into routes. A server loader returns data, and the page component receives it as props. - [Layouts & Shared Data](https://void.cloud/guide/pages-routing/layouts.md): Share navigation and other UI across pages. Layouts nest with your directories and keep their state during navigation. - [Loaders & Props](https://void.cloud/guide/pages-routing/loaders.md): Load a page's data in a companion .server.ts file. The component receives that data as typed props. - [Actions & Forms](https://void.cloud/guide/pages-routing/actions-and-forms.md): Change server data from a form or button with a page action. Actions accept POST, PUT, PATCH, and DELETE. - [Not Found & Errors](https://void.cloud/guide/pages-routing/errors.md): Show not-found and error states inside your layouts with _not-found and _error components. - [View Transitions](https://void.cloud/guide/pages-routing/view-transitions.md): Animate navigation with the View Transition API. Pages cross-fade by default, and CSS customizes the animation. - [Head Management](https://void.cloud/guide/pages-routing/head.md): Set a page title and metadata with head(), middleware, or site-wide defaults. - [Islands](https://void.cloud/guide/pages-routing/islands.md): Add interactive components to a server-rendered page. Only those islands send JavaScript to the browser. - [Markdown](https://void.cloud/guide/pages-routing/markdown.md): Add Markdown files in pages/ as routes. They inherit layouts and ship JavaScript only for islands and client scripts. #### Edge Routing - [Static Assets Caching](https://void.cloud/guide/edge/static-assets.md): Cache static assets on Cloudflare's edge. Hashed build files stay reusable across deploys. - [Revalidation (ISR)](https://void.cloud/guide/edge/revalidation.md): Cache rendered pages and refresh them in the background, so visitors keep reading while a new version renders. - [Edge Prerendering](https://void.cloud/guide/edge/prerendering.md): Prerender pages at deploy time so the first visitor receives cached HTML. - [Custom Headers](https://void.cloud/guide/edge/headers.md): Set custom response headers from void.config.ts. Match URL patterns to header names and values. - [Redirects](https://void.cloud/guide/edge/redirects.md): Redirect requests from void.config.ts. Map a source pattern to a destination and an optional status code. - [Rewrites](https://void.cloud/guide/edge/rewrites.md): Serve one route at another URL without changing the address in the browser. ### Data - [Type Safety](https://void.cloud/guide/type-safety.md): Carry types from your database schema through route handlers and page loaders to the UI. - [Typed Fetch](https://void.cloud/guide/typed-fetch.md): Call your API from the client with a typed fetch that checks paths, request bodies, and response types. - [Key-Value Storage](https://void.cloud/guide/kv.md): Read and write JSON in Cloudflare Workers KV. Give each collection its own key prefix and value type. - [Object Storage](https://void.cloud/guide/storage.md): Store files in Cloudflare R2, and upload, download, and read metadata through void/storage. - [Durable State](https://void.cloud/guide/durable-state.md): Share typed state across requests with a Durable Object, such as a cart, room, or rate limiter. - [Environment variables](https://void.cloud/guide/env-vars.md): Declare environment variables in env.ts and read the typed values from void/env. Use .env locally and secrets in production. #### Database - [Database](https://void.cloud/guide/database.md): Define tables in TypeScript and query them with Drizzle. Use the same schema with D1, PostgreSQL, or MySQL. - [D1 (SQLite)](https://void.cloud/guide/database/d1.md): Use Cloudflare D1, Void's default SQLite database. Void runs it locally and provisions it when you deploy. - [PostgreSQL](https://void.cloud/guide/database/postgresql.md): Connect PostgreSQL through Cloudflare Hyperdrive and query it with the same Drizzle workflow as D1. - [MySQL](https://void.cloud/guide/database/mysql.md): Connect MySQL through Cloudflare Hyperdrive, then query it with Drizzle. Void applies your migrations on deploy. ### Backend Features - [Authentication](https://void.cloud/guide/auth.md): Add Better Auth to your app, including its database, API routes, and client. Start with email and password or a social provider. - [AI](https://void.cloud/guide/ai.md): Run Workers AI models and provider APIs from server code. Provider requests go through Cloudflare AI Gateway. - [Email](https://void.cloud/guide/email.md): Send transactional email, receive messages in route handlers, and inspect outgoing mail in a local inbox. - [Sandboxes](https://void.cloud/guide/sandboxes.md): Run commands, work with files, and connect to servers inside an isolated Cloudflare Sandbox. - [Cron Jobs](https://void.cloud/guide/jobs.md): Schedule work in crons/. Each file sets a cron expression and a handler that Void registers on deploy. - [Queues](https://void.cloud/guide/queues.md): Process work asynchronously with a consumer in queues/, then send it typed messages from your app. - [WebSockets](https://void.cloud/guide/websockets.md): Send typed messages between the server and connected clients. Each route keeps its state in a Durable Object. - [Server-Sent Events](https://void.cloud/guide/sse.md): Stream events from a route handler to the browser. Void formats the messages, sends keepalives, and closes the stream. - [Live Event Streams](https://void.cloud/guide/live.md): Subscribe a browser to several topics over one SSE connection, and publish events from routes, jobs, or queues. #### Email - [Sending Email](https://void.cloud/guide/email/sending.md): Send transactional email with sendEmail. Void captures messages in a local inbox during development. - [Receiving Email {#inbound}](https://void.cloud/guide/email/receiving.md): Receive mail with handlers in email/. Inbound email is available in native Void apps. - [Email Domains and Setup](https://void.cloud/guide/email/domains.md): Register an email domain on a Void platform, or configure sending and receiving in your own Cloudflare account. ### Development & Deployment - [Testing](https://void.cloud/guide/testing.md): Test a Void app with Vitest. With Vite+, run the tests through vp test. - [Remote Development](https://void.cloud/guide/remote-dev.md): Run local code against a project already deployed to your Void platform, including its database and storage. - [Deployment](https://void.cloud/guide/deployment.md): Deploy with void deploy. It builds your app, provisions resources, applies migrations, and publishes to Cloudflare or a team platform. - [Project Collaboration](https://void.cloud/guide/project-collaboration.md): Invite readers, collaborators, and project administrators to a hosted project. Direct Cloudflare deploys stay single-user. ### Meta Frameworks - [Meta-Frameworks](https://void.cloud/integrations/frameworks/overview.md): Keep your framework's routes and rendering, and use Void for databases, storage, jobs, and deployment. - [TanStack Start](https://void.cloud/integrations/frameworks/tanstack-start.md): Add Void beside the TanStack Start Vite plugin for databases, storage, and deployment, without a separate Cloudflare adapter. - [React Router v7](https://void.cloud/integrations/frameworks/react-router.md): Add Void beside the React Router Vite plugin for databases, storage, and deployment, without a separate Cloudflare adapter. - [Astro](https://void.cloud/integrations/frameworks/astro.md): Add Void to an Astro app for resource detection, typed database queries, migrations, and deployment. - [SvelteKit](https://void.cloud/integrations/frameworks/sveltekit.md): Add Void to a SvelteKit app for resource detection, typed database queries, migrations, and deployment. - [Nuxt](https://void.cloud/integrations/frameworks/nuxt.md): Add Void to a Nuxt app for resource detection, typed database queries, migrations, and deployment. - [Analog](https://void.cloud/integrations/frameworks/analog.md): Add Void to an Analog app for resource detection, typed database queries, migrations, and deployment. ### General - [Project Structure](https://void.cloud/reference/structure.md): See how routes, pages, middleware, and other optional directories map onto a Void app. - [Resource Inference](https://void.cloud/reference/resource-inference.md): Void detects the Cloudflare resources your code uses and provisions the matching bindings. Manual configuration is optional. ### Config - [Config](https://void.cloud/reference/config.md): Configure routing, inference, output, and the deployment target in void.config.ts. ### CLI - [CLI Reference {#cli}](https://void.cloud/reference/cli.md): Commands for creating a project, deploying it, and managing databases, secrets, domains, and a platform. - [Project Setup {#setup}](https://void.cloud/reference/cli/setup.md): Create a project with void init, prepare generated files, and inspect inferred resources. - [Connections and Authentication {#connect}](https://void.cloud/reference/cli/auth.md): Connect the CLI to Cloudflare or a Void platform, and sign in to the account that receives deploys. - [Projects {#project-commands}](https://void.cloud/reference/cli/project.md): Link a directory to a hosted project, then inspect deployments, logs, access, and rollbacks. - [Deployment {#deploy}](https://void.cloud/reference/cli/deploy.md): Build an app, provision its resources, apply migrations, and publish it. - [Database {#database}](https://void.cloud/reference/cli/database.md): Generate migrations, apply them, and update the local database from your Drizzle schema. - [Code Generation {#code-generation}](https://void.cloud/reference/cli/generate.md): Scaffold a Drizzle table and the routes that list, create, and fetch a row. - [Secrets and Environment {#secrets}](https://void.cloud/reference/cli/secrets.md): List, set, and remove production secrets. Secret values are never printed. - [GitHub and Builds {#github}](https://void.cloud/reference/cli/github.md): Connect GitHub so pushes build and deploy, whichever way you signed in to Void. - [Custom Domains {#custom-domains}](https://void.cloud/reference/cli/domains.md): Add, remove, and check custom domains for a hosted project or a direct Cloudflare deploy. - [Email {#email}](https://void.cloud/reference/cli/email.md): Inspect email usage and choose the recipients a project is allowed to send to. - [Platform Management {#platform-management}](https://void.cloud/reference/cli/platform.md): Select a platform, confirm changes, and run operator commands against that installation. - [Platform Installation {#void-platform-install}](https://void.cloud/reference/cli/platform-installation.md): Install a Void platform from the CLI, set its domain, and run its lifecycle commands. - [Platform Configuration {#plan-configuration}](https://void.cloud/reference/cli/platform-config.md): Create and edit platform plans and their limits from an administrator session. - [Platform Users and Projects {#operator-users}](https://void.cloud/reference/cli/platform-users.md): Manage platform users, their projects, and the plans assigned to their accounts. - [Project Zero Trust {#operator-zero-trust}](https://void.cloud/reference/cli/platform-zero-trust.md): Turn Cloudflare Access on or off for project hostnames from an administrator session. - [Platform Operations {#operator-deployments}](https://void.cloud/reference/cli/platform-operations.md): Inspect deployments, logs, and platform health, and preview changes before applying them. - [Platform Email {#operator-email}](https://void.cloud/reference/cli/platform-email.md): Administer platform email, including the shared sender and project recipient rules. ### API - [API Reference {#api-reference}](https://void.cloud/reference/api.md): Look up public imports, signatures, and return types. The guides cover setup and examples. - [Plugin and Configuration {#plugin}](https://void.cloud/reference/api/plugin.md): Add Void to Vite. The plugin sets up routing, migrations, and the Cloudflare Workers runtime. - [Handlers and Middleware {#handlers}](https://void.cloud/reference/api/handlers.md): Define HTTP handlers, middleware, validation, scheduled jobs, queues, and rendering. - [Rewrites {#rewrites}](https://void.cloud/reference/api/rewrites.md): Serve another route without changing the browser URL, and read the URL that was originally requested. - [Authentication {#auth}](https://void.cloud/reference/api/auth.md): Sessions, users, and auth clients from void/auth, plus the browser helpers in void/client. - [Fetch Client {#fetch-client}](https://void.cloud/reference/api/client.md): Call your routes from client code with a typed fetch. Paths and response types come from the generated route map. - [Durable State and WebSockets {#durable-state}](https://void.cloud/reference/api/durable.md): Persistent objects and typed WebSocket connections from void/durable. - [Deployment artifacts](https://void.cloud/reference/api/deploy.md): Prepare a built app, SPA, or static site for a managed platform deployment without platform credentials. - [Database and Seeding {#database}](https://void.cloud/reference/api/database.md): Query D1, PostgreSQL, or MySQL with the Drizzle client from void/db, and seed data from a script. - [Resource Clients](https://void.cloud/reference/api/resources.md): Clients for KV, object storage, AI, cache revalidation, and logs. - [Types {#types}](https://void.cloud/reference/api/types.md): Shared types for handler context, routes, URLs, and head metadata. - [Environment Variables {#environment}](https://void.cloud/reference/api/env.md): Read validated environment values and binding types from void/env. - [Pages Adapters {#framework-adaptors}](https://void.cloud/reference/api/pages.md): Vite plugins and client runtimes for React, Vue, Svelte, and Solid pages. ### Other - [Cloudflare](https://void.cloud/integrations/cloudflare.md): Deploy to Cloudflare Workers. Void detects the resources your app uses, creates bindings, and publishes the Worker. - [Hono](https://void.cloud/integrations/hono.md): Void route handlers run on Hono. Add hono to your app when your code imports from it directly. - [Node.js, Bun, and Deno](https://void.cloud/integrations/nodejs-bun-deno.md): Build a Void server for Node.js, Bun, or Deno, and run it on your own machine, in a container, or with another host. - [Using Void with Coding Agents](https://void.cloud/integrations/agents.md): Set up coding agents with void init, including project instructions and links to Void's docs and skills. ``` ## Test plan - [x] `vp run --filter ./docs build` writes `docs/.vitepress/dist/llms.txt` with 113 page links - [x] The same build writes `llms-full.txt` and a `.md` file beside each HTML page - [ ] After deploy, `https://void.cloud/llms.txt` serves this index Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1745006 commit e3de391

4 files changed

Lines changed: 581 additions & 2 deletions

File tree

‎docs/.vitepress/config.ts‎

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,65 @@
11
import type { IconOption } from '@voidzero-dev/vitepress-theme';
22
import { extendConfig } from '@voidzero-dev/vitepress-theme/config';
3-
import { defineConfig } from 'vitepress';
3+
import { defineConfig, type DefaultTheme } from 'vitepress';
44
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
5+
import llmstxt from 'vitepress-plugin-llms';
6+
7+
type SidebarItem = DefaultTheme.SidebarItem;
8+
9+
function hasDocumentLink(items: Array<SidebarItem>): boolean {
10+
return items.some((item) => {
11+
if (typeof item.link === 'string' && !item.link.includes('#')) {
12+
return true;
13+
}
14+
return item.items ? hasDocumentLink(item.items) : false;
15+
});
16+
}
17+
18+
// The same platform sidebar is registered on several paths, and some reference
19+
// groups only contain in-page anchors. Normalize that for the llms.txt index.
20+
function llmsSidebarItems(items: Array<SidebarItem>): Array<SidebarItem> {
21+
const prepared: Array<SidebarItem> = [];
22+
for (const item of items) {
23+
const children = item.items ? llmsSidebarItems(item.items) : undefined;
24+
const link = item.link;
25+
const hashOnly = typeof link === 'string' && link.includes('#');
26+
if (hashOnly && (!children || children.length === 0)) {
27+
continue;
28+
}
29+
30+
let next: SidebarItem = children ? { ...item, items: children } : { ...item };
31+
if (typeof link === 'string' && !hashOnly && children && !hasDocumentLink(children)) {
32+
next = { ...next, items: [{ text: item.text, link }, ...children] };
33+
}
34+
if (next.items?.length === 0 && !next.link) {
35+
continue;
36+
}
37+
prepared.push(next);
38+
}
39+
return prepared;
40+
}
41+
42+
function llmsSidebar(sidebar: DefaultTheme.Sidebar | undefined): DefaultTheme.Sidebar | undefined {
43+
if (!sidebar) {
44+
return sidebar;
45+
}
46+
if (Array.isArray(sidebar)) {
47+
return llmsSidebarItems(sidebar);
48+
}
49+
50+
const seen = new Set<unknown>();
51+
const unique: DefaultTheme.SidebarMulti = {};
52+
for (const [path, entry] of Object.entries(sidebar)) {
53+
if (seen.has(entry)) {
54+
continue;
55+
}
56+
seen.add(entry);
57+
unique[path] = Array.isArray(entry)
58+
? llmsSidebarItems(entry)
59+
: { ...entry, items: llmsSidebarItems(entry.items) };
60+
}
61+
return unique;
62+
}
563

664
const referenceItems = [
765
{
@@ -187,7 +245,13 @@ export default extendConfig(
187245
},
188246

189247
vite: {
190-
plugins: [groupIconVitePlugin()],
248+
plugins: [
249+
groupIconVitePlugin(),
250+
llmstxt({
251+
domain: 'https://void.cloud',
252+
sidebar: llmsSidebar,
253+
}),
254+
],
191255
},
192256

193257
themeConfig: {

‎docs/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"reka-ui": "catalog:",
1515
"vitepress": "2.0.0-alpha.20",
1616
"vitepress-plugin-group-icons": "catalog:",
17+
"vitepress-plugin-llms": "catalog:",
1718
"void": "workspace:*",
1819
"vue": "catalog:",
1920
"wrangler": "catalog:"

0 commit comments

Comments
 (0)