@easy-cms/core
@easy-cms/core
The core of Easy CMS: the config, the typed Local API, the REST handler, auth and access control, hooks, drafts and versions, localization, uploads, webhooks and plugins. Part of Easy CMS, the embedded, code-first headless CMS for Nuxt and Next.js.
Install
Start with npm create easy-cms@latest, which installs this package with a framework adapter
and a database adapter. By hand:
npm install @easy-cms/core @easy-cms/db-sqlite
Or pnpm add, yarn add or bun add.
Usage
// easy-cms.config.ts
import { type CollectionDocument, defineConfig, isAdmin } from '@easy-cms/core'
import { sqlite } from '@easy-cms/db-sqlite'
const config = defineConfig({
secret: process.env.EASY_CMS_SECRET!,
db: sqlite({ url: 'file:./cms.db' }),
collections: [
{
slug: 'posts',
drafts: true,
access: { read: () => true, update: isAdmin },
fields: [
{ name: 'title', type: 'text', required: true },
{ name: 'slug', type: 'slug', from: 'title' },
{ name: 'body', type: 'richText' },
],
},
],
})
export default config
export type Post = CollectionDocument<typeof config, 'posts'>
The Nuxt and Next.js adapters (or easy-cms serve) serve the admin and REST API from this config;
useEasyCMS() / getEasyCMS(config) give you the Local API, typed from it.
From 1.0, breaking changes come only in a major release, with an upgrade guide. See Versions and deprecations and the changelog.
Links
Configuration · Local API · Documentation (ภาษาไทย) · GitHub
MIT License
Related Packages
Prepr personalization, A/B testing and preview toolkit for React, Next.js, Nuxt,...
Framework-agnostic client for Orbiter CMS — SvelteKit, Next.js, Nuxt, Remix
Version History
| Version | Released | License |
|---|---|---|
| 1.4.2 | MIT | |
| 1.4.1 | MIT | |
| 1.4.0 | MIT | |
| 1.3.0 | MIT | |
| 1.2.0 | MIT | |
| 1.1.0 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT | |
| 0.68.5 | MIT | |
| 0.68.4 | MIT | |
| 0.68.3 | MIT | |
| 0.68.2 | MIT | |
| 0.68.1 | MIT | |
| 0.68.0 | MIT | |
| 0.67.2 | MIT | |
| 0.67.1 | MIT | |
| 0.67.0 | MIT | |
| 0.66.1 | MIT | |
| 0.66.0 | MIT | |
| 0.65.0 | MIT | |
| 0.64.0 | MIT | |
| 0.63.0 | MIT | |
| 0.62.0 | MIT | |
| 0.61.0 | MIT | |
| 0.60.0 | MIT | |
| 0.49.0 | MIT | |
| 0.48.0 | MIT | |
| 0.47.4 | MIT | |
| 0.47.3 | MIT | |
| 0.47.2 | MIT |
Showing the latest 30 of 87. See every release on npm
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 1.0.0-rc.0 | MIT |