The project is in a healthy, maintained state
Generate Mermaid ERD for Ruby on Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 5.2
 Project Readme

English | 日本語

Rails Mermaid ERD

test Gem Version

Generate Mermaid ERD from your Ruby on Rails application.

Demo Page

Mermaid ERD can be generated at will. The generated ERD can be copied in Markdown format, so they can be easily shared on GitHub. You can also save it as an image, so it can be used in environments where Mermaid is not available. The editor is a single HTML file, so the entire editor can be shared.

Installation

Add this line to your application's Gemfile:

gem "rails-mermaid_erd", group: :development, require: false

And then execute:

$ bundle install

Add this line to your application's Rakefile:

begin
  require "rails-mermaid_erd"
rescue LoadError
  # Do nothing.
end

Usage

Run rake task mermaid_erd will generate <app_root>/mermaid_erd/index.html.

$ bundle exec rails mermaid_erd
# or
$ bundle exec rake mermaid_erd

Simply open the generated <app_root>/mermaid_erd/index.html in your browser.

This file is not required for Git management, so you can add it to .gitignore if necessary

mermaid_erd

<app_root>/mermaid_erd/index.html is a single HTML file. If you share this file, it can be used by those who do not have a Ruby on Rails environment. Or, you can upload the file to a web server and share it with the same URL.

It would be very smart to generate it automatically using CI.

Configuration

./config/mermaid_erd.yml to customize the configuration. See ./docs/example.yml for an example configuration.

The setting items are as follows.

key description default
result_path Destination of generated files. mermaid_erd/index.html

License

The gem is available as open source under the terms of the MIT License.