Skip to content

AbdullahAbdelaziz122/Expense-Tracker-FullStack-JavaFX-SpringBoot-SQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Smart Spend - Personal Expense Tracker

Java Spring Boot JavaFX License

A powerful, full-stack desktop application for tracking personal finances with an intuitive user interface and robust backend architecture. Built with modern Java technologies to demonstrate enterprise-level software development practices.


πŸ“Έ Screenshots

Login/Registration screens

Login Signup

Dashboard with balance summary

dashboard

Transaction management interface

Create-Transaction

Category management views

Create-Categories View-Categories


🌟 Key Features

User Management

  • Secure Authentication - User registration and login system
  • Email Validation - Built-in email format validation using Apache Commons Validator
  • User Profile Management - Track user creation dates and account information

Transaction Management

  • CRUD Operations - Full create, read, update, and delete functionality for transactions
  • Transaction Categorization - Organize expenses and income by custom categories
  • Transaction Types - Support for both income and expense tracking
  • Date Tracking - Record transaction dates with precise timestamp logging
  • Pagination Support - Efficiently handle large transaction histories with paginated API responses

Category System

  • Custom Categories - Create personalized expense/income categories
  • Color Coding - Visual identification with customizable color schemes
  • Category Management - Full CRUD operations for transaction categories
  • User-Specific Categories - Each user maintains their own category library

Dashboard & Analytics

  • Balance Summary - Real-time display of current balance, total income, and total expenses
  • Recent Transactions - Quick view of latest financial activities
  • Responsive UI - Adaptive layout with custom CSS styling

πŸ—οΈ Architecture & Design

Backend Architecture (Spring Boot)

src/
β”œβ”€β”€ config
β”‚   β”œβ”€β”€ BCryptConfig
β”‚   └── SecurityConfig
β”‚
β”œβ”€β”€ controllers/          # REST API endpoints
β”‚   β”œβ”€β”€ UserController
β”‚   β”œβ”€β”€ TransactionController
β”‚   └── TransactionCategoryController
β”‚
β”œβ”€β”€ services/            # Business logic layer
β”‚   β”œβ”€β”€ UserService
β”‚   β”œβ”€β”€ TransactionService
β”‚   └── TransactionCategoryService
β”‚
β”œβ”€β”€ repositories/        # Data access layer (JPA)
β”‚
β”œβ”€β”€ models/             # JPA entities
β”‚   β”œβ”€β”€ User
β”‚   β”œβ”€β”€ Transaction
β”‚   └── TransactionCategory
β”‚
β”œβ”€β”€ DTO/                # Data Transfer Objects
β”‚
└── exceptions/         # Custom exception handling
β”‚
└── repositories/       # repositories
β”‚
└──ExpenseTrackerApplicatoin.java # main app

Frontend Architecture (JavaFX)

src/
β”œβ”€β”€ animations/
β”‚   └── LoadingAnimationPane
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ CategoryComponent
β”‚   └── TransactionComponent
β”‚
β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ DashboardController
β”‚   β”œβ”€β”€ LoginController
β”‚   └── SignUpController
β”‚
β”œβ”€β”€ dialogs/
β”‚   β”œβ”€β”€ CreateNewTransactionCategoryDialog
β”‚   β”œβ”€β”€ CreateOrEditTransactionDialog
β”‚   β”œβ”€β”€ CustomDialog
β”‚   β”œβ”€β”€ ViewChartDialog
β”‚   β”œβ”€β”€ ViewOrEditTransactionCategoryDialog
β”‚   └── ViewTransactionDialog
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ MonthlyFinance
β”‚   β”œβ”€β”€ Transaction
β”‚   β”œβ”€β”€ TransactionCategory
β”‚   └── User
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ ApiUtil        # HTTP client for backend communication
β”‚   β”œβ”€β”€ SqlUtil        # Data operations wrapper
β”‚   β”œβ”€β”€ Utility        # contains application constants
β”‚   └── ViewNavigator  # Scene management
β”‚
β”œβ”€β”€ views/              # JavaFX UI components
β”‚   β”œβ”€β”€ LoginView
β”‚   β”œβ”€β”€ SignUpView
β”‚   └── DashboardView
└── JavaFXApplication.java

πŸ”§ Technology Stack

Backend

Technology Purpose
Spring Boot 3.x Core framework for REST API development
Spring Data JPA Object-relational mapping and database operations
Hibernate JPA implementation for entity management
Lombok Reduce boilerplate code with annotations
Jakarta Validation Input validation and data integrity
MySQL/PostgreSQL Relational database (configurable)

Frontend

Technology Purpose
JavaFX 23 Rich desktop UI framework
GSON JSON parsing and serialization
Apache Commons Validator Email and input validation
Custom CSS Styled UI components

Development Tools

  • Maven - Dependency management and build automation
  • Git - Version control
  • Postman/Insomnia - API testing (recommended)

πŸ“‹ Prerequisites

Before running this application, ensure you have:

  • Java Development Kit (JDK) 25 or higher
  • Maven 3.8+
  • MySQL 8.0+ or PostgreSQL 14+

πŸš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/AbdullahAbdelaziz122/smart-spend-expense-tracker.git

2. Database Setup

MySQL Configuration

CREATE DATABASE expense_tracker;
CREATE USER 'expense_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON expense_tracker.* TO 'expense_user'@'localhost';
FLUSH PRIVILEGES;

