CMS
Edit Markdown documents in the Console, keep every draft, and publish to your site or a pull request.
Deploys on
The CMS is vite-hub/cms, built on Content. Add extends: cms to server/content.ts to store your document collections. It turns on Workspace, Database, and Blob, adds the Workspace and its history tables, and adds a Database when your app has none. You write no Workspace, Database, or schema code.
import { defineContent } from 'vite-hub/content'
import { documents } from 'vite-hub/content/collections'
import { cms } from 'vite-hub/cms'
import { z } from 'zod'
export default defineContent({
extends: cms,
collections: {
posts: documents({ path: 'posts/**/*.md', fields: { title: z.string() } }),
},
})Pick a setup
Section titled "Pick a setup"Start with the Blob + Database store. One option changes the store, and the collections stay the same.
| Setup | You add | You get |
|---|---|---|
| Blob + Database store | extends: cms in server/content.ts | Drafts, revisions, and published documents in your Blob store and Database, plus scheduled publishing. Runs wherever Blob and Database work, with no GitHub access. |
GitHub store, commits to main | extends: [cms, { repo: 'owner/name' }], and VITEHUB_GITHUB_TOKEN | Documents are files in your repository. A save is a commit on the vitehub/content draft branch. A publish is one commit on main. Checkout and Console edits meet in Git. No Blob store. |
| GitHub store with pull requests | publish: 'pr' in the same options | A publish opens a pull request into main. Review it, wait for checks, and merge it any way you like. The Console shows the link until it merges. |
No wiring to write
The preset adds the Workspace, its history tables, and a Database if needed.
vitehub inspect definitions lists each piece.Keep content in Git
Set
repo to keep published documents and drafts on separate branches, where each publish is a commit.Publish through pull requests
publish: 'pr' opens a pull request for each publish, keeping documents pending until it merges.Edit, preview, and publish
Section titled "Edit, preview, and publish"The CMS stores your collections. Content does the rest, on both stores:
- Edit in the Console: editor, media library, and revision history.
- Preview drafts on your own pages before you publish.
- Edit together: presence, edit leases, and live editing.
- Publish on a schedule on the Blob + Database store.
- Edit from the terminal with
vitehub content, or let an Agent draft and publish with the Content Agent Capability. - Read published documents from server routes and from the browser at
/api/content/**.
Deploy and operate
Section titled "Deploy and operate"- Roles and access: give each user a role with the Better Auth
adminplugin. - Hosts: where each store runs and what to provision before a hosted deploy.
- Limits and errors: GitHub store limits and fixes for each error code.
- Server API: package exports and every preset option.