npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@celar/git-cms

v1.0.6

Published

Git-based CMS for Next.js - Store content as markdown in GitHub

Downloads

788

Readme

@celar/git-cms

A Git-based CMS for Next.js. Content lives as markdown files in your GitHub repo — no database, no separate deployment.


What this package provides

  • Admin UI at /admin for creating and editing content
  • GitHub OAuth authentication (via NextAuth v5)
  • REST API for reading/writing markdown files to GitHub
  • Schema system to define your content structure
  • Utilities to read and render content in your frontend

You wire it into your Next.js app by creating a few files and defining your content schemas.


In your Next.js project

1. Install

npm install @celar/git-cms

2. Files to create

your-app/
├── app/
│   └── admin/
│       ├── [[...cms]]/
│       │   └── page.tsx                    # renders the admin UI
│       └── api/
│           ├── auth/[...nextauth]/
│           │   └── route.ts                # GitHub OAuth endpoint
│           └── cms/[...cms]/
│               └── route.ts                # CMS read/write API
├── cms.config.ts                           # your content schemas
└── .env.local

3. Admin page

app/admin/[[...cms]]/page.tsx

import { AdminPage } from '@celar/git-cms/core'
import { blockSchemas, pageSchemas } from '../../../cms.config'

export default function Page() {
  return AdminPage({ blockSchemas, pageSchemas })
}

4. Auth route

app/admin/api/auth/[...nextauth]/route.ts

export { handlers as GET, handlers as POST } from '@celar/git-cms/auth'

5. CMS API route

app/admin/api/cms/[...cms]/route.ts

export { GET, POST, DELETE } from '@celar/git-cms/core'

6. Define your schemas

cms.config.ts

import type { BlockSchema, PageSchema } from '@celar/git-cms'

export const blockSchemas: BlockSchema[] = [
  {
    type: 'hero',
    label: 'Hero',
    fields: [
      { name: 'heading', label: 'Heading', fieldType: 'text', required: true },
      { name: 'body',    label: 'Body',    fieldType: 'richtext' },
      { name: 'image',   label: 'Image',   fieldType: 'image' },
    ],
  },
]

export const pageSchemas: PageSchema[] = [
  {
    type: 'page',
    label: 'Page',
    contentPath: 'content/pages',  // folder in your GitHub repo
    allowedBlocks: 'any',
  },
]

7. Environment variables

.env.local

GITHUB_OWNER=your-username
GITHUB_REPO=your-repo

AUTH_GITHUB_ID=your-oauth-app-id
AUTH_GITHUB_SECRET=your-oauth-app-secret
AUTH_SECRET=random-secret-string        # openssl rand -base64 32

Setup GitHub OAuth

  1. Go to GitHub → Settings → Developer settings → OAuth Apps → New OAuth App
  2. Fill in:
    • Homepage URL: http://localhost:3000
    • Authorization callback URL: http://localhost:3000/admin/api/auth/callback/github
  3. Copy the Client IDAUTH_GITHUB_ID
  4. Generate a Client SecretAUTH_GITHUB_SECRET
  5. For production, create a second OAuth App with your live domain, or update the callback URL

Reading content in your frontend

Content is stored as markdown with YAML frontmatter in your GitHub repo. Read it server-side using the markdown utility:

import { parseMarkdown } from '@celar/git-cms/markdown'
import fs from 'fs'

const raw = fs.readFileSync('content/pages/home.md', 'utf-8')
const page = parseMarkdown(raw)
// page.title, page.slug, page.blocks[]

Navigation

Pages opt in to navigation via frontmatter:

---
title: About
slug: /about
navEnabled: true
navTitle: About Us
navOrder: 2
navParent: /company    # optional: nests under another page's slug
---

Build a nav tree server-side:

import { buildNav } from '@celar/git-cms/nav'

const nav = buildNav(['content/pages'])
// nav.items[] sorted by navOrder, nested by navParent

Field types

| Type | Description | |------|-------------| | text | Single-line text | | textarea | Multi-line text | | richtext | Tiptap rich text editor | | number | Numeric input | | boolean | Toggle | | image | Single image | | imagelist | Multiple images | | dropdown | Select — requires options: [{ label, value }] | | pagepicker | Pick a page by slug — requires contentPath |


Package exports

| Import | Use | |--------|-----| | @celar/git-cms | Types, markdown utilities, settings utilities | | @celar/git-cms/core | AdminPage, GET, POST, DELETE | | @celar/git-cms/auth | handlers, auth, signIn, signOut | | @celar/git-cms/markdown | parseMarkdown, serializeToMarkdown | | @celar/git-cms/nav | buildNav | | @celar/git-cms/styles | Scoped admin CSS |


License

MIT