3. Backend Configuration

Navigate to backend/src/main/resources/application.properties:

# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/expense_tracker
spring.datasource.username=expense_user
spring.datasource.password=your_password

# JPA Configuration
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

# Server Configuration
server.port=8080

4. Build & Run Backend

cd backend
mvn clean install
mvn spring-boot:run

The backend API will be available at http://localhost:8080

5. Configure Frontend

Update frontend/src/main/java/org/example/utils/ApiUtil.java if needed:

private static final String SPRINGBOOT_URL = "http://localhost:8080";

6. Build & Run Frontend

cd frontend
mvn clean javafx:run

πŸ“‘ API Documentation

ApiDog documentation

Get All Endpoints: https://l23i72f0hh.apidog.io

User Endpoints

Register User

POST /api/v1/user/register
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securePassword123"
}

Login

POST /api/v1/user/login
Content-Type: application/json

{
  "email": "john@example.com",
  "password": "securePassword123"
}

Get User by ID

GET /api/v1/user/{userId}

Get User by Email

GET /api/v1/user?email=john@example.com

Transaction Endpoints

Create Transaction

POST /api/v1/transaction
Content-Type: application/json

{
  "name": "Grocery Shopping",
  "amount": 125.50,
  "type": "EXPENSE",
  "date": "2024-01-15",
  "userId": 1,
  "categoryId": 3
}

Get User Transactions

GET /api/v1/transaction/{userId}

Get Recent Transactions (Paginated)

GET /api/v1/transaction/recent/user/{userId}?page=0&size=5

Update Transaction

PUT /api/v1/transaction
Content-Type: application/json

{
  "id": 10,
  "name": "Updated Transaction",
  "amount": 150.00,
  "type": "EXPENSE",
  "date": "2024-01-16",
  "categoryId": 4
}

Delete Transaction

DELETE /api/v1/transaction/{transactionId}

Category Endpoints

Create Category

POST /api/v1/transaction-category
Content-Type: application/json

{
  "userId": 1,
  "categoryName": "Food & Dining",
  "categoryColor": "FF5733"
}

Get User Categories

GET /api/v1/transaction-category/user/{userId}

Update Category

PUT /api/v1/transaction-category
Content-Type: application/json

{
  "categoryId": 5,
  "categoryName": "Updated Category Name",
  "categoryColor": "00FF00"
}

Delete Category

DELETE /api/v1/transaction-category/{categoryId}

πŸ—„οΈ Database Schema

User Table

CREATE TABLE user (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,
    created_at DATE NOT NULL
);

Transaction Category Table

CREATE TABLE transaction_category (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    user_id BIGINT NOT NULL,
    category_name VARCHAR(255) NOT NULL,
    category_color VARCHAR(50) NOT NULL,
    FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE
);

Transactions Table

CREATE TABLE transactions (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(255) NOT NULL,
    amount DOUBLE NOT NULL,
    transaction_date DATE,
    created_at DATETIME NOT NULL,
    type VARCHAR(50),
    user_id BIGINT NOT NULL,
    category_id BIGINT NOT NULL,
    FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE,
    FOREIGN KEY (category_id) REFERENCES transaction_category(id)
);

🎨 Design Patterns Implemented

Backend Patterns

  • MVC (Model-View-Controller) - Separation of concerns in REST API
  • Repository Pattern - Data access abstraction with Spring Data JPA
  • Service Layer Pattern - Business logic encapsulation
  • DTO Pattern - Data transfer between layers
  • Dependency Injection - Using Spring's IoC container
  • Exception Handling - Global exception handling with custom exceptions

Frontend Patterns

  • MVC Pattern - Separation of UI, controllers, and models
  • Singleton Pattern - ViewNavigator for scene management
  • Utility Pattern - Helper classes for common operations
  • Observer Pattern - JavaFX property bindings and listeners

πŸ”’ Security Considerations

Current Implementation

  • βœ… Input validation on both frontend and backend
  • βœ… Custom exception handling for error management
  • βœ… Email format validation
  • βœ… User-category ownership verification
  • βœ… Password Hashing Using BCrypt

Soon Enhancements

  • πŸ”§ JWT Authentication - Add token-based authentication for API security
  • πŸ”§ HTTPS/TLS - Enable secure communication in production
  • πŸ”§ Input Sanitization - Additional XSS and SQL injection prevention
  • πŸ”§ Rate Limiting - Protect against brute force attacks


πŸ“ˆ Future Enhancements

Planned Features

  • Data Visualization - Charts and graphs for spending patterns
  • Budget Management - Set monthly/category budgets with alerts
  • Recurring Transactions - Automated tracking of subscriptions
  • Export Functionality - PDF/Excel reports generation
  • Multi-Currency Support - Handle international transactions
  • Search & Filters - Advanced transaction filtering
  • Mobile App - React Native or Flutter companion app
  • Cloud Deployment - AWS/Azure hosting with CI/CD pipeline

Technical Improvements

  • JWT-based authentication
  • Redis caching for performance
  • Docker containerization
  • Comprehensive test coverage (80%+)
  • API documentation with Swagger/OpenAPI

About

Expense Tracker Application built using JavaFX for the FrontEnd and SpringBoot with SQL integration for the Backend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published