0% found this document useful (0 votes)
8 views92 pages

Smart Expense Tracker: Gamified Finance App

The document outlines the development of the 'Smart Expense Tracker,' a mobile application aimed at enhancing personal finance management by transitioning from manual tracking to an automated, gamified system. Its mission is to provide real-time data capture, automated calculations, and a token rewards system to incentivize positive financial behavior, ultimately fostering long-term fiscal health. The project addresses the limitations of traditional expense tracking methods, such as human error and delayed visibility, by offering a robust and engaging platform for users to manage their finances effectively.

Uploaded by

t8175883
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views92 pages

Smart Expense Tracker: Gamified Finance App

The document outlines the development of the 'Smart Expense Tracker,' a mobile application aimed at enhancing personal finance management by transitioning from manual tracking to an automated, gamified system. Its mission is to provide real-time data capture, automated calculations, and a token rewards system to incentivize positive financial behavior, ultimately fostering long-term fiscal health. The project addresses the limitations of traditional expense tracking methods, such as human error and delayed visibility, by offering a robust and engaging platform for users to manage their finances effectively.

Uploaded by

t8175883
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CHAPTER - 1

INTRODUCTION TO PROJECT

1.1 About the Project

The modern landscape of personal finance management demands tools that are not only
accurate but also engaging and instantaneous. This project presents the development of the
"Smart Expense Tracker," a robust mobile application designed to transition personal
financial accountability from tedious manual computation to an efficient, organized, and
rewarding digital process.
The fundamental purpose of this application is to monitor spending, manage individual
budgets, and, critically, incentivize positive financial behavior through a token rewards
system. By eliminating reliance on manual record-keeping or simple spreadsheet-based
tracking, which are known to be time-consuming and error-prone , the Smart Expense
Tracker provides a valuable utility for users seeking to manage and closely supervise their
monetary flows.

1.2 Project's Mission and Vision


Mission: Our Mission The mission is to transition personal financial accountability from tedious
manual computation to an efficient, organized, and rewarding digital process. This is achieved by
monitoring spending, managing individual budgets, and incentivizing positive financial behavior
through a token rewards system. It operates as a behaviorally reinforcing, real-time platform that
eliminates human error and ensures immediate data accuracy for better decision-making.

Vision: The vision is to be an active financial coaching tool that empowers users to achieve long-term
fiscal health and discipline. This is accomplished by leveraging a novel gamification system to convert
the passive task of tracking into an active, motivating behavioral process. Ultimately, the goal is to
guide users and raise their awareness about daily expenses to help them overcome financial wastage.

Services Offered

• Real – Time Data Capture


• Automated Computation
• Data Visualization
1
• Historical Audit
• Secure Authentication
• Gamified Rewards

Role in the Project Development


The typical role of Smart Expense Tracker in development includes :

 Mentorship and Guidance: Offering technical mentorship and guidance on


software development best practices.

 Resource Provision: Providing the necessary resources, whether financial, human,


or technological, to meet the project's demands.

 Execution Oversight: Ensuring smooth execution, efficient collaboration, and


meeting project deadlines.

Mission and Objectives:


The mission is to transition personal financial accountability from tedious manual
computation to an efficient, organized, and rewarding digital process. Its core purpose is
to monitor spending, manage individual budgets, and critically, incentivize positive
financial behavior through a token rewards system.

The objectives are to provide an accessible interface for users to log income and expenses
instantaneously. To automatically calculate and display daily and monthly spending totals
compared to the monthly salary. To generate clear, graphical representations for
investigating spending patterns. To maintain a detailed, searchable expense history.

1.3 Objectives of Project


The core objectives of the Smart Expense Tracker project are bifurcated into functional
goals, which focus on data processing and accuracy, and behavioral goals, which center on
user motivation and financial literacy.

Functional Objectives :

The following are some of the functional objectives of expense tracker app –

2
• Real-Time Data Capture: To provide a simple and accessible interface for users to log
income and expenses instantaneously at the point of transaction.

• Automated Computation: To automatically calculate and display daily and monthly

spending totals, comparing them against the user’s designated monthly salary.

• Data Visualization: To generate clear, graphical representations, such as monthly reports


and categorical charts, that provide a thorough investigation into spending patterns.

• Historical Audit: To maintain a detailed, searchable expense history, enabling users to


analyze previous financial transactions at any given time.

Behavioral Objectives (The Gamification Goal)

A primary objective, crucial to the "Smart" designation, is leveraging gamification to


motivate sustained positive financial habits. This objective is achieved specifically through
the design of the Token Reward system. The system is intended to:

• Incentivize Saving: To establish a clear, achievable financial goal (saving ₹2000 or more
every month) and provide immediate, tangible rewards (Tokens) upon meeting that
milestone.

• Foster Self-Regulation: To utilize positive psychological reinforcement—the release

of dopamine associated with achievement —to encourage self-managed goal setting and
consistent expense tracking.

• Increase User Engagement: By incorporating elements like progress tracking and


rewards, the application seeks to deepen user interaction and turn the often tedious task of
budgeting into an interactive and enjoyable process, thereby maximizing user [Link]
provide customized and cutting-edge software, mobile, and web-based solutions that meet
diverse business needs.

3
CHAPTER - 2 INTRODUCTION TO PROJECT

2.1 Overview of the Project

The "Smart Expense Tracker" is a highly functional Personal Financial Management System (PFMS)
delivered as a cross-platform mobile application. Its central purpose is to solve the pervasive problem
of financial mismanagement rooted in manual, error-prone record-keeping. The application moves
beyond being a mere digital ledger; it is designed to be a behaviorally reinforcing tool that ensures
financial accountability is efficient, organized, and rewarding.
The system is a contemporary evolution of classical accounting principles, modeling income, expenses,
and assets. By demanding real-time logging of transactions, it provides an immediate, accurate snapshot
of the user's financial standing, allowing them to proactively compare their current spending against
planned budgets.
The Smart Expense Tracker project is a robust, cross-platform mobile application designed to redefine
Personal Financial Management (PFM) by transitioning individual financial accountability from
tedious, error-prone manual record-keeping to an efficient, organized, and rewarding digital process.
Its core mission is to monitor spending and manage budgets, but its distinct value proposition lies in its
gamified reward system, which converts the traditionally passive chore of budgeting into an active,
motivating behavioral process.
This system offers users tangible Tokens upon achieving preset savings goals (e.g., saving ₹2000 per
month), serving as a powerful incentive for positive financial behavior and fostering long-term fiscal
discipline, aligning with the project's vision to be an active financial coaching tool.
Functionally, the application provides real-time data capture of income and categorized expenses,
automated calculations of the remaining balance, comprehensive data visualization through graphical
reports, and a detailed audit trail of all transactions.

2.2 Purpose and Goals


9
The primary purpose of the Smart Expense Tracker is to solve the pervasive problem of financial
mismanagement stemming from manual, error-prone record-keeping, thereby ushering in a new era of
efficient and accurate Personal Financial Management (PFM).

This is achieved by creating a robust, real-time application that allows users to instantaneously log
income and categorized expenses, automatically calculate their remaining balance against a set salary
benchmark, and generate detailed graphical reports for audit and analysis.

However, the project's purpose extends critically into the behavioral domain: it is designed not merely
as a passive ledger, but as an active financial coaching tool. The core purpose is to modify user habits
by making the act of saving desirable and rewarding.

This is accomplished through a gamified token rewards system that positively reinforces financial
discipline by issuing tokens upon the achievement of measurable savings goals (e.g., saving ₹2000 per
month), ultimately empowering users to foster self-regulation, overcome financial wastage, and achieve
long-term fiscal health.

2.3 Scope of the Project

The scope of the Smart Expense Tracker is deliberately focused on personal financial management for individuals
who require a streamlined, error-minimizing solution.

Target Audience and Usage

The primary users are individuals seeking to gain visibility and control over their daily and monthly spending.
This includes people who are currently using error-prone manual methods, resulting in misplaced decimal
points or incorrectly entered figures that lead to significant financial discrepancies. The mobile platform
ensures that tracking can be done "at the point of purchase," eliminating the delay inherent in traditional
month-end reconciliation.

Functional Scope

The application’s core functionality encompasses:

10
 Secure Authentication: Providing registration and login functionality, including the capture of the
user's initial Monthly Salary as the benchmark for budget tracking.

 Transaction Management: Allowing users to add new expenses, choose categories, and view a history
of their transactions.1 User-defined categories are included to ensure the system adapts to unique
spending patterns.

 Real-Time Dashboard: Displaying the critical financial metrics instantly: Total Salary, Total Expenses,
and Remaining Balance.

 Gamified Rewards: Implementing the precise logic for tracking monthly savings against the ₹2000
threshold and issuing Tokens upon achievement.

2.4 Platform & Programming Language

 Web-Based Application (Runs in a browser)

 Backend Server: Runs on a server (e.g. Python, Flask)

 Database: Relational Database (e.g., MySQL )

a) Programming Languages

Layer Language Used

Frontend HTML5, CSS3

Backend Python

Database Persistent Storage

Scripting JavaScript (for interactivity)


11
b) Packages and Libraries

Library / Purpose
Framework

Flask For handling request

[Link]
To create charts

c) Backend:

Package / Library Purpose

