A clean Rails 8 starter template with:
- Importmap, Turbo, and Stimulus
- Bootstrap 5 layout inspired by SB Admin
- Font Awesome icons
- Auth, authorization, uploads, pagination, markdown, and more
- Ready-to-use dashboard-style UI structure
This project is intended as a solid foundation for admin panels, SaaS backends, and internal tools.
Core
- Ruby: 3.2.x
- Rails:
~> 8.0.1 - Database: PostgreSQL (
pg) - App server: Puma
Frontend
- Bootstrap: via
bootstrapgem (5.x) + Importmap for JS - Font Awesome:
font-awesome-sass - Icons & UI: SB Admin–style layout components
- JS tooling:
importmap-railsturbo-railsstimulus-railssprockets-railsfor classic asset pipeline
- Charts:
chart.jsvia Importmap pin (for dashboards)
- Optional:
- jQuery via Importmap (for legacy/SB scripts if needed)
Backend & Features
- Authentication: Devise
- Authorization: CanCanCan
- File Uploads: CarrierWave
- Image Processing: MiniMagick + image_processing
- Pagination: Kaminari
- Markdown: Redcarpet
- Rich Text / WYSIWYG (legacy): wysihtml5-rails
- CKEditor 5: ckeditor5
- Config / ENV: dotenv-rails
- JSON APIs: Jbuilder
- Performance: bootsnap
Some of the main gems in this template:
rails: Full-stack web framework.bootstrap: Bootstrap 5 for styling and layout.font-awesome-sass: Font Awesome icons via SASS.importmap-rails: Manage JS dependencies without Node/Webpack.turbo-rails: Turbo-powered navigation and updates.stimulus-rails: Modest JavaScript for dynamic behavior.devise: Authentication.cancancan: Authorization.carrierwave: File uploads.mini_magick&image_processing: Image processing.kaminari: Pagination.redcarpet: Markdown rendering.dotenv-rails: Environment variables.jbuilder: JSON views.
config/importmap.rb pins (excerpt):
pin "application"
pin "@rails/ujs", to: "https://ga.jspm.io/npm:@rails/[email protected]/lib/assets/compiled/rails-ujs.js"
pin "@hotwired/turbo-rails", to: "turbo.min.js"
pin "@hotwired/stimulus", to: "stimulus.min.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin_all_from "app/javascript/controllers", under: "controllers"
pin "@popperjs/core", to: "popper.js", preload: true
pin "bootstrap", to: "bootstrap.min.js", preload: true
pin "jquery", to: "https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"
pin "chart.js/auto", to: "https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.js", preload: true
pin "sb-admin-2", to: "sb-admin-2.js"
pin "dashboard", to: "dashboard.js"
pin "topbar_badges", to: "topbar_badges.js"app/javascript/application.js (expected pattern):
import "@hotwired/turbo-rails"
import "@hotwired/stimulus-loading"
import "controllers"
import "bootstrap"
import "sb-admin-2"
import "dashboard"
import "topbar_badges"Ensure the layout includes:
<%= javascript_importmap_tags %>This template is designed to work from schema.rb only.
Migrations in the repository may be removed to keep the template lean.
To set up your database, use schema:load instead of running all migrations manually.
Example:
default: &default
adapter: postgresql
encoding: unicode
username: <%= ENV.fetch("DB_USERNAME", "postgres") %>
password: <%= ENV.fetch("DB_PASSWORD", "") %>
host: <%= ENV.fetch("DB_HOST", "localhost") %>
port: <%= ENV.fetch("DB_PORT", 5432) %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %>
development:
<<: *default
database: <%= ENV.fetch("DB_NAME_DEVELOPMENT", "base_rails8_development") %>
test:
<<: *default
database: <%= ENV.fetch("DB_NAME_TEST", "base_rails8_test") %>
production:
<<: *default
database: <%= ENV.fetch("DB_NAME_PRODUCTION", "base_rails8_production") %>Using .env (loaded by dotenv-rails):
DB_USERNAME=postgres
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME_DEVELOPMENT=base_rails_development
DB_NAME_TEST=base_rails_test
DB_NAME_PRODUCTION=base_rails_production
DB_USERNAME_PRODUCTION=base_rails
DB_PASSWORD_PRODUCTION=change_me_securelyrails db:create
rails db:schema:load
# optionally
rails db:seedNote: Because this template is schema-driven, keep
schema.rbup to date. New projects cloned from this repo should bootstrap the database withdb:schema:load.
-
Clone the repository
git clone https://github.com/jeffersonspeck/base_rails.git your-project cd your-project -
Install Ruby/Rails dependencies
bundle install
-
Configure environment
- Create
.envbased on the example above. - Adjust
config/database.ymlif needed.
- Create
-
Database
rails db:create rails db:schema:load
-
Run the server
rails server
Visit: http://localhost:3000
Pull requests and issues are welcome. If you extend the layout, components, or starter features, feel free to share improvements.
This project is licensed under the MIT License.
You are free to use, modify, distribute, and sublicense this template, provided that the MIT license notice is included in copies or substantial portions of the software.