Welcome to the documentation for the Folio Rails Engine. This project provides a modular, extensible CMS engine for Ruby on Rails applications, featuring a modern admin interface, flexible content modeling, and a robust component system.
Note: This documentation is a living document. Chapters will be expanded and refined as the migration from legacy sources progresses.
- Architecture — Engine structure, main models, data flows, diagrams
- Components — ViewComponents, UI structure, BEM, Stimulus, React
- Atoms — Content atoms, types, usage, extension
- Admin Console — Admin UI, scaffolding, user roles, multi-site
- Files & Media — File handling, media, metadata, placements
- Forms — Form building, validation, custom inputs
- Emails & Templates — Email templates, newsletters
- Configuration — Engine setup, options, localization
- Testing — Testing strategies, helpers, best practices
- HTML Sanitization — Guidelines for implementing HTML sanitization
- Troubleshooting — Common issues and solutions
- Upgrade & Migration — Upgrading projects, migration guides
- Extending & Customization — Generators, overrides, custom code
- Concerns — Reusable model and controller modules
- Jobs — Background processing overview
- Seeding — Demo data & tasks
- Sitemaps — XML sitemap generation
- FAQ — Frequently asked questions
Architecture:
- Overview of the engine's structure, key models, and data flows. Includes Mermaid diagrams for visual reference.
Components:
- How to use and build UI components with ViewComponent, BEM, and Stimulus. Covers React integration and best practices.
Atoms:
- Working with content atoms, defining new types, and extending atom functionality.
Admin Console:
- Using and customizing the admin interface, scaffolding new resources, managing users and sites.
Files & Media:
- Managing files, media, placements, and metadata within Folio.
Forms:
- Building and validating forms, using custom inputs, and integrating with the admin UI.
Emails & Templates:
- Creating and managing email templates and newsletters.
Configuration:
- Engine configuration, initialization, and localization options.
Testing:
- Testing strategies, helpers, and best practices for Folio-based projects.
Troubleshooting:
- Solutions to common problems and error scenarios.
Upgrade & Migration:
- Guides for upgrading Folio and migrating projects to new versions.
Extending & Customization:
- Using generators, writing custom extensions, and overriding engine behavior.
FAQ:
- Modular CMS Engine – Pages composed of reusable CMS blocks (Atoms)
- Modern Admin Console – ViewComponent-based UI with generators for CRUD scaffolds
- File & Media Library – Uploaded files, placements, metadata, direct S3 uploads
- Multi-site & Localization – Multiple sites from one codebase, Traco-powered translated attributes
- Authentication & Roles – Devise integration, flexible abilities, optional cross-domain sessions
- Newsletter & Mailers – MailChimp bridge, generator-based mailers and templates
- Extensive Generators – Atoms, components, console scaffolds, blog, search indices, etc.
# 1. Add gems to Gemfile
bundle add folio
bundle add dragonfly_libvips
bundle add view_component
# 2. Install engine assets & migrations
rails generate folio:install
rails db:migrate
# 3. (Optional) Seed example data
rails db:seed
# 4. Start the server and open /console
rails s
# 5. Scaffold your first model in the admin
rails generate folio:console:scaffold ArticleRefer to the Configuration chapter after installation to tailor settings.
app/
components/folio/ # ViewComponents (UI)
inputs/ # Custom Simple-Form inputs
models/folio/ # Engine models (Site, Page, Atom…)
controllers/folio/ # Public & admin controllers
overrides/ # Safe place for engine overrides
cells/ # Legacy Trailblazer Cells (deprecated)
lib/generators/folio/ # Rich set of generators
Trailblazer Cells will be removed in favour of ViewComponents in the next major release.
See individual chapters for deeper dives into components, atoms, files, etc.
- Ruby >= 3.0
- Rails >= 6.1
- PostgreSQL (recommended), Redis (for Sidekiq)
- Image processing tools: libvips, jpegtran, exiftool, cwebp, gifsicle
- For video previews in tests: ffmpeg
Ensure these binaries are present on CI / production servers.
- New UI code should use ViewComponent. Support for Trailblazer Cells is deprecated and will be removed in the next major release.
- Follow BEM for SASS class names.
- Place project-specific patches in
app/overrides/to stay upgrade-safe. - Prefer generators over hand-written boilerplate.
- Next: Architecture →
- Components | Atoms | Admin Console | Files & Media | HTML Sanitization | Concerns | Jobs | Sitemaps
For more information, see the individual chapters linked above. This documentation will be updated as new content is reviewed and migrated from legacy sources.