Lean CMS
A lightweight Rails CMS with in-context editing for marketing sites.
leancms.dev
Lean CMS is a Rails Engine that adds in-context content editing, page content management, blog & portfolio, settings, role-based authentication, and notifications to any Rails 8 application. It's designed for marketing sites: server-rendered, no separate CMS service to host, and one rake task to seed your whole site structure from YAML.
Why Lean CMS
- In-context editing — content editors hover over any page section to reveal an Edit overlay; no separate "admin" interface for day-to-day edits.
- You own your design — the gem never touches your layouts or styles; helpers pull content into your own ERB templates.
- YAML-defined structure — every page, section, and field is declared in
config/lean_cms_structure.ymland seeded with one rake task. - Built-in auth — login, password reset, and magic-link invitations all
shipped by the gem and namespaced under
/lean-cms. - 9 content types —
text,rich_text,image,boolean,url,color,dropdown,cards,bullets. - Version history — every content edit tracked via PaperTrail; one-click undo.
Installation
# Gemfile
gem "lean_cms"
bundle install
rails generate lean_cms:install
rails db:migrate
Then in app/controllers/application_controller.rb:
include LeanCms::Authentication
And in app/helpers/application_helper.rb:
include LeanCms::PageContentHelper
See the Getting Started guide for the full setup including User-model requirements and YAML structure.
Heads up — authentication. Lean CMS ships its own auth (login at
/lean-cms/login, sessions, magic-link invites). It coexists cleanly with Rails 8's built-inbin/rails generate authentication(the install generator detects + warns). If you're already using Devise or another auth gem, the gem currently still adds a second login screen — first-class host-auth integration is the v0.3 milestone. See issue tracker for status.
A taste of the helper API
<%# A whole section, hover-editable for admins %>
<%= cms_editable_section(page: "home", section: "hero", display_title: "Hero") do %>
<section class="hero">
<h1><%= editable_content("hero", "heading") %></h1>
<p><%= editable_content("hero", "subheading") %></p>
<% bg = page_content_image_url(@page, "hero", "background") %>
<% if bg %><%= image_tag bg, class: "absolute inset-0" %><% end %>
</section>
<% end %>
<%# Responsive optimized <picture> for static layout images %>
<%= lean_cms_picture_tag "wire-panel",
alt: "Wiring",
widths: [640, 1280],
sizes: "(min-width: 768px) 448px, 100vw",
class: "rounded-2xl shadow-lg" %>
Requirements
- Ruby ≥ 3.2
- Rails ≥ 8.0
- SQLite, PostgreSQL, or MySQL (SQLite is the happy path; see Database support for the compatibility matrix)
Roadmap
Lean CMS is 0.2.x — pre-1.0, API may shift between minors. Public roadmap:
- v0.2.x (current): feature-complete CMS surface, in-context editing, hourly-resettable demo. Ships its own auth.
- v0.3: host-auth adapter pattern — first-class integration with Devise / Rodauth / custom-auth hosts. Sibling
lean-cms-devise-examplerepo as the proving ground + public reference. - v0.4 (idea stage): AI-powered
lean_cms-scrapercompanion gem —bin/rails generate lean_cms:scrape URL=...writes a starterlean_cms_structure.ymlfrom an existing live website.
Demo
Live at demo.leancms.dev — sign in with demo@leancms.dev / demo123 and edit anything. Content resets every hour at :00 UTC. Source: Ovrland-Services/lean-cms-demo.
License
MIT. See LICENSE.