close
close

SpendWise – Budget Management App (Ruby on Rails + React) – Part 2

SpendWise – Budget Management App (Ruby on Rails + React) – Part 2

One of the first steps is to set up a clear structure for the data flow of the application. This is where an ERD (Entity Relationship Diagram) comes in handy. It is an essential tool to map how different entities (such as users, transactions, budgets, etc.) interact with each other within the app.

What is an ERD and why is it important?
For those unfamiliar, an ERD is a visual representation of how entities within a system relate to each other. It outlines the relationships between different models (tables in the database) and helps visualize the data flow and possible connections.

In my case, the ERD will serve as a guide for defining my app’s database structure and understanding the relationships between users, budgets, transactions, and more. This upfront planning will ensure a smoother coding process when building the Rails models and setting up the React components.

The core entities in my app
Here’s a preview of the key entities and relationships I’m planning:

User: The core entity that is linked to multiple budgets and transactions.
Budgets: Users can create multiple budgets, each with a unique name and a set of financial goals.
Transactions: Each budget tracks income and expenses, helping users manage and categorize their spending.
Categories: Budgets and transactions are grouped into categories for better organization and insight.

Diagrams of the relationships
Below is a summary of the relationships I am considering:

  • A user can have multiple budgets (one-to-many relationship).
  • A budget can have multiple transactions (one-to-many relationship).
  • Transactions belong to both a budget and a category (many-to-one relationship).

ERD expenditure

To visually map this ERD, I use a really cool tool called dbdiagram.io. It is easy to use and it provides a clear, interactive view of your database structure. If you are working on a similar project, I highly recommend you to check it out. You can find other tools like –

What now?
Now that I have the ERD mapped out, I am ready to dive into coding the database models and associations in Rails. In my next post I will describe how I set up validations, implement user authentication and more.

Stay tuned for more updates as I continue to build this project!