Extending Nibble
Extending Nibble
The seams a site adds its own behaviour through, so an upgrade never conflicts with what you added — and when you do not need one at all.
Nibble adds behaviour through seams: places a site can add behaviour of its own where Nibble will keep finding it, so an upgrade never conflicts with what you added.
After reading this guide, you will know:
- Why editing Nibble’s own files is the expensive way to change it.
- Which seam fits which job.
- When you do not need a seam at all.
1. Why seams
Everything under vendor/nibble/ is Nibble’s, and every release replaces it. Edit one of those files and it works —
until the next upgrade, which refuses to go ahead until you deal with it. Use a seam instead and the upgrade never
notices.
Important
bin/rails nibble:check warns about every file of Nibble’s you have changed in place. That list is exactly what the
next upgrade will refuse on. See
Upgrading.
2. Before you reach for one
Most things people want to add are a schema change, not code:
| You want | It is |
|---|---|
| a new kind of content | a collection |
| a new field | a line in a blueprint |
| a new block on landing pages | a set in a replicator, and a .vue file |
| a form that reaches your CRM | an api delivery |
| figures or a feed from another system, kept up to date | a scheduled task |
| to tell another system something changed | a webhook, set up in the Control Plane |
None of those needs a seam, and all of them are easier to live with. Reach for a seam when you need behaviour.
3. The seams
| Seam | For | Guide |
|---|---|---|
app/ |
your own models, controllers, jobs and mailers | Ruby hooks and events |
config/initializers/*.rb |
your own Ruby, run at boot | Ruby hooks and events |
load hooks :nibble_entry, :nibble_term, :nibble_asset |
behaviour on a record, without reopening its class | Ruby hooks and events |
Nibble::Events.subscribe |
reacting after content changes | Ruby hooks and events |
Nibble::Forms.register_handler |
a form that does something Ruby has to do | Ruby hooks and events |
Nibble::Tasks.register_handler |
Ruby that runs on a schedule, updating a global or calling an API | Ruby hooks and events |
| Webhooks, in the Control Plane | telling another application | Ruby hooks and events |
app/views/layouts/nibble/mailer.html.erb, and each email’s views |
how the emails Nibble sends look, and what they say | Emails |
site/cp/pages/<same path as ours>.vue |
replacing a Control Plane screen | Customising the Control Plane |
site/cp/slots/*.vue |
the Control Plane’s logo, sidebar and scripts | Customising the Control Plane |
Gemfile |
gems of your own | Ruby hooks and events |
/api/v1/… content endpoints |
reading published content from another website or app | The Content API |
/api/v1/operations and /mcp |
changing content from another program or an AI agent, as a person | The management API and MCP |
site/agents/*.md |
telling agents your site’s editorial rules | The management API and MCP |
bin/rails nibble:dev:mcp |
an agent building your theme or code | Building with an agent |
4. The guides in this section
| Page | Look here for |
|---|---|
| Ruby hooks and events | your own code, load hooks, event subscribers, form and task handlers, webhooks |
| Customising the Control Plane | replacing a screen, and the logo, sidebar and scripts |
| Emails | the look and wording of the emails Nibble sends |
| The management API and MCP | changing content from another program or an AI agent |
| Building with an agent | an agent building your theme or code |
| The Content API | reading published content from another website or app |
Nibble has no installable plugin package: behaviour is added through the seams above. bin/rails nibble:generate:plugin
explains this and does nothing.