ead
ead copied to clipboard
EAD(Entity Association Diagram) is a tool to make the development process of a Ruby on Rails project faster and easier. It is supporting all associations except has_and_belongs_to_many.
EAD (Entity Association Diagram)
EAD is a tool to initialize any Ruby on Rails project quickly by implementing associations from a generated JSON file.
EAD contains two parts;
- A user interface(called 'EAD') to generate JSON file
- A gem(called 'EAD gem' or 'ead') to modify the files of a Ruby on Rails project by using the generated JSON file
This repository contains the code of the user interface.
EAD gem can be accessible from this repository or rubygems.org
Live Demo
Please check live demo of EAD.
Examples
- Three videos are provided as example. If you want to check videos for previous versions, please check this link.
Built With
- React
- TypeScript
- React Flow
- zustand
- Vite
- Tailwind CSS
- Jest
- pnpm
Getting Started
Preparing ERD is the first step of any Ruby on Rails project. But, implementing ERD to a Ruby on Rails project can be time-consuming and repetitive. EAD is designed to solve these problems.
EAD is using drag and drop mechanism. Also, a new approach is used to draw associations between entities. Entities and tables are separated completely. So, multiple entities stored by one table can be defined easily.
More, a JSON file can be produced by using EAD quickly and this JSON file can be implemented into a Ruby on Rails project by the EAD gem. So, any project can be started with ready associations without consuming any time.
EAD is not an intermediate step between ERD and the process of adding associations. EAD is developed to be used instead of ERD.
Prerequisites
- A modern web browser (Firefox or Chrome is suggested).
- A new Ruby on Rails project
Usage
EAD can be accessible with any modern browser. To learn how to use EAD, check this document. A JSON file should be generated by the clicking 'Download EAD' button when all associations are ready.
Install EAD gem by running gem install ead
.
Then, there are two choices to use the generated JSON file;
- Move the generated JSON file (its name must be 'EAD.json') to the root folder of your project and run
ead
. - Run
ead 'path_of_the_generated_file'
in the root folder of your Ruby on Rails project. Don't forget to put quotation marks(').
⚠️: Save your files before running the gem.
⚠️⚠️: Please double-check the files generated by the gem.
⚠️⚠️⚠️: EAD is still under development. So, it is not recommended to use this gem with ongoing projects.
- If all files are generated as expected, run
bundle exec rails db:migrate
.
Features
-
All association buttons are shown when the cursor is hovering on an entity.
-
Any table, association, attribute can be deleted as shown in the document.
-
'has_many' association can be added by using
.
-
'has_one' association can be added by using
.
-
':through' association can be added by using
.
-
Polymorphic associations can be added easily.
-
STI models can be added easily.
-
The EAD file can be downloaded by clicking the "Download EAD" button.
-
Any EAD file can be uploaded by clicking the "Upload EAD" button and selecting a file. EAD file generated by v0.4.0, v0.4.1, v0.4.2, v0.4.3, v0.4.4, v0.4.5 and v0.4.6 can be uploaded without any problem.
-
EAD can be reset to the initial state by clicking the 'Reset' button.
-
Dark mode is available.
-
Main color can be changed.
-
Showing the name of associations is an option.
Run EAD locally
- Download Node.js
- Install pnpm globally by running
npm install -g pnpm
- Run
pnpm install
- Run
pnpm run dev
Test EAD
- Install pnpm globally by running
npm install -g pnpm
- Run
pnpm install
- Then, run
pnpm run test
Author
Reach out to me at one of the following places!
👤 Hasan Özovalı
- Website: ozovalihasan.com
- LinkedIn: Hasan Özovalı
- Github: @ozovalihasan
- Twitter: @ozovalihasan
- Mail: [email protected]
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Show your support
Give a ⭐️ if you like this project!