Skip to content

Day one: content shaped by files

Nibble 0.1.0 is out. A CMS you run as your own Rails application, where the shape of your content lives in YAML beside your code and everything else is ordinary Rails.

Mahfuz Shaikh2 min read

A posts collection's schema file on a stack of cards, marked 0.1.0

Nibble 0.1.0 went out tonight. This log is where I'll write down what gets built, and more usefully, what I find out along the way.

What it is

Nibble is a content management system you run as your own application. It isn't a service you sign up for. You install it, and it becomes your site: your theme, your content, your server.

The idea it's built around is that the shape of content belongs in files, next to the rest of your code. What belongs in the database is the content itself.

  • A collection says where its entries live and which blueprints they use, in a few lines of YAML.

  • A blueprint lists the fields, and every entry is checked against it before it's saved.

  • Globals, navigation and forms are declared the same way.

Change a file and the Control Plane changes with it. Nothing to click through, nothing to migrate by hand.

The dashboard

Three layers

Schema is read in three layers: Nibble's own, then the theme's, then the site's. The last one to define a handle wins. So a site that wants a different pages collection writes one file with that name and it replaces ours whole. I kept overrides whole-file on purpose. A merge of three YAML files is something nobody can read at 2am.

The stack

Rails 8 on the server. Inertia and Vue 3 for both the public site and the Control Plane, rendered on the server first, so visitors get finished HTML. SQLite holds the content, the cache and the job queue, which makes a whole site one machine and one database file. That's a feature, not a limit I'm apologising for.

Promises I made on day one

  • Upgrading never changes how a site behaves. New behaviour arrives switched off, and a site turns it on by raising load_defaults.

  • A site can take over any file of ours, with bin/rails nibble:eject, and Nibble keeps track of what it took, so upgrades can say when the original moved on.

  • MIT. Use it, change it, sell it. Keep the notice.

Next up: letting a folder of Markdown be a collection, because I want the documentation for this project to be written as files.

Try it

One command installs a site and asks a few questions on the way.

Installing Nibble