Flask Web server framework

Flask – login
For session management

Bcrypt For password encryption

Jinja2 For Templating Engine

Werkzeug For security and Utilities


12
2.5 IDE Used

Visual Studio Code (VS Code)

Visual Studio Code (VS Code) is a free, lightweight, and powerful source code editor
developed by Microsoft. It is widely used for web and software development due to its speed,
simplicity, and wide range of features.

VS Code is the most likely primary tool due to its cross-language flexibility, lightweight
nature, and comprehensive extension support for both the Python backend and the web
frontend.

Primary Purpose: A lightweight, yet powerful source code editor that bridges the gap
between simple text editors and full-fledged IDEs.

Key Features for the Project:

 Python/Flask Development: Excellent extensions for Python that provide features


like IntelliSense (smart code completion), debugging tools for Flask applications, and
virtual environment support.

 Frontend Development: Built-in, high-quality support for HTML, CSS, and


JavaScript. This allows developers to work on the UI, styling, and client-side logic
(including the [Link] integration) all within one tool.

 Git Integration: Seamless integration with Git, essential for version control and team
collaboration, which is crucial for any substantial project.

 Customization: Highly customizable via a vast marketplace of extensions, allowing


developers to set up a personalized environment for web, database, and specific
framework syntax. In the Link People Solutions project, Visual Studio Code was used
as the primary development environment for both frontend and backend.

2.6 Other Techniques


Effective expense tracking requires highly reliable data persistence and synchronization. The system
13
employs Firebase as the backend-as-a-service (BaaS), specifically utilizing Firebase Authentication
and Firestore (NoSQL database)

The decision to use a cloud-based solution like Firebase, rather than local, device- specific storage
such as SQLite, is critical for addressing fundamental data integrity issues. If data is stored only in a
local SQLite database, the entire history of transactions and rewards "dies with the phone" if the
device is lost or broken. Firebase, conversely, ensures that all expense history, user profiles, and the
crucial Token Rewards ledger are persistently stored in the cloud, guaranteeing cross-device
synchronization and robust data backup.

Firebase also simplifies the required functionalities of the application:

 Authentication: Firebase handles the secure processes required for user registration and login,
which are mandatory features dictated by the screen designs.

 Scalable Data Storage (Firestore): Firestore's NoSQL structure offers the flexibility needed to
store structured data like user profiles, categories, and complex transaction entities.

 Real-Time Capabilities: The NoSQL database structure facilitates real-time data retrieval,
which is essential for instantly updating the dashboard's key metrics, such as Total Expenses
and Remaining Balance, immediately after a new expense is logged.

The integration of Firebase provides a high-availability, low-overhead backend infrastructure


necessary to support a modern, smart mobile application.

14
CHAPTER – 3 REQUIREMENTS
SPECIFICATIONS

3.1 Existing System


Traditional expense tracking systems predominantly rely on either manual, paper-based logging or
simple digital methods such as spreadsheets. These systems have been the default for personal and
small-scale financial management for decades.

Manual systems involve collecting physical receipts, transcribing information into a physical journal
or digital spreadsheet, and periodically reconciling accounts, often at the end of the month. While
simple, these methods are intrinsically limited by their reliance on human discipline and memory.

Simple digital systems, such as non-integrated spreadsheets, offer marginally better calculation
efficiency but still require extensive manual data entry and categorization. Professionals using
these manual classification methods report spending substantial time, averaging between 10 to 15
hours each month, solely on categorizing their expenses.

Furthermore, these systems are often siloed, meaning they do not integrate with other tools, leading to
duplicate data entry and a lack of holistic into spending patterns.

3.2Problem in Existing System

The limitations of existing manual and simple digital expense tracking methods create significant
operational and financial liabilities, justifying the development of a smart, automated solution.

 Human Error and Costly Correction

The most significant problem is the high susceptibility to human error. A misplaced decimal point or
an incorrectly entered figure in a manual log can lead to substantial discrepancies in financial
records. Research indicates that approximately 19% of expense reports contain errors, and
correcting each single error requires an additional 18 minutes of work and an average cost of $52.
These mistakes cascade into larger issues, compromising accuracy for budgeting, tax preparations,
or accurate financial analysis.6 Senior financial analysts report spending around 10 hours monthly
just fixing errors that arise from manual data input.

 Delayed Visibility and Lack of Control

15
Traditional systems inherently suffer from delayed reporting. If expenses are only reconciled at month-
end, users lose the critical opportunity to monitor spending as it happens. This delayed visibility
means that users cannot course-correct their spending behavior in real-time, often discovering
budget overruns too late. Modern finance management requires staying on top of spending
constantly, and the monthly wait time inherent in older systems is no longer competitive.

 Non-Compliance and Lack of Motivation

Manual tracking is tedious and time-consuming, leading to high rates of non- compliance and user
abandonment. Simple trackers lack the intrinsic motivation needed to encourage adherence to
savings or budgeting goals. The process is perceived as a necessary chore rather than a helpful
tool, resulting in users failing to maintain comprehensive documentation, including necessary
receipts and invoices, which further compromises audit trails and financial analysis.

3.3Proposed System

The proposed Smart Expense Tracker system addresses the systemic deficiencies of traditional
methods by implementing a real-time, automated, and behaviorally reinforcing platform.

Real-Time Tracking and Data Accuracy

The proposed system leverages digital data entry and automated calculation workflows to eliminate
human error and ensure immediate data accuracy. By using a centralized cloud database (Firebase),
the system provides instant visibility into spending. Every expense submitted by the user is
immediately recorded and the dashboard metrics (Total Expenses, Remaining Balance) are updated
in real-time. This instantaneous feedback loop allows for better decision-making and continuous
budgetary compliance.

The Mechanism

The primary innovation of the proposed system is the integration of gamification to drive behavioral
change and boost user engagement. This system operates as a positive reinforcement program
designed specifically to incentivize savings.

The core logic is tied to the user's registered Monthly Salary.1 The system defines a clear, numerical
goal: the user must achieve a minimum net saving of ₹2000 per month. The gamification steps are
as follows:

 Goal Setting: The application establishes the target goal: $\text{Savings} =

\text{Monthly Salary} - \text{Total Monthly Expenses}$ must satisfy the condition

$\text{Savings} \geq ₹2000$.

16
 Progress Tracking: As the user enters expenses throughout the month, the Remaining
Balance tracks their proximity to the saving

 Achievement Reward: Upon successful calculation and verification (typically triggered at


the end of the calendar month or upon a successful savings achievement), the system issues a
Token Reward. This virtual reward is accompanied by instant, positive feedback
("Congrats! You earned a token!").

 Streaks and Retention: By rewarding this specific positive financial behavior (saving), the
application taps into the human desire for achievement and instantaneous gratification. This
mechanism encourages users to maintain a "streak" of saving, thereby maximizing long-term
user retention and compliance with personal financial goals.

This structure ensures that the system is not merely collecting data; it is actively conditioning users
toward financial discipline through engaging, game-like experiences.

17
3.4 Comparison between Existing and Proposed System

The transformation from manual and simple digital systems to the Smart Expense Tracker is quantified
by specific improvements in efficiency, accuracy, and engagement.

Table 2: Operational Comparison of Expense Tracking Systems

Smart Expense
Manual/Spreadsheet Tracker
Feature/Metric
System (Proposed)

Digital input
Data Entry Manual/Paper-based (Future: OCR
potential)
Excellent
(Automated
Poor (Prone to human
calculation,
Data Accuracy error, high correction
built-in
cost) 6
verification)
28

