Rails engine

The optional Rails engine publishes the released entries as HTML pages, JSON and Atom feeds. It reads the release files in your repository. It needs no database and no migrations. It needs Rails 7.1 or later.

Install and mount

Put the gem in the default group of your Gemfile, so that it loads in production:

gem "shipnotes"

Mount the engine in config/routes.rb:

mount Shipnotes::Engine, at: "/changelog"

require "shipnotes" loads the engine when Rails is already loaded. Bundler does this in a standard Rails app. If you load Shipnotes before Rails, add require "shipnotes/engine" after Rails loads.

The release files must be in the deployed app. The engine reads them from the root at runtime.

Routes

With the engine mounted at /changelog, and with the surfaces app and api:

Path Shows
/changelog Every public entry, newest release first, as HTML.
/changelog/all The same page.
/changelog/all.json Every public entry as JSON.
/changelog/all.atom Every public entry as an Atom feed.
/changelog/app, /changelog/api One surface, as HTML.
/changelog/app.json, /changelog/api.json One surface, as JSON.
/changelog/app.atom, /changelog/api.atom One surface, as an Atom feed.

A surface page shows the releases that have at least one public entry on that surface. It shows only those entries. An unknown surface returns 404.

The engine’s route helpers are root_path, all_releases_path and surface_releases_path(key). From your app, call them through the engine name, for example shipnotes.surface_releases_path("api").

Pagination

Each page holds per_page releases. The default is 10.

Query Effect
?page=2 Shows page 2. The value must be a positive whole number.
?entry=ID Shows the page that holds the entry ID. A shared link keeps working after newer releases push the entry to a later page.

A page past the last page, a malformed page number or an unknown entry returns 404. ?entry= takes precedence over ?page=.

Formats

HTML

The page shows the title and the description. When surfaces are configured, a navigation bar links to every surface and to “All changes”. It also links to the Atom feed. Each release shows its version, or its id when it has no version, and its date. Entries are grouped by render.group_by. The fields in render.details appear under each title. When more than one detail field is shown, each detail has a label.

Each entry has the anchor #change-ID. Each release has the anchor #release-ID.

JSON

The JSON response has this shape:

{
  "title": "Product updates",
  "surface": "app",
  "page": 1,
  "total_pages": 1,
  "releases": [
    {
      "release": "2026.12.01.1",
      "date": "2026-12-01",
      "version": "1.1.0",
      "entries": [
        {
          "id": "export-widgets",
          "title": "Export widgets",
          "kind": "added",
          "audience": "public",
          "flag": "exports",
          "surfaces": ["app"],
          "status": "pending"
        }
      ]
    }
  ]
}
Key Value
title The surface title, or config.title on the “all” page.
surface The surface key, or null on the “all” page.
page, total_pages The current page and the page count.
releases The releases on this page: release, date, version (when the release has one) and entries.
entries Each entry’s id, every field in the entry file, and status.

status is released or pending. See Publication rules. Every field of a public entry is in the JSON, including fields that the HTML page does not show.

Atom

The feed has one Atom entry for each public change on the page. The entry title is the change title. The content is the detail fields. The link points to the HTML page with ?entry=ID#change-ID. The published date is the release date. The feed title is the surface title, or config.title.

Configuration

Add an initializer:

# config/initializers/shipnotes.rb
Shipnotes.configure do |config|
  config.title = "What's new"
  config.description = "Product updates and fixes."
  config.per_page = 10
  config.layout = "application"
  config.parent_controller = "PublicController"
  config.flag_enabled = ->(flag) { Flipper.enabled?(flag) }
end
Setting Default Purpose
root nil The folder that holds .shipnotes.yml. nil means Rails.root.
config_path nil The configuration file, relative to root. nil means .shipnotes.yml.
title "Changelog" The heading of the “all” page and the feed.
description nil The text under the heading. A surface page uses the surface description when it has one.
per_page 10 Releases per page. Values below 1 count as 1.
layout "shipnotes/application" The layout. The default is a small standalone page with light and dark colors.
parent_controller "ActionController::Base" The class that the engine controller inherits from, as a string.
flag_enabled nil A callable that takes a flag name as a string and returns true when the flag is on.
cache nil true reads the files once per process. false reads them on each request. nil follows config.eager_load.

The engine reads parent_controller when its controller class loads. Set it in an initializer, not later. With your own layout, call your app’s route helpers through main_app, for example main_app.root_path.

Publication rules

The engine shows only public entries. The publication key in .shipnotes.yml decides which entries are public:

  • Without audience_field, every entry is public.
  • With audience_field, an entry is public when its value is in public_values. The default is [public].
  • An entry without a value takes the field’s default. Without a default, the entry is not public.
  • A release without a public entry does not appear.

With flag_field and flag_enabled, the engine checks the flag of each entry on each request:

  • When flag_enabled returns false, the status is pending. The HTML page shows a “Coming soon” badge next to the title. The JSON has "status": "pending".
  • Otherwise the status is released. An entry without a flag, or an app without flag_enabled, is always released.

The Atom feed does not show the status.

Caching

With caching on, the engine reads .shipnotes.yml and the release files once per process. A deploy restarts the process, so new releases appear. To read the files again without a restart, call Shipnotes::Engine.reset!.

With the default cache = nil, caching follows config.eager_load. It is usually on in production and off in development. flag_enabled runs on each request in both cases.

Override the views

Copy a view to the same path in your app to override it:

Path in your app Renders
app/views/shipnotes/releases/index.html.erb The HTML page
app/views/shipnotes/releases/index.atom.builder The Atom feed
app/views/layouts/shipnotes/application.html.erb The default layout

These instance variables are available in the views:

Variable Value
@releases The releases on this page, newest first. Each has id, date, version and entries.
@surface The surface, with key, title and description, or nil on the “all” page.
@page, @total_pages The current page and the page count.

These helpers are available:

Helper Returns
shipnotes_groups(entries) Pairs of [heading, entries], grouped by render.group_by. The heading is nil without grouping.
shipnotes_details(entry) Pairs of [label, text] for the render.details fields that have text. The label is nil when only one detail field is configured.
shipnotes_release_title(release) The version, or the id when there is no version.
shipnotes_entry_url(entry) The URL of the page that holds the entry, with its anchor.
shipnotes_page_path(page) The path of a page number on the current surface.
shipnotes_feed_url The Atom feed URL of the current surface.
shipnotes_publication The Shipnotes::Publication for this request. Call status(entry) on it.
shipnotes_config The loaded .shipnotes.yml, a Shipnotes::Config.
shipnotes_settings The engine settings from Shipnotes.configure.

Each entry responds to id, title, surfaces and [] for any field, for example entry["body"].

Build your own page

To show the changelog in your own controller, read the data with Shipnotes::Publication:

config = Shipnotes::Config.load(Rails.root)
publication = Shipnotes::Publication.new(config, flag_enabled: ->(flag) { Flipper.enabled?(flag) })
releases = publication.releases(surface: "app")

releases applies the same publication rules as the engine. Ruby API lists the methods.