/cms-json

A lightweight CMS that loads and stores its data from/to a JSON file

Primary LanguageCSSMIT LicenseMIT

cms-json

A lightweight CMS loading and saving its data from/to a json file

Build Dependencies NPM Downloads MIT Node.js version

cms-json: A lightweight CMS loading and saving its data from/to a json file

Install

npm install -g cms-json

Playground

You can give cms-json a shot in the playground. It runs the CMS with a default JSON and Schema files. The Save functionality is disabled, but you can export your work via the 'Export' button.

Quick Start

cms-json

Then open your browser at:

http://localhost:3000

Why do I need this?

In a small IT company, the question of how and by whom your website can be updated is a recurrent one.

I have explored many solutions, from pure HTML sites controlled by the dev team, using fancy web frameworks, to sites generated by the marketing/product team using pure wysiwyg tools like Adobe Muse, not to mention heavy stuff like Wordpress or Drupal.

I finally came up with that very simple feature set:

  • The Content part of my site is stored as a JSON file
  • It can be edited by tech or non tech people via a very simple UI
  • It is embedded in the web site / web app by developers, and exploited with the technology they like
  • It can be stored in Git, so that in case of conflicts, it can be solved as with any other source files
  • Last but not least, it can be run as an npm module. No Apache, no nginx, no PHP, no database, just simplicity of use.

Although tons of CMS products exist on the market, I didn't find any one fulfilling the constraints above.

Usage

Usage: cms-json {OPTIONS}

Standard Options:

    --schema, -s   JSON schema file.
                   Default is data/schema.json.

    --data, -d     JSON data file.
                   Default is data/data.json.

    --port, -p     Server port.
                   Default is 3000.

What's new

v0.1.1

  • The 'model' files are now standard JSON Schema Draft 6 files. See http://json-schema.org/.
  • Added a 'Developer' mode, to add/edit/delete nodes and fields. This mode is activated by default. Switching to 'Author' mode disables all schema editing features.
  • On a side note, I migrated the entire code base to Typescript.

v0.1.3

  • Show JSON data and schema on the right and sync with editor
  • Improved author view (removed useless dev stuff)

API

run([options]) ⇒ *

Run an Express server embedding a simple UI for editing the content of the given dataFile.

Kind: global function
Returns: * - The express app

Param Type Description
[options] Object
[options.dataFile] Object A JSON file with the content. This parameter is mandatory. The content authored from the web site will be saved with that path name. The structure of this JSON file must match the model. See an example here: https://github.com/amelki/cms-json/blob/master/default/data.json
[options.modelFile] Object A JSON schema file representing the model to support/ease authoring via the UI. This parameter is mandatory. See an example here: https://github.com/amelki/cms-json/blob/master/default/schema.json
[options.port] Object The server port. 3000 by default