Installation

git-cms adds a schema-driven admin to a Next.js app (App Router). Content is stored as Markdown with YAML frontmatter in a GitHub repository — there is no database.

Install the package

npm install @celar/git-cms

Set environment variables

git-cms signs editors in with GitHub OAuth (NextAuth) and commits to the repository you configure.

AUTH_GITHUB_ID=your_client_idAUTH_GITHUB_SECRET=your_secretAUTH_SECRET=random_stringGITHUB_OWNER=your-usernameGITHUB_REPO=your-repo-nameGIT_CMS_ADMIN=1234567

GitHub OAuth app

Create an OAuth app in GitHub and use its client ID and secret above. GIT_CMS_ADMIN is the numeric GitHub user ID of the first admin.

Define your first schema

Every block is described once. Editors will see exactly these fields:

{  type: 'card', label: 'Card',  fields: [    t('title', 'Titel', true),    ta('text', 'Tekst'),    t('url', 'Link URL'),    { name: 'image', label: 'Afbeelding', fieldType: 'image', required: false, defaultValue: '' },  ],}

Mount the admin

import { AdminPage } from '@celar/git-cms/core'import { auth } from '@/auth'import { blockSchemas, pageSchemas } from '@/cms.config'
export default function Page() {  return AdminPage({ blockSchemas, pageSchemas, auth })}

Next steps

Read about block schemas and the available field types.