Logo

dev-resources.site

for different kinds of informations.

Database schema design of Splitwise application

Published at
12/16/2024
Categories
splitwise
expensemanagement
database
schema
Author
fightclub07
Author
11 person written this
fightclub07
open
Database schema design of Splitwise application

Splitwise gained vast popularity among travellers and friend groups. I built quicksplit, which works like splitwise and I want to share the schema design for a splitwise-like expense sharing and expense management application.

The application allows users to share expenses in groups and track how much they owe to each other. It enables users to create groups, manage expenses, track debts, and settle payments with ease. Let us have a look on how we can design the database for this.

Project features

  • User Authentication: Secure registration, login, and logout.
  • Group Management: Create and manage groups with customisable members.
  • Expense Management: Add, categorise, and split expenses among group members.
  • Debt Tracking: Automatic calculation and tracking of balances between users.
  • Settlement and Payment Tracking: Manual recording of settlements and payments.
  • Notifications: Email notifications for group activities like expense creation and for payment reminders.
  • Reporting: Generate and download payments report.

Database design

Letโ€™s dive into the schema of this application. Here is the image for your reference:

DB schema diagram

Users table:

This contains users information- you can also choose phone number instead of email or even both.

Groups and Members:

The groups table contains the groups and group details. Similarly, the members table contains the members of each group. The created_by in groups references id from users table. In members table, users_id references the id from users table and group_id references id from groups table.

Expenses:

This table tracks the expenses made in each group. It stores expense description, amount and the creator of the expense.

Balances:

This table stores the updated balances among the users. It keeps track of who owes how much to whom. One can find out the amount to be paid between two users in a single query through this table.

Payments:

To record the settlements, we need this table. It stores the payment between two users. It also has a unique payment_id column so that users can cross check in case of discrepancy.

Reminders(optional):

This records the payment reminders or notifications sent to the users. This supports the integration of sending payment reminders functionality. Admins can track how many email/mobile notifications were sent successfully and what were itโ€™s results.

Conclusion

I hope you enjoyed the article, any suggestions/improvements are welcome.

Reach out to me at [email protected] for any questions, feedback, or collaboration opportunities.

schema Article's
30 articles in total
Favicon
Schema Markup can boost your click-through rates by up to 30%?
Favicon
Custom schema specific Supabase Server Component clients in Grida Form workspace
Favicon
Zod for TypeScript Schema Validation: A Comprehensive Guide
Favicon
Database schema design of Splitwise application
Favicon
Validating JSON Schema with Fixed and User-Defined Keys in Python
Favicon
Using Zod's z.union: An Important Pitfall to Avoid
Favicon
Desvendando o Atlas: Gerencie Seus Esquemas de Banco de Dados com Estilo๐Ÿš€
Favicon
Customize Schema with @extend_schema_view
Favicon
Hotel reservation Schema design (PostgreSQL)
Favicon
How to Insert Data into Specific Table of PostgreSQL Schemas with Node.js
Favicon
Typesafe Supabase Flutter Queries
Favicon
Using yup to build schema with value parsing and validation.
Favicon
Designing an Optimal Database Schema for a Followers-Following System in a Blog-Post App
Favicon
JobPosting from Schema.org
Favicon
Unlocking the Power of Mongoose Schemas: Enhancements for Better Data Handling
Favicon
Unraveling the Power of Schema Markup: Elevating Your Website's Visibility and Performance
Favicon
How to handle complex json schema
Favicon
Navigating Django Schemas with Ease: How Django-schema-viewer Helps Developers
Favicon
๐ŸฃYour First Database Schema Change in 5 Minutes with Bytebase
Favicon
Multiplos schemas no mesmo tรณpico Kafka na linha de comando
Favicon
How pgroll works under the hood
Favicon
Automating API Documentation: A Journey from TypeScript to OpenAPI and Schema Governence with Optic
Favicon
Master schema validation in TypeScript with Zod
Favicon
๐Ÿš› Deploy Database Schema Migrations with Bytebase
Favicon
Random Data Generator Website
Favicon
Xata's JSON Column Type
Favicon
Introducing pgroll: Zero-downtime, Reversible, Schema Migrations for Postgres
Favicon
Designing Your Database Schema
Favicon
WHAT ARE THE TYPES OF SCHEMA MARKEUP?
Favicon
Iceberg Schema Evolution in Trino

Featured ones: