Skip to content

Theme color

Color source
Seed color
Palette style

CMS quick start

This page takes you from zero to reading back an entry you created yourself.

Dependency Version
Node.js 22 or newer
pnpm 10 or newer
Database PostgreSQL 16+ or SQLite 3.40+
终端窗口
pnpm add @hhl/cms

Content structure lives in cms.config.ts and is versioned with your code:

import { defineConfig, field } from '@hhl/cms';
export default defineConfig({
collections: {
post: {
fields: {
title: field.string({ required: true }),
slug: field.slug({ from: 'title' }),
body: field.richText(),
publishedAt: field.date(),
},
},
},
});
终端窗口
pnpm cms dev

It listens on http://localhost:8787 by default and creates tables on first start.

终端窗口
curl -X POST http://localhost:8787/api/collections/post \
-H 'content-type: application/json' \
-d '{"title":"Hello","body":"world"}'

Then read it:

终端窗口
curl http://localhost:8787/api/collections/post

If the entry you just wrote comes back, the whole chain works. Next, read the API reference and wire it into your frontend.