Real-time
Visibility and Delayed (Month-end (Instant
Feedback reconciliation) 13 dashboard
updates) 1
High
User Engagement Low (Tedious, easily (Gamified
abandoned) rewards,
progress bars,

18
The most significant comparative advantage lies in the minimization of manual tasks, which
previously required 10 to 15 hours per month for categorization alone.29 Automation streamlines
workflows, enforces policy compliance (the savings goal), and minimizes the risk of fraudulent or
erroneous entries.

3. 5 Software Requirement Specification

The successful development and operation of the Smart Expense Tracker are contingent upon the
following software environments and tools:

Category Specific Requirement

Windows 10 (64-bit) or later, macOS 12 (Monterey) or


later, or modern 64-bit Linux distribution 33
Development OS

Framework & Flutter SDK (latest stable channel), Dart SDK (bundled
Language with Flutter) 33

IDE Visual Studio Code (latest version) 22

Development Tools Flutter Extension, Dart Extension, Git/GitHub for


Version Control 24

Mobile Platforms Android SDK Platform tools, Android API 20

(Lollipop) & later, iOS 8 & later 17

Firebase SDK (Authentication, Firestore), Google


Cloud Services (for potential future
ML
Backend Services
integration)

19
3.6Hardware Requirement Specification

The hardware requirements are split into development and runtime specifications.

Category Minimum Recommended


Requirement Requirement

Processor x86 or Multi-core i5/Ryzen 5 or


(Development) x64 architecture equivalent (64-bit)
(Multi-core) 17

8 GB or higher for
running multiple
emulators/simulators
RAM
efficiently

(Development) 4 GB

Up to 3 GB of free
space required for
SSD drive for faster
SDKs and tools 17
compilation and IDE
performance
Storage
(Development)

Smartphone
compatible with
Android API
Modern mobile device
20+ or
for optimal experience
Target Device iOS 8+
(Runtime)

20
CHAPTER - 4
FEASIBILITY STUDY OF THE PROJECT

A comprehensive feasibility study was conducted to ascertain the viability of the Smart Expense
Tracker project across technical, operational, and economic dimensions.
A feasibility study is a critical assessment that determines whether a proposed project is viable,
practical, and beneficial. For the Expense Tracker application, this study evaluates the project's
potential to meet user needs while utilizing available resources effectively. The study examines various
aspects including technical feasibility, economic viability, and operational practicality to provide a
comprehensive evaluation of the project's potential for success.
The primary purpose of this feasibility study is to analyze whether Expense Tracker can be developed
and implemented successfully within the constraints of time, budget, and technology. It assesses how
the application will address current problems in financial management and deliver value to users. The
study also considers the resources required for development, including technology, personnel, and
infrastructure, to ensure they are available and sufficient.
The objective of this feasibility study is to develop a structured proposal that outlines the nature, goals,
and scope of the Expense Tracker project. This proposal serves as a foundational document for
decision-making, providing stakeholders with a clear understanding of the project's potential benefits,
challenges, and requirements. It is an essential step in the project development process, helping to
identify potential risks, estimate costs, and determine overall viability before committing significant
resources.
This feasibility study examines multiple dimensions, including technical feasibility (can the application
be built with current technology?), economic feasibility (is the project cost-effective?), and operational
feasibility (will users adopt and benefit from the system?). By evaluating these aspects, the study
ensures that Expense Tracker is not only desirable but also achievable within the given constraints.

4.1 Technical Feasibility


Technical feasibility assesses whether the project can be constructed using available technology and

21
expertise. The analysis confirms high technical feasibility. The project relies on the Flutter framework
and the Dart language, both of which are mature, well- supported by Google, and possess extensive
community resources and clear documentation. The Flutter platform provides a comprehensive set of
APIs necessary to build complex mobile applications.
Furthermore, the backend relies on Firebase, a stable, cloud-based platform that handles critical services
such as authentication and NoSQL data persistence. This alleviates the need for custom server
infrastructure development, allowing the development team to focus resources on core business logic
and front-end user experience. The technology stack is fully capable of supporting the proposed real-
time calculations and the gamified reward logic.

4.2 Operational Feasibility


Operational feasibility evaluates how well the proposed system will be utilized and integrated into the
daily life of the target user. The system demonstrates excellent operational feasibility.
The core design principle is to simplify and automate a traditionally complex process. By providing a
mobile application interface and immediate feedback on spending, the application meets a significant
market need for instant expense recording. The integration of the gamified reward system significantly
boosts the likelihood of continued user adoption and compliance.
Users are intrinsically motivated to engage with the app regularly to keep track of their progress toward
earning their token reward, addressing the common problem of non- compliance found in passive
tracking tools. The system fosters self-regulation by making goal completion visible and rewarding.

4.3 Economic Feasibility


Economic feasibility determines whether the benefits of the proposed system outweigh the costs of
development and maintenance. The project utilizes a highly cost-effective technology stack.
The primary development tools—Flutter SDK, Dart SDK, and Visual Studio Code—are free and open-
source. The backend, Firebase, operates on a generous free tier, making the initial development and
deployment phase economically viable with minimal outlay. While the application may incur ongoing
maintenance costs for server and database infrastructure as user adoption scales, these costs can be
offset through future monetization strategies, such as optional premium features or controlled in-app
advertisements. The benefit realized by the end-user—reduced human error, saved time previously
spent on manual categorization, and improved financial decision-making— far exceeds the minimal

22
investment cost of the initial development.

23
CHAPTER - 5
SYSTEM DESIGN

5.1 Database Design


The database design for the Expense Tracker application is structured to efficiently manage
financial data while ensuring data integrity, security, and performance. The design uses a
NoSQL approach with Firebase Firestore, which offers flexibility for evolving data
structures and real-time synchronization capabilities essential for a financial management
application.

Collections and Documents:


1. Users Collection
• Stores user account information and preferences
• Fields: userId, email, name, currency, createdAt, lastLogin

2. Transactions Collection
• Records all income and expense transactions
• Fields: transactionId, userId, type (income/expense), amount, category, description,
date, tags

3. Categories Collection
• Defines expense and income categories
• Fields: categoryId, userId, name, type (income/expense), icon, color, budgetLimit

4. Budgets Collection

24
• Stores budget information for different categories and time periods
• Fields: budgetId, userId, categoryId, period (weekly/monthly/yearly), amount, spent,
startDate, endDate

5. Goals Collection
• Tracks financial savings goals
• Fields: goalId, userId, name, targetAmount, currentAmount, targetDate, status

6. Reports Collection
• Stores generated financial reports and analytics
• Fields: reportId, userId, type, period, data, generatedAt

Data Relationships:
• Each user has multiple transactions, categories, budgets, and goals
• Transactions are linked to categories and users
• Budgets are associated with categories and users
• Goals belong to specific users
• Reports are generated for specific users and time periods

Security Rules:
• Users can only access their own financial data
• Authentication is required for all database operations
• Data validation ensures proper formatting of financial information

This database design provides a robust foundation for the Expense Tracker application,
supporting all required functionality while maintaining data integrity and security. The
NoSQL structure allows for flexibility as the application evolves, and Firebase's real-
time capabilities ensure that users always have access to current financial
informationThe database schema is designed to manage four primary entities: User,
Expense, Category, and the specialized Token_Rewards. Firestore (NoSQL) is the
chosen implementation environment, providing flexible document storage that supports
rapid query times for dashboard metrics.
25
The decision to store core financial metrics, specifically the Monthly Salary , within the
User entity, necessitates stringent security measures, including storing a PasswordHash
rather than plaintext. The Monthly Salary serves as the indispensable baseline metric for
calculating the Remaining Balance and determining eligibility for the token reward.

The Token Rewards Ledger Design


The Token_Rewards table is critical for auditing the behavioral achievement objective.
It is designed as an immutable ledger rather than simply updating a total tokens_earned
counter on the User profile. This approach ensures the atomicity of the reward event.

Table 3: Database Schema Summary

Table Relati Purpose


Name Key onship and
(Collecti Fields to Critical
on) User Fields

Authenti
UserID cation,
(PK), (1:N) budget
MonthlyS to baseline
alary, Expens data
User
Password e, capture,
Hash, Rewar and
TotalTok ds cumulati
ens ve token
display.1
ExpenseI Detailed
D (PK), tracking
Expense (N)
UserID of
(FK), spending

26
Table Relati Purpose
Name Key onship and
(Collecti Fields to Critical
on) User Fields

CategoryI transacti
D (FK), ons.36
Amount,
Date,
Descripti
on
Customi
(1:N) zable
CategoryI
to classific
Category D (PK),
Expens ation of
Name
e transacti
ons.12
Immutab
RewardI le ledger
D (PK), tracking
UserID specific
(FK), instances
Token_R MonthYe where
(N)
ewards ar, saving
SavingsA $\geq$
mount, ₹2000
TokensEa was
rned achieved
.

27
The requirement to aggregate expenses monthly for the reward calculation means that the
Token_Rewards entry must capture a snapshot of the calculated SavingsAmount for that
specific MonthYear.
Storing this immutable record, similar to an audit trail , provides verifiable evidence of the
user's financial achievement and facilitates tracking positive behavioral streaks.

5.2 E - R DIAGRAM

The Entity-Relationship (ER) Diagram is the blueprint for the Smart Expense Tracker's database. It
visually defines the system's core entities (the data objects) and the precise relationships between them,
ensuring that the financial logic is correctly implemented and all data is accurately tied to the individual
user.
The design relies on two main entities and a critical One-to-Many relationship.

Entity-Relationship (ER) Diagram in Detail


28
1. Entity: USER (The Budget Anchor)
This is the primary entity, representing every individual account on the platform. Its attributes hold the
foundational data necessary for calculating financial metrics and managing the reward system.

Role in Expense
Attribute Detail
Tracker Application
The main access key. All queries for expense
user_id (PK) Unique Identifier history and summaries are filtered by this ID to
ensure data privacy and separation.
Used by the Login Module to verify identity. The
username &
Authentication password is never stored in plain text, maintaining
hashed_password
security standards.
This is the fixed, initial value used by the
Financial Logic Module. It serves as the 100% cap
monthly_salary Budget Benchmark
against which total expenses are compared to
determine the Remaining Balance.
Stores the cumulative rewards earned. This is the
Gamification goal variable for the Token Rewards Module,
token_count
Tracker which increments this count when the saving goal
is met.

2. Entity: EXPENSE (The Transaction Record)


This entity is the ledger of all financial activity logged by the users.
Role in Expense
Attribute Tracker Detail
Application
expense_id Unique Record Ensures every logged transaction is distinct, allowing for
(PK) Identifier future auditing or deletion of a specific entry.
user_id (FK) Relational Link This Foreign Key is the most crucial attribute. It establishes
the mandatory link back to the USER table, ensuring that the
expense is correctly attributed to the individual who logged

29
Role in Expense
Attribute Tracker Detail
Application
it.
The monetary value used directly by the Financial Logic
amount Calculation Data Module to calculate the sum of all expenses and determine
the current budget status.
Defines the type of spending (e.g., Food, Transport). This
category Reporting Data data is aggregated and passed to the Visualization Module
([Link]) for graphical reports.
Audit & Period Used to filter expenses to ensure calculations (like total
date
Filtering monthly expense) are restricted to the correct time frame.

3. Relationship: Tracks (One-to-Many)


The relationship connecting the two entities is defined as One-to-Many (1:M):
 1 USER (on the "one" side) TRACKS Many EXPENSE records (on the "many" side).
This relationship is enforced by placing the user_id (PK from USER) as a Foreign Key (FK) within the
EXPENSE table.
Contextual Significance:
This design directly enables the core functionality of the Smart Expense Tracker:
1. Isolation: It guarantees that when a user logs in, the system only fetches and processes the expense data
associated with their specific user_id, maintaining data integrity and privacy.
2. Aggregation: It allows the Financial Logic Module to efficiently perform aggregate calculations
(SUM(amount)) across all expenses belonging to a single user for the current month, which is essential
for accurately calculating the Remaining Balance and triggering the Token Reward logic.
3. Scalability: The design is highly scalable, as adding millions of expense records only requires adding
new rows to the EXPENSE table, all linked back to the user via the user_id.
E/R data model symbols:
As E/R data model is the pictorial representation of different entities, attributes and their relationship.
Therefore, it provides different graphical symbols for representing different components.

30
Component Symbol Name

Entity Rectangle

Attribute Ellipsis/Oval

Relationship Diamon

5.3 System Flowchart Design

The System Flowchart for Expense Tracker outlines the logical flow of operations within the
application, capturing both user interactions and backend processes. The flowchart begins with user
authentication, followed by the main financial management activities.
User Flow:
1. User Registration/Login: Users create an account or sign in with existing credentials
2. Dashboard Access: Upon authentication, users are directed to their financial dashboard
3. Transaction Management: Users can add, edit, or delete income and expense transactions
4. Categorization: Transactions are automatically or manually categorized
5. Budget Tracking: Users set budget limits and monitor spending against these limits
6. Goal Setting: Users define financial goals and track progress toward achieving them
7. Report Generation: Users generate financial reports and view analytics
8. Data Synchronization: All data is synchronized across devices in real-time

Administrative Flow:
1. User Management: Administrators can manage user accounts and permissions
2. System Monitoring: System performance and usage are monitored
3. Data Backup: Regular backups of financial data are performed
4. Security Management: Security protocols are updated and monitored

31
The flowchart also includes error handling for scenarios such as invalid login credentials, data validation
failures, or synchronization issues. This structured flow helps identify system requirements, improve
usability, and ensure efficient development. Overall, the system flowchart serves as a blueprint for
developers and stakeholders to understand and implement the application's functional processes.

The system flowchart details the processes from user authentication through the critical expense
recording and token reward calculation phase.

Authentication Flow
The process begins with the system start, leading to a decision point: checking for an active
session. If no session exists, the user is directed to the Login or Register screens. 1 Upon
validation of credentials against the Firebase Authentication service, the user is directed to the
main Dashboard.

Expense Recording and Recalculation Flow


This is a high-frequency operational flow.
1. Dashboard Entry: User clicks 'Add New Expense'.
2. Input Collection: System collects Amount, Date, and Category.
3. Data Validation: System ensures mandatory fields are present and the amount is
numerical.
4. Database Write: The validated transaction is written to the Expense collection in
Firebase.
5. Trigger Financial Recalculation: Crucially, this write operation triggers an
asynchronous calculation function:
o It queries all expenses for the current month.
o Calculates $\sum \text{Expenses}_{\text{Current Month}}$.
o Calculates $\text{Remaining Balance} = \text{Monthly Salary} - \sum
\text{Expenses}$.
6. UI Update: The Dashboard metrics (Total Expenses, Remaining Balance) are
updated instantly.

Critical Branching: Token Reward Calculation Logic


32
The reward logic is embedded either as a scheduled monthly task or as a function triggered when
the user views their monthly report page toward month-end.
1. Initiate Reward Check: The CalculateTokenReward function executes.
2. Retrieve Data: Fetch MonthlySalary and $\sum \text{Expenses}_{\text{Current
Month}}$.
3. Savings Check: Decision Point: Is $\text{Savings} \geq ₹200
4. If YES: Award Token. Log the success event (Month/Year, Savings Amount) to the
immutable Token_Rewards ledger. Display the "Congrats! You earned a token!"
notification on the dashboard.1
5. If NO: Do nothing.

This systematic flow ensures that the financial data is accurate at all times and that the
motivational rewards are issued based on verified performance metrics.

5.4 Data Flow Diagram (DFD Level 0 and DFD Level 1)

DFDs illustrate the logical flow of information through the system, independent of physical
implementation.
DFD Level 0 (Context Diagram)
The Context Diagram depicts the Smart Expense Tracker as a single, centralized process
interacting with one external entity: the User.
 Input from User: Salary Input, Expense Data, Authentication Credentials.
 Output to User: Financial Reports (Charts), Dashboard Metrics, Reward
Notifications.40
 Data Flows to/from System: All data, including expense records and user profiles, is
stored within the System’s internal Datastores (D1: User Data, D2: Expense Data, D3:
Reward Ledger).

DFD Level 1 (Process Decomposition)


DFD Level 1 decomposes the system into four major processing components and their
interactions with the internal datastores (D1, D2, D3).
1. Process 1.0: User & Session Management (Reads D1): Handles registration, login,
33
profile updates, and session persistence.
2. Process 2.0: Expense Data CRUD Operations (Reads D1, Writes D2): Manages
the input, validation, storage, and retrieval of individual expense transactions.
3. Process 3.0: Reporting & Visualization (Reads D1, D2, D3): Aggregates raw
expense data (D2), calculates totals, and generates monthly reports and visual charts
(e.g., spending by category).
4. Process 4.0: Reward Calculation Engine (Reads D1, D2; Writes D3): Executes the
core business logic. It reads the Monthly Salary (D1) and aggregated monthly
expenses (D2) to determine if the ₹2000 savings threshold has been met,
subsequently writing the achievement record to the Reward Ledger (D3).

The following diagram .1 illustrates the notations and symbols used to construct
the DFD:

A circle or bubble represents a process transform Incoming Data


flow(s) into outgoing flows.

A producer or consumer of information that resides outside the


External bounds to be modeled.
Entity

The arrowhead indicates the direction of flow.

The table in which information will be stored ultimately.

34
35
5.5 DATA FLOW DIAGRAM

A Data Flow Diagram (DFD) is a graphical tool used to represent the flow of data within a
system at various levels of detail. It visually maps out how data moves between processes,
data stores, and external entities such as users or other systems. Think of a DFD like a road
map for data — it shows all the possible paths that data can take through the system.

For Link People Solutions, the DFD helps illustrate how employee and client information,
job postings, applications, and other data interact within the Employee Management System.
Different hierarchical levels of the DFD provide varying levels of detail, from an overview of
major data flows to in-depth views of specific processes.

The following diagram .1 illustrates the notations and symbols used to construct the DFD:

A circle or bubble represents a process transform Incoming Data


flow(s) into outgoing flows.

A producer or consumer of information that resides outside the


External bounds to be modeled.
Entity

The arrowhead indicates the direction of flow.

The table in which information will be stored ultimately.

Figure 5.1: Illustrates the notations and symbols used to construct the DFD

36
5.6 Program Design

The system employs a layered, modular architecture, adhering to the principle of


separation-of-concerns to ensure maintainability and scalability.
This structure, common in robust application development, utilizes the Provider
package for state management, enabling a reactive UI.
The architecture is vertically separated into three key layers:

1. The Data Layer (Persistence and Repository):


o Services: Contain external API calls (e.g., Firebase Authentication/Firestore
interactions).
o Repositories: Provide a clean interface for the View Models to access data.
They handle the logic for retrieving, transforming, and persisting data to
Firebase. This layer ensures that if the database technology changes (e.g.,
from Firebase to a PostgreSQL instance), only the Repository implementation
needs updating, not the business logic.

2. The Domain Layer (Business Logic and Models):


o This layer contains the core application rules, including the models (User,
Expense, Token_Reward) and the crucial Use Cases (e.g.,
CalculateTokenRewardUseCase).
o The logic for determining if savings exceed ₹2000 resides here, completely
independent of how the data is stored or presented.

3. The UI Layer (Presentation and View Models):


o Views: The Flutter widgets responsible for rendering the screens (e.g.,
Dashboard, Add Expense). They are entirely passive.
o View Models (Controllers): Hold the application state (e.g., current expenseslist, remaining
balance value).

o They receive user input, orchestrate the execution of Use Cases from the
Domain Layer, and notify the Views of state changes, making the UI reactive.
37
5.7 Functionality of the Project

Real-Time Balance Calculation


The core functionality of the Dashboard relies on instantaneous calculation. The
Remaining Balance metric is derived dynamically whenever an expense is added or
deleted.

The calculation function uses the formula:


$$\text{Remaining Balance} = \text{Monthly Salary} - \sum_{i=1}^{N} \text{Expense
Amount}_i$$
Where $N$ is the total number of expenses recorded within the current calendar month.
The immediate application of this function ensures the user always sees their true,
current financial standing relative to their saving goal.

Token Rewards Logic


This functionality governs the psychological reinforcement mechanism. The logic is
executed by the TokenRewardCalculatorUseCase and follows a strict protocol:
1. Input: Takes UserID and Month/Year.
2. Aggregation: Queries the Expense collection for all expenses belonging to the
UserID within the specified Month/Year.
3. Validation: Retrieves the MonthlySalary from the User profile.
4. Achievement Check: Calculates $\text{Savings}$. If $\text{Savings} \geq ₹2000$:
o A Token is awarded.
o A record of this achievement is written to the immutable Token_Rewards
collection, recording the specific savings amount that qualified for the
reward.38
o The TotalTokens counter on the User profile is incremented.
5. Feedback: The system triggers the dashboard notification confirming the reward.

This process directly fulfills the behavioral objectives by providing immediate feedback
on hitting a positive financial milestone, thereby fostering independent goal-setting and
positive financial behavior.
38
5.8 Modules of the Project

T The application is logically segmented into four primary software modules,


corresponding directly to the layered architecture:
1. Authentication Module:
o Responsibility: Manages all user identity and session concerns, including
secure registration, login, password hashing, and token generation using
Firebase Authentication. It is responsible for ensuring data stored for the User
entity, especially the Monthly Salary, is handled securely.

2. Data Persistence Module:


o Responsibility: Provides abstract access to the Firebase Firestore database. It
handles all Create, Read, Update, and Delete (CRUD) operations for the
Expense, Category, and Token_Rewards entities. It acts as the gatekeeper,
translating application data models into database documents and vice-versa.

3. UI/Presentation Module:
o Responsibility: Focuses entirely on the front-end rendering and user
interaction (input capture). It consists of all the Flutter Views and the primary
application navigation logic. This module is subscribed to the View Models
for state updates and is responsible for maintaining UI consistency across all
target platforms.

4. Reporting & Gamification Module:


o Responsibility: This module houses the critical business logic. It includes the
logic for aggregating financial data, performing the real-time balance
calculation, generating the chart data for reports, and executing the proprietary
TokenRewardCalculatorUseCase function.

5.9 Screen Design

39
The screen design for Expense Tracker focuses on creating an intuitive, responsive, and
visually appealing user interface that simplifies financial management. The design
follows modern UI/UX principles to ensure a seamless experience across devices.

Key Screens:
1. Login/Registration Screen: Simple, clean interface with email/password fields and
social login options
2. Dashboard: Overview of financial health with key metrics (total income, expenses,
net balance, budget status)
3. Transaction Entry: Form for adding new income/expense transactions with category
selection, amount, date, and description
4. Transaction History: List of all transactions with filtering and sorting options
5. Category Management: Interface for creating and managing expense/income
categories
6. Budget Setup: Screen for setting budget limits for different categories and time
periods
7. Goal Tracking: Interface for creating financial goals and monitoring progress
8. Reports & Analytics: Visual representations of financial data with charts and graphs
9. Settings: User preferences, currency selection, notification settings, and account
management

The design uses a consistent color scheme with financial indicators (green for income,
red for expenses, blue for savings). Interactive elements provide immediate feedback,
and the layout is responsive to work seamlessly on desktop, tablet, and mobile devices.

Navigation is intuitive with a bottom navigation bar on mobile and a sidebar menu on
desktop [Link] screen design directly reflects the visual mockups provided ,
ensuring functional clarity and a consistent, professional user experience (UX).

40
It includes :
1. Registration Screen :
o Inputs: Full Name, Email, Username, Password.
o Critical Input: Monthly Salary (₹). This field is mandatory as it
forms the baseline for all subsequent budgeting and reward calculations.

2. Login Screen :
o Inputs: Username and Password. Provides a link back to the
Registration screen.

3. Dashboard Screen :
o Key Metrics (Top Card): Displays Total Salary (monthly baseline),
Total Expenses (current month aggregate), and Remaining Balance
(Salary - Expenses).
o Reward Notification: Features the dynamic "Congrats! You earned a
token!" banner, which appears only after the TokenRewardCalculator
verifies the achievement.
o Call-to-Action: Prominent 'Add New Expense' button.

4. Add New Expense Screen :


o Inputs: Category Picker, Amount Field, Date Picker (dd-mm-yyyy), and
Description field.

5. Expense History Screen :


o Provides a searchable list view of all past transactions, displaying
Category, Description, Amount, and Date.

41
5.10 Report design (output screen)

Start Frame

Main Frame

42
About us Page

Expense Tracker Service Frame

43
CHAPTER – 6
CODING

6.1 Module wise code of the project


I. Index

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Smart Expense Tracker</title>

<link rel="stylesheet" href="{{ url_for('static', filename='[Link]') }}">

<script defer src="{{ url_for('static', filename='[Link]') }}"></script>

</head>

<body>

<header>

<h1>Smart Expense Tracker</h1>

<nav>

<a href="{{ url_for('home') }}" class="active">Home</a>

<a href="{{ url_for('register') }}">Sign Up</a>

<a href="{{ url_for('login') }}">Login</a>

</nav>

</header>
44
<section class="hero">

<h2>Track your expenses. Save more. Earn tokens!</h2>

<p>Monitor your spending, manage budgets, and get rewarded when you save ₹2000 or more
every month!</p>

<a href="{{ url_for('register') }}" class="btn">Get Started</a>

</section>

<footer>

<p>© 2025 Smart Expense Tracker </p>

</footer>

</body>

</html>

II. Register

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Register | Expense Tracker</title>

<style>

*{

margin: 0;

padding: 0;

45
box-sizing: border-box;

font-family: "Poppins", sans-serif;

body {

background: linear-gradient(135deg, #007bff, #00c6ff);

height: 100vh;

display: flex;

justify-content: center;

align-items: center;

.container {

background-color: #fff;

width: 420px;

border-radius: 15px;

box-shadow: 0 10px 25px rgba(0,0,0,0.2);

padding: 30px;

text-align: center;

.container h2 {

margin-bottom: 20px;

color: #333;
46
}

form {

display: flex;

flex-direction: column;

align-items: stretch;

label {

text-align: left;

margin: 10px 0 5px 0;

font-weight: 600;

color: #444;

input {

padding: 10px;

border-radius: 8px;

border: 1px solid #ccc;

outline: none;

transition: 0.3s;

input:focus {
47
border-color: #007bff;

box-shadow: 0 0 5px rgba(0,123,255,0.5);

button {

background: linear-gradient(135deg, #007bff, #00c6ff);

color: white;

padding: 10px;

border: none;

border-radius: 8px;

margin-top: 20px;

cursor: pointer;

font-weight: 600;

transition: 0.3s;

button:hover {

background: linear-gradient(135deg, #00c6ff, #007bff);

transform: translateY(-2px);

.login-link {

margin-top: 15px;

color: #333;
48
font-size: 0.9em;

.login-link a {

color: #007bff;

text-decoration: none;

font-weight: 600;

.login-link a:hover {

text-decoration: underline;

@media (max-width: 480px) {

.container {

width: 90%;

padding: 20px;

</style>

</head>

<body>

<div class="container">

<h2>Create an Account</h2>
49
<form action="{{ url_for('register') }}" method="POST">

<label for="name">Full Name</label>

<input type="text" id="name" name="name" placeholder="Enter your full name" required>

<label for="email">Email</label>

<input type="email" id="email" name="email" placeholder="Enter your email" required>

<label for="username">Username</label>

<input type="text" id="username" name="username" placeholder="Choose a username" required>

<label for="password">Password</label>

<input type="password" id="password" name="password" placeholder="Create a password" required>

<label for="salary">Monthly Salary (₹)</label>

<input type="number" id="salary" name="salary" placeholder="Enter your monthly salary" min="0"


required>

<button type="submit">Register</button>

</form>

<div class="login-link">

Already have an account? <a href="{{ url_for('login') }}">Login here</a>

</div>

</div>

50
</body>

</html>

III. Login
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Login | Expense Tracker</title>

<style>

*{

margin: 0;

padding: 0;

box-sizing: border-box;

font-family: "Poppins", sans-serif;

body {

background: linear-gradient(135deg, #00c6ff, #007bff);

height: 100vh;

display: flex;

justify-content: center;

align-items: center;

51
.login-container {

background-color: white;

width: 400px;

border-radius: 15px;

box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);

padding: 30px;

text-align: center;

.login-container h2 {

margin-bottom: 20px;

color: #333;

form {

display: flex;

flex-direction: column;

label {

text-align: left;

margin: 10px 0 5px;

font-weight: 600;

color: #444;

52
}

input {

padding: 10px;

border-radius: 8px;

border: 1px solid #ccc;

outline: none;

transition: 0.3s;

input:focus {

border-color: #007bff;

box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);

button {

background: linear-gradient(135deg, #007bff, #00c6ff);

color: white;

padding: 10px;

border: none;

border-radius: 8px;

margin-top: 20px;

cursor: pointer;

font-weight: 600;

transition: 0.3s;

53
}

button:hover {

background: linear-gradient(135deg, #00c6ff, #007bff);

transform: translateY(-2px);

.register-link {

margin-top: 15px;

color: #333;

font-size: 0.9em;

.register-link a {

color: #007bff;

text-decoration: none;

font-weight: 600;

.register-link a:hover {

text-decoration: underline;

@media (max-width: 480px) {

.login-container {

54
width: 90%;

padding: 20px;

</style>

</head>

<body>

<div class="login-container">

<h2>Welcome Back</h2>

<form action="{{ url_for('login') }}" method="POST">

<label for="username">Username</label>

<input type="text" id="username" name="username" placeholder="Enter your username" required />

<label for="password">Password</label>

<input type="password" id="password" name="password" placeholder="Enter your password" required />

<button type="submit">Login</button>

</form>

<div class="register-link">

Don’t have an account? <a href="{{ url_for('register') }}">Register here</a>

</div>

</div>

</body>

</html>

55
IV. Dashboard
HTML

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Dashboard | Expense Tracker</title>

<style>

body {

margin: 0;

font-family: 'Poppins', sans-serif;

background: linear-gradient(135deg, #4facfe, #00f2fe);

color: #333;

display: flex;

flex-direction: column;

align-items: center;

padding: 30px;

h1 {

color: white;

margin-bottom: 10px;

56
.summary {

background: white;

padding: 20px;

border-radius: 15px;

box-shadow: 0 4px 20px rgba(0,0,0,0.2);

display: flex;

justify-content: space-around;

width: 90%;

max-width: 800px;

margin-bottom: 20px;

flex-wrap: wrap;

.card {

text-align: center;

padding: 15px;

flex: 1 1 150px;

margin: 10px;

background: #f8f9fa;

border-radius: 12px;

transition: 0.3s;

.card:hover {

57
background: #e9f5ff;

transform: translateY(-5px);

.card h3 {

margin-bottom: 10px;

color: #007bff;

.token {

background: #d4edda;

color: #155724;

padding: 10px;

border-radius: 8px;

margin-top: 10px;

.expense-form {

background: white;

padding: 20px;

border-radius: 12px;

box-shadow: 0 4px 20px rgba(0,0,0,0.1);

width: 90%;

max-width: 600px;

margin-bottom: 30px;

58
}

input, select {

width: 100%;

padding: 10px;

margin: 8px 0;

border: 1px solid #ccc;

border-radius: 8px;

outline: none;

button {

background: linear-gradient(135deg, #007bff, #00c6ff);

border: none;

color: white;

padding: 10px 20px;

border-radius: 8px;

cursor: pointer;

transition: 0.3s;

font-weight: 600;

button:hover {

background: linear-gradient(135deg, #00c6ff, #007bff);

59
table {

width: 90%;

max-width: 800px;

border-collapse: collapse;

background: white;

border-radius: 12px;

overflow: hidden;

box-shadow: 0 4px 20px rgba(0,0,0,0.1);

th, td {

padding: 12px 15px;

text-align: center;

th {

background: #007bff;

color: white;

tr:nth-child(even) {

background: #f2f2f2;

60
.logout {

margin-top: 20px;

background: #ff4d4d;

.logout:hover {

background: #ff6666;

</style>

</head>

<body>

<h1>Welcome, {{ username }} 👋</h1>

<div class="summary">

<div class="card">

<h3>Total Salary</h3>

<p>₹{{ salary }}</p>

</div>

<div class="card">

<h3>Total Expenses</h3>

<p>₹{{ total_expense }}</p>

</div>

<div class="card">

<h3>Remaining Balance</h3>

61
<p>₹{{ savings }}</p>

</div>

<div class="card">

<h3>Token Rewards</h3>

{% if token_earned %}

<div class="token">🎉 Congrats! You earned a token!</div>

{% else %}

<p>💡 Save ₹2000+ to earn a token!</p>

{% endif %}

</div>

</div>

<div class="expense-form">

<h2>Add New Expense</h2>

<form action="{{ url_for('add_expense') }}" method="POST">

<select name="category" required>

<option value="" disabled selected>Choose category</option>

<option value="Food">Food</option>

<option value="Transport">Transport</option>

<option value="Shopping">Shopping</option>

<option value="Bills">Bills</option>

<option value="Entertainment">Entertainment</option>

<option value="Others">Others</option>

</select>

<input type="text" name="description" placeholder="Description" required>

62
<input type="number" name="amount" placeholder="Amount (₹)" required>

<input type="date" name="date" required>

<button type="submit">Add Expense</button>

</form>

</div>

<h2 style="color:white;">Your Expense History</h2>

<table>

<tr>

<th>Category</th>

<th>Description</th>

<th>Amount (₹)</th>

<th>Date</th>

</tr>

{% for exp in expenses %}

<tr>

<td>{{ exp['category'] }}</td>

<td>{{ exp['description'] }}</td>

<td>{{ exp['amount'] }}</td>

<td>{{ exp['date'] }}</td>

</tr>

{% endfor %}

</table>

<a href="{{ url_for('logout') }}">

63
<button class="logout">Logout</button>

</a>

</body>

</html>

[Link]

// Theme Toggle

const themeBtn = [Link]("themeToggle");

if (themeBtn) {

[Link]("click", () => {

[Link]("dark");

[Link]("theme", [Link]("dark") ? "dark" : "light");

});

if ([Link]("theme") === "dark") [Link]("dark");

// Transactions

let transactions = [];

const transactionForm = [Link]("transactionForm");

const list = [Link]("transactionList");

const balanceDisplay = [Link]("totalBalance");

const tokenMessage = [Link]("tokenMessage");

// Add Transaction

if (transactionForm) {

[Link]("submit", async (e) => {

64
[Link]();

const desc = [Link]("desc").value;

const amount = parseFloat([Link]("amount").value);

const type = [Link]("type").value;

const data = { desc, amount, type };

// Send to backend Flask route (e.g., /add_transaction)

await fetch("/add_transaction", {

method: "POST",

headers: { "Content-Type": "application/json" },

body: [Link](data)

});

[Link](data);

updateUI();

[Link]();

});

function updateUI() {

[Link] = "";

let total = 0;

[Link]((t) => {

const li = [Link]("li");

[Link] = ${[Link]} - ₹${[Link]} (${[Link]});

65
[Link](li);

total += [Link] === "income" ? [Link] : -[Link];

});

[Link] = ₹${total};

if (total >= 2000) {

[Link] = "🎉 Congrats! You earned a <b>Golden Saver Token 🏆</b>!";

[Link] = "limegreen";

} else {

[Link] = "Save ₹2000+ to earn a Golden Saver Token 🏆";

[Link] = "white";

renderChart();

function renderChart() {

const ctx = [Link]("expenseChart");

if (!ctx) return;

const income = [Link](t => [Link] === "income").reduce((a, b) => a + [Link], 0);

const expense = [Link](t => [Link] === "expense").reduce((a, b) => a + [Link], 0);

new Chart(ctx, {

type: "doughnut",

data: {

66
labels: ["Income", "Expense"],

datasets: [{

data: [income, expense],

backgroundColor: ["#4CAF50", "#F44336"]

}]

});

/* ---------- GENERAL ---------- */

body {

font-family: 'Poppins', sans-serif;

background: #f6f8fc;

margin: 0;

color: #333;

header {

background: #4a90e2;

color: #fff;

padding: 15px 40px;

display: flex;

justify-content: space-between;

align-items: center;

67
header h1 {

font-size: 24px;

margin: 0;

.logout-btn {

background: #fff;

color: #4a90e2;

padding: 8px 15px;

text-decoration: none;

border-radius: 8px;

font-weight: bold;

.logout-btn:hover {

background: #e9f3ff;

/* ---------- MAIN DASHBOARD ---------- */

.dashboard-container {

width: 85%;

max-width: 1000px;

margin: 30px auto;

68
.summary h2, .add-expense h2, .expense-list h2 {

color: #4a90e2;

.summary-cards {

display: flex;

gap: 20px;

margin-top: 15px;

.card {

flex: 1;

background: #fff;

padding: 20px;

border-radius: 10px;

box-shadow: 0 2px 10px rgba(0,0,0,0.1);

text-align: center;

.card h3 {

margin-bottom: 10px;

color: #555;

.card p {

69
font-size: 22px;

font-weight: bold;

color: #333;

.token-message {

margin-top: 20px;

background: #e3ffe3;

padding: 15px;

border-radius: 10px;

color: #1b751b;

font-weight: 600;

text-align: center;

/* ---------- ADD EXPENSE FORM ---------- */

.expense-form {

display: flex;

flex-wrap: wrap;

gap: 10px;

margin-top: 10px;

.expense-form input {

flex: 1;

70
padding: 10px;

border: 1px solid #ccc;

border-radius: 6px;

.expense-form button {

background: #4a90e2;

color: white;

border: none;

padding: 10px 20px;

border-radius: 6px;

cursor: pointer;

.expense-form button:hover {

background: #377fcc;

/* ---------- EXPENSE TABLE ---------- */

table {

width: 100%;

border-collapse: collapse;

margin-top: 15px;

background: #fff;

border-radius: 10px;

71
overflow: hidden;

th, td {

padding: 12px;

border-bottom: 1px solid #eee;

text-align: center;

th {

background: #4a90e2;

color: white;

tr:hover {

background: #f1f8ff;

/* ---------- FOOTER ---------- */

footer {

text-align: center;

margin-top: 30px;

padding: 15px;

background: #4a90e2;

color: white;

72
font-size: 14px;

border-top-left-radius: 10px;

border-top-right-radius: 10px;

from flask import Flask, render_template, request, redirect, url_for, session

import sqlite3

import os

app = Flask(_name_)

app.secret_key = 'secret123'

DB_NAME = 'expense_tracker.db'

# ------------------ DATABASE SETUP ------------------

def get_db_connection():

conn = [Link](DB_NAME)

conn.row_factory = [Link]

return conn

def init_db():

if not [Link](DB_NAME):

conn = get_db_connection()

cur = [Link]()

73
[Link]('''

CREATE TABLE users (

id INTEGER PRIMARY KEY AUTOINCREMENT,

name TEXT NOT NULL,

email TEXT UNIQUE NOT NULL,

username TEXT UNIQUE NOT NULL,

password TEXT NOT NULL,

salary REAL DEFAULT 0

''')

[Link]('''

CREATE TABLE expenses (

id INTEGER PRIMARY KEY AUTOINCREMENT,

username TEXT NOT NULL,

category TEXT NOT NULL,

description TEXT,

amount REAL NOT NULL,

date TEXT NOT NULL

''')

[Link]()

[Link]()

print("✅ Database initialized!")

74
# ------------------ ROUTES ------------------

@[Link]('/')

def home():

return render_template('[Link]')

@[Link]('/register', methods=['GET', 'POST'])

def register():

if [Link] == 'POST':

name = [Link]['name']

email = [Link]['email']

username = [Link]['username']

password = [Link]['password']

salary = [Link]['salary']

conn = get_db_connection()

cur = [Link]()

[Link]('SELECT * FROM users WHERE username=? OR email=?', (username, email))

existing = [Link]()

if existing:

[Link]()

return "User already exists. Try logging in."

75
[Link]('INSERT INTO users (name, email, username, password, salary) VALUES (?, ?, ?, ?, ?)',

(name, email, username, password, salary))

[Link]()

[Link]()

return redirect(url_for('login'))

return render_template('[Link]')

@[Link]('/login', methods=['GET', 'POST'])

def login():

if [Link] == 'POST':

username = [Link]['username']

password = [Link]['password']

conn = get_db_connection()

cur = [Link]()

[Link]('SELECT * FROM users WHERE username=? AND password=?', (username, password))

user = [Link]()

[Link]()

if user:

session['username'] = user['username']

return redirect(url_for('dashboard'))

76
else:

return "Invalid login credentials!"

return render_template('[Link]')

@[Link]('/dashboard')

def dashboard():

if 'username' not in session:

return redirect(url_for('login'))

username = session['username']

conn = get_db_connection()

cur = [Link]()

# Get user's salary

[Link]("SELECT salary FROM users WHERE username=?", (username,))

salary = [Link]()[0] or 0

# Get all expenses

[Link]("SELECT * FROM expenses WHERE username=?", (username,))

expenses = [Link]()

# Total expenses

[Link]("SELECT SUM(amount) FROM expenses WHERE username=?", (username,))

77
total_expense = [Link]()[0] or 0

# Category-wise expenses

[Link]("""

SELECT category, SUM(amount) AS total

FROM expenses

WHERE username=?

GROUP BY category

""", (username,))

category_data = [Link]()

[Link]()

# Calculate balance/savings

savings = salary - total_expense

token_earned = savings >= 2000

return render_template(

'[Link]',

username=username,

salary=salary,

total_expense=total_expense,

savings=savings,

token_earned=token_earned,

category_data=category_data,

78
expenses=expenses

@[Link]('/add_expense', methods=['POST'])

def add_expense():

if 'username' not in session:

return redirect(url_for('login'))

username = session['username']

category = [Link]['category']

description = [Link]['description']

amount = float([Link]['amount'])

date = [Link]['date']

conn = get_db_connection()

cur = [Link]()

[Link]('INSERT INTO expenses (username, category, description, amount, date) VALUES


(?, ?, ?, ?, ?)',

(username, category, description, amount, date))

[Link]()

[Link]()

return redirect(url_for('dashboard'))

@[Link]('/logout')

def logout():

[Link]()
79
return redirect(url_for('login'))

if _name_ == '_main_':

init_db()

[Link](debug=True, port=8080)

80
CHAPTER – 7 TESTING

The purpose of testing in this project is to ensure that the web application is reliable, secure,
and performs as expected across different use cases. It helps identify bugs, inconsistencies, and
usability issues before deployment.

Objectives of Testing
• Verify that all functional requirements are met
• Ensure proper integration of modules
• Validate performance under various loads
• Identify and fix security vulnerabilities
• Provide a smooth user experience iii. Testing Levels Used
• Unit Testing – Testing individual functions or modules (e.g., login, job search)
• Integration Testing – Testing combined modules that interact (e.g., job search + database)
• System Testing – Full application testing in a staging environment
• User Acceptance Testing (UAT) – Performed by real users to ensure requirements are met

Level of Testing:
Testing can be performed in following three levels.

i. Unit testing
ii. Integration testing
iii. System testing

81
Unit Testing
Each program component is tested on its own, isolated from the other components in the
system. Such testing, known as module testing, component testing or unit testing, verifies
that the component functions properly with types of inputs expected from studying the
component design.

Integrated Testing

When all collecting components have been unit tested, the next step is ensuring the interfaces
among the components are defined and handled properly. Integration testing is the process of
verifying that the system components work together as described in the system and program
.

System Testing

System testing focuses on a complete, integrated system to evaluate compliance with specified
requirements. Tests are made on characteristics that are only present when the entire system
is run.

7.1 TEST CASE DESIGN

The design of tests for software and other engineered products can be as challenging as the
initial design of the product itself. Yet, for reasons that we have already discussed, software
engineers often treat testing as an afterthought, developing test cases that may "feel right"
but have little assurance of being complete.

A rich variety of test case design methods have evolved for software. These methods provide
the developer with a systematic approach to testing. More important, methods provide a
mechanism that can help to ensure the completeness of tests and provide the highest
likelihood for uncovering errors in software.

82
Any engineered product (and most other things) can be tested in one of two ways:

83
(1) Knowing the specified function that a product has been designed to perform, tests can
be conducted that demonstrate each function is fully operational while at the same time
searching for errors in each function;

(2) Knowing the internal workings of a product, tests can be conducted to ensure that "all
gears mesh," that is, internal operations are performed according to specifications and all
internal components have been adequately exercised.

Test case design for Employee management Systems:

Here’s a simplified set of test cases for the Employee Management System (EMS), focusing
on the key employee details: name, father's name, date of birth, salary, address, phone,
email, education, designation, Aadhaar number, and employee ID (emp ID).

1. Add New Employee

• Test Objective:
Verify that a new user can be added with correct details.
• Expected Result:
User is added successfully with all details.

2. View Employee Details

• Test Objective: Verify that employee details are displayed correctly.

7.2 Types of Testing

The first test approach is called black-box testing and the second, white-box testing. When
computer software is considered, black-box testing alludes to tests that are conducted at the
software interface. Although they are designed to uncover errors, black-box tests are used to
demonstrate that software functions are operational, that input is properly accepted and
output
84
is correctly produced, and that the integrity of external information (e.g., a database) is
maintained.

A black-box test examines some fundamental aspect of a system with little regard for the
internal logical structure of the software.

White-box testing of software is predicated on close examination of procedural detail.


Logical paths through the software are tested by providing test cases that exercise specific
sets of conditions and/or loops. The "status of the program" may be examined at various
points to determine if the expected or asserted status corresponds to the actual status.

WHITE-BOX TESTING: sometimes called glass-box testing, is a test case design method
that uses the control structure of the procedural design to derive test cases. Using white-box
testing methods, the software engineer can derive test cases that:
(1) guarantee that all independent paths within a module have been exercised at least once,
(2) exercise all logical decisions on their true and false sides,
(3) execute all loops at their boundaries and within their operational bounds, and
(4) exercise internal data structures to ensure their validity.

BLACK-BOX TESTING: is also called behavioral testing, focuses on the functional


requirements of the software. That is, black-box testing enables the software engineer to
derive sets of input conditions that will fully exercise all functional requirements for a
program. Blackbox testing is not an alternative to white-box techniques. Rather, it is a
complementary approach that is likely to uncover a different class of errors than white-box
methods.

Black-box testing attempts to find errors in the following categories:


(1) incorrect or missing functions,
(2) interface errors,
(3) errors in data structures or external data base access,
(4) behavior or performance errors, and

85
(5) initialization and termination errors.

86
Unlike white-box testing, which is performed early in the testing process, black-box testing
tends to be applied during later stages of testing. Because black-box testing purposely
disregards control structure, attention is focused on the information domain.

7.3 Testing Techniques and Types

i. Testing Techniques Used

• Black Box Testing: Focused on input/output, without knowing internal code

• White Box Testing: Involved in validating code logic (limited use)

• Manual Testing: Performed manually by testers using a test plan

• Automated Testing (Optional): Could include basic scripts using Selenium for
regression testing

ii. Functional Testing

Ensures that each feature functions correctly:

 User Registration
 Admin Login
 Add Expenses

iii. Non-Functional Testing

Tests attributes other than specific behaviors:

 Performance Testing: Load time and server response

 Usability Testing: Easy navigation, clear UI

 Security Testing: SQL injection, form validation, user authentication.

 Compatibility Testing: Across different browsers and devices

87
7.4 Test Plan Summary and Tools

i. Test Plan Overview

• Testing Environment: Windows 10, Chrome/Firefox, XAMPP server


• Test Tools: Browser DevTools, Postman (for API), Manual testing
• Test Duration: 5 Days
• Testers: Developer + 1 peer reviewer ii. Summary Table

88
CHAPTER – 8
SYSTEM
IMPLEMENTATION

System implementation refers to the process of deploying the developed web application into a
working environment, where users can access and interact with it. In this project,
implementation involved setting up the application on a local development environment for
testing, followed by a migration to a live or production environment. System
implementation covers the deployment environment setup and the necessary steps for both
developers and end-users to install and operate the application.

8.1How to Install & Run


The deployment utilizes the cross-platform capabilities of Flutter and the cloud infrastructure of
Firebase.

1. Prerequisites Setup: The developer must first install the prerequisites: the correct
version of the Flutter SDK and its bundled Dart SDK, followed by setting up the
necessary platform tools (Android Studio/SDK or Xcode for iOS development).

2. Environment Configuration: The Flutter bin directory must be added to the system's
PATH environment variable. The developer must then execute flutter doctor in the
command line to validate that all required toolchains, including the VS Code
extensions, are correctly installed and configured.

3. Project Acquisition: Clone the project repository from GitHub to the local machine.

4. Backend Integration: Create a new project in the Firebase console. Integrate the
89
platform- specific configuration files ([Link] for Android and
GoogleService- [Link] for iOS) into the Flutter project directories.

5. Dependency Retrieval: Run flutter pub get in the project root to install all required
Dart and Flutter packages (dependencies).

6. Execution: Launch a target device (physical device or emulator/simulator). Run the


application using the command flutter run or by utilizing the VS Code "Run and
Debug" feature.

8.2 User Guide/Manual of Project


The User Guide instructs end-users on how to effectively utilize the application’s features for
personal finance management.

1. Account Creation and Initial Setup:


 Navigate to the Register Screen. Users must provide their personal details and
accurately input their average Monthly Salary (e.g., ₹30000.0). This step is
foundational, as this salary figure dictates all budget calculations.

2. Login and Dashboard Overview:


 Upon logging in, the Dashboard (Welcome screen) is presented. This screen
provides an immediate snapshot of the user’s financial health: Total Salary (the
baseline), Total Expenses (current month's spending), and Remaining Balance
(available spending before hitting the saving goal).

3. Adding an Expense:
 Tap the 'Add New Expense' button.
 On the input screen, select the appropriate Category, enter the Amount, the
Date of the transaction, and an optional Description.
 Once submitted, the expense is recorded, and the Dashboard metrics are

90
updated instantly.

4. Monitoring Savings and Rewards:


 The primary goal is to maintain the Remaining Balance at or above the threshold that
guarantees a ₹2000 saving.
 If the user successfully maintains this threshold until the end of the month, a
congratulatory notification will appear on the dashboard, confirming that a
Token has been earned and added to the Token Rewards counter.

5. Viewing Reports:
 Users can access the Reports section to view categorical spending charts and
review their Token Rewards History, which validates their successful savings
months.

91
CHAPTER - 9
FURTHER SCOPE OF THE PROJECT

While the current implementation delivers a complete, gamified expense tracking


solution, the modular architecture and strong technological foundation (Flutter/Dart)
allow for significant expansion, ensuring the project’s longevity and academic
potential.

9.1 Future Extensions


Integration of Predictive Analytics (AI/ML)
The existing system relies on historical data (past expenses) to provide backward-
looking insights. The next logical step is integrating predictive analytics using
Machine Learning (ML). This would involve:

1. Model Training: Utilizing historical expense data categorized by time (daily,


weekly, monthly). Algorithms such as Linear Regression or Random Forest
Regressor, implemented via Python libraries like scikit-learn, could be trained to
identify cyclical spending patterns.

2. Proactive Budgeting: The trained model would predict future expenses, allowing the
system to suggest a proactive, data-driven budget to the user. This prediction moves
the system from reactive tracking to proactive financial planning, a significant
advancement in personal finance management.

Automated Data Entry via Optical Character Recognition (OCR)


Currently, all expense data requires manual input. Implementing OCR for receipt scanning
would drastically improve efficiency and minimize the potential for human error
inherent in manual entry.

92
 Mechanism: Users would capture a photo of a receipt. The OCR engine would
process the image, automatically extracting key fields such as Merchant,
Amount, and Date.
 Efficiency Gain: This automation would eliminate the need for manual data
entry, thereby enhancing the user experience and increasing data accuracy
significantly, as suggested by leading industry solutions.

93
CHAPTER – 10
CONCLUSION

The he Smart Expense Tracker project successfully addresses the challenges of tedious,
error-prone personal finance management by delivering a high-performance, cross- platform
mobile application. Utilizing Flutter and Dart, the project achieved architectural robustness
and ensured UI consistency across Android and iOS devices. The backend, anchored by
Firebase, provides scalable, persistent data storage and secure authentication.
The primary achievement of this project is the successful implementation of a novel
gamification system. By setting a clear, measurable savings goal ($\text{Savings} \geq
₹2000$) and rewarding its achievement with Tokens 1, the application effectively
transformed a passive tracking exercise into an active, motivating behavioral process. The
development of the Expense Tracker and the associated audit ledger ensures that positive
financial habits are reinforced, leading to sustained user engagement and improved financial
discipline.
In conclusion, the Smart Expense Tracker provides a sophisticated and practical solution for
effective money management, validating the technical feasibility of complex, modular
mobile application development and demonstrating the power of behavioral science
integration in Fintech applications.
From this project, we are able to manage and keep tracking the daily expenses as well as
income. While making this project, we gained a lot of experience of working as a team. We
discovered various predicted and unpredicted problems and we enjoyed a lot solving them as
a team. We adopted things like video tutorials, text tutorials, internet and learning materials
to make our project complete. Furthermore, now we know much more about the Android
platform, java language and the SQLite query.
After making this application we assure that this application will help its users to manage the
cost of their daily expenditure. It will guide them and aware them about there daily expenses.
It will prove to be helpful for the people who are frustrated with their daily budget
management, irritated because of amount of expenses and wishes to manage money and to
94
preserve the record of their daily cost which may be useful to change their way of spending
money. In short, this application will help its users to overcome the wastage of money.
The name of our project is " EXPENSE TRACKER" which is basically an Expense Tracker.
It works on the top of latest technology stack and is as interactive and friendly as it is named.
You have to provide the input manually or with the help of your speech (thanks to speechly
for making it happen easily).
The moment you fill in the input manually and click the "CREATE" button or the moment
you provide your voice command, the app stores the data with the help of context that makes
your app faster and the information is easily flowed between the various components of the
app. Then the information is populated in a list which if displayed just below the input
form.

95
CHAPTER – 11
BIBLIOGRAPHY & REFERENCES

11.1 Books
1. Martin, R. C. (2017). Clean Architecture: A Craftsman's Guide to Software Structure
and Design. Prentice Hall.
2. Gamma, E., et al. (1994). Design Patterns: Elements of Reusable Object-
Oriented Software. Addison-Wesley.
3. Freeman, A., & Robson, E. (2019). Pro React 16. Apress.
4. Krug, S. (2014). Don't Make Me Think, Revisited. New Riders.

11.2 Research Papers

1. Smith, J., & Johnson, M. (2021). "Machine Learning for Personal Finance Management."
Journal of Financial Technology, 15(3).
2. Patel, R., & Lee, S. (2020). "User Experience Design for Financial Applications."
International Journal of Human-Computer Interaction, 28(4).
3. Garcia, C., & Kim, T. (2019). "Security Challenges in Mobile Financial Applications."
IEEE Security & Privacy, 17(2).

11.3 Online Documentation

1. React Documentation. (2023). React: A JavaScript library for building user


interfaces. [Link]
2. Firebase Documentation. (2023). Firebase: Google's mobile and web
application development platform. [Link]
3. MDN Web Docs. (2023). Web technology for developers. [Link]
4. WCAG 2.1 Guidelines. (2018). [Link]

11.4 Open-Source Libraries

1. React. (2023). JavaScript library for building user interfaces. [Link]


2. Firebase. (2023). Backend-as-a-Service platform. [Link]
3. [Link]. (2023). JavaScript charting library. [Link]
4. Jest. (2023). JavaScript testing framework. [Link]

11.5 Websites and Blogs

1. Smashing Magazine. (2023). Web Design and Development


Blog. [Link]
96
2. CSS-Tricks. (2023). Web development resources. [Link]
3. [Link]. (2023). Software development community. [Link]
4. Stack Overflow. (2023). Programming Q&A community. [Link]

11.6 Standards and Guidelines

1. ISO/IEC 25010:2011. Systems and software quality models.


2. ISO/IEC 27001:2013. Information security management.
3. GDPR. (2018). General Data Protection Regulation. [Link]
4. PCI DSS. (2022). Payment Card Industry Data Security Standar

97

You might also like