Documentation

Introduction

The VitNode Content Engine turns one TypeScript definition into a Postgres table, validation, staff API, permissions, AdminCP screens and optional public routes. Start with the beginner tutorial or add a feature.

The Content Engine turns one TypeScript definition into structured content for your plugin. You describe the fields of a content type, such as an article, and VitNode generates its database table, validation, staff API routes, staff permissions and AdminCP screens. Optional blocks add drafts, a public API, member writing, reports, comments, revisions and more.

Start here

The beginner tutorial builds one small newsroom, step by step, with an article that has a title, a slug and a body. Each page continues the previous one:

  1. First content type: define the article and manage it in the AdminCP.
  2. Drafts & publishing: keep unfinished articles private until staff publish them.
  3. Public API: let anyone read published articles, and only the fields you choose.
  4. Content list: show the articles at /news, a page at a time.
  5. Content page: give every article its own page at /news/:slug.

After that, Embedded list puts the newest articles under each one, and every guide below builds on the same article.

The News page from the tutorial, listing published articles with their dates and page links

What is generated and what you write

The Content Engine owns the data and the rules, and your plugin owns every page readers see:

You buildThe Content Engine providesYour plugin writes
The AdminCP screenThe list, search, sorting, create and edit forms, publish and hide actionsThe sidebar link and, optionally, custom cells or form layouts
A list pageThe list route, defineContentList, contentListQueryOptions, ContentListResults, ContentListPaginationThe route, the row layout and the labels
A record pageSlug resolution, 404s, redirects and metadata through contentDeliveryPageThe page component, with RichTextContent for rich text
A member formThe write routes, ownership, validation, useContentPublicWriteThe fields with AutoForm, success messages and navigation
Edit and Report buttonscanEdit and canReport per visitor, useContentPermissions, ReportButtonWhere the buttons go
CommentsThe thread route and its placement rulesThe comment section, its composer and its refresh

The page helpers come from @vitnode/core/tanstack/content, and every request goes through the typed fetcher with module: "content/<publicApi.path>". Public pages are the same for every reader, so they can be cached. The browser asks for anything that depends on the visitor, such as an Edit button, and the server checks every write again.

Add a feature

Each guide starts from a content type you already have, says what it needs at the top, and ends with something you can try. Reports and Relations, for example, only need the beginner path. Comments also need Member writing.

The AdminCP Articles screen from the tutorial, generated from the article's definition

What each option adds

From the definitionVitNode generates
fieldsA Postgres table with system columns and indexes, Zod schemas and a typed service
adminAn AdminCP list with search, sorting and bulk actions, plus create and edit forms
Every content typeStaff routes and the can_view, can_create, can_edit and can_delete permissions
publicationDraft and published states, a can_publish permission and Publish buttons
publicApiRead-only public routes that return only the fields you list
publicWriteCreate and edit routes for signed-in members, with server-set ownership
reportsA Report button readers use and a moderators' queue
threadNested replies with a route that returns the tree a page at a time
deliveryPage URLs, SEO metadata, slug redirects and sitemap entries
editorialRevisions with restore, preview links and scheduling
liveEditingField locks, an autosaved shared draft and presence in the AdminCP edit form
localizationA translations table and per-language fields and publishing
searchRecords in the site search index
visibilityHide and Unhide actions and a can_hide permission
duplicationA Duplicate action that copies a record into a new draft

Content types live in code and in your migrations, not in the database. There is no screen for creating a content type at runtime.

Reference

  • Options: every defineContentType option and how the options depend on each other.
  • Fields: every field.* helper with its options, column type and form control.
  • Plugin files: the files and exports the app and the API read from your plugin.