DEV Community

Cover image for FairShare - Making Shared Life Simpler
Sagar Gusain
Sagar Gusain

Posted on

FairShare - Making Shared Life Simpler

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

FairShare — Making Shared Living Simpler 🤝💰

What I Built

FairShare is a shared-living expense management application built for friends, roommates, and people living together in hostels, PGs, apartments, or shared rooms.

The idea came from a simple problem: when multiple people share expenses, it becomes annoying to remember who paid, who owes whom, how much everyone owes, and how to settle everything fairly.

FairShare follows a simple flow:

Record → Split → Track → Settle

Users can:

  • Create and join shared groups
  • Record group expenses
  • Split expenses equally or using custom amounts
  • Track individual balances
  • View settlement suggestions
  • Record and complete settlements
  • Ask questions about their group using natural language through the AI assistant

The AI assistant makes the experience even simpler. Instead of navigating through multiple screens, users can say things like:

"I paid ₹1000 for both of us for lunch."

FairShare understands the request and records the expense while keeping the actual financial calculations and validation inside the backend.

The project was built around the idea of making everyday shared expenses less complicated for the people you live with.

Demo

🎥 Watch the FairShare Demo

The demo shows the core workflow including expense creation, balance tracking, settlements, and the AI assistant.

Code

🔗 GitHub Repository

The repository contains the complete frontend, Spring Boot backend, database migrations, tests, and AI integration.

How I Built It

FairShare is built using:

  • React + TypeScript + Vite for the frontend
  • Java + Spring Boot for the backend
  • Spring Security + JWT for authentication
  • PostgreSQL for persistent data
  • Docker for the development environment
  • Ollama for local AI inference
  • Gemma 3 4B as the open-weight AI model

The most important part of the architecture is the separation between AI interpretation and application logic.

The flow is:

User → React → Spring Boot → Gemma → Structured Intent → Validation → Domain Service → Database

Gemma is responsible for understanding what the user is asking for and converting natural-language requests into structured intents.

For example:

"I paid ₹1000 for both of us for lunch."

The AI can identify the intent as creating an expense, identify the description and participants, and extract the monetary amount.

However, the AI does not directly access the database or perform critical financial operations.

The Spring Boot backend remains responsible for:

  • Authentication and authorization
  • Group membership validation
  • Expense validation
  • Participant validation
  • Monetary conversion and precision
  • Expense calculations
  • Balance calculations
  • Settlement calculations
  • Database operations

Money is stored as integer paise to avoid floating-point precision problems.

This means the AI acts as an interface for the application rather than becoming the source of truth for financial data.

Why Does Open Innovation Matter?

Open innovation made it possible to build the AI layer around a model that can run locally instead of making the core functionality dependent on a closed external AI API.

FairShare uses Gemma 3 4B through Ollama, allowing the AI assistant to run locally on the developer's machine.

This was particularly useful for experimenting with natural-language expense commands while maintaining control over how the model interacts with the application.

The most important lesson was that an AI model does not need to control the application's business logic to be useful.

Gemma understands the user's intent, while the deterministic backend decides whether that intent is valid and performs the actual operation.

This architecture provides a clear boundary:

AI interprets.

Backend validates.

Domain services calculate.

Database stores.

Using an open-weight model also made local experimentation and development possible without requiring every AI interaction to depend on a remote proprietary API.

My Agent Session

The project was developed with AI-assisted coding and debugging, including using GitHub Copilot Agent to implement, test, and refine parts of the application.

Prize Categories

🟢 Gemma

FairShare is entering the Gemma category.

The project uses Gemma 3 4B, running locally through Ollama, as the open-weight model powering the FairShare Assistant.

Gemma is integrated into the actual application workflow rather than being used as a standalone chatbot.

It interprets natural-language requests such as:

"I paid ₹1000 for both of us for lunch."

and produces structured information that the Spring Boot backend validates before performing the requested operation.

The backend remains authoritative for financial calculations, authorization, and database changes.

Technical Highlights

🔐 Authentication

FairShare uses JWT-based authentication with protected backend endpoints and group-level membership checks.

👥 Groups

Users can create and join groups using secure join codes and manage their shared-living expenses within those groups.

💰 Expense Splitting

Expenses support equal and custom splits.

Equal splits are calculated deterministically, including handling remainder paise so that the participant amounts always add up exactly to the original expense.

📊 Balances

Balances are calculated from actual payments, amounts owed, and completed settlements.

🤝 Settlements

FairShare generates deterministic settlement suggestions so group members can see how outstanding balances can be settled.

🤖 AI Assistant

The AI assistant allows users to interact with their group's expenses using natural language while keeping AI-generated actions behind backend validation.

What I Learned

The biggest lesson from building FairShare was that integrating AI into an application is not just about calling an LLM.

The difficult part is deciding where the AI should and should not have authority.

For financial operations, I wanted the model to understand the user's request but never become responsible for the final calculation.

This led to a design where:

Gemma understands the request → Spring Boot validates it → deterministic services execute it.

Building the project also helped me understand how authentication, database design, REST APIs, DTOs, validation, exception handling, deterministic financial calculations, and local AI inference can work together as one application.

What's Next

FairShare currently focuses on the core shared-living expense workflow.

Future improvements could include deploying the application, adding richer spending analytics, improving the AI assistant, and expanding the experience based on feedback from actual users.


Built for the Hacktoberfest Weekend Challenge: Build for a Friend 🚀

FairShare — Making Shared Living Simpler.

Top comments (0)