Skip to content

Alimddar/ExpenseTracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Expense Tracker Application

A backend REST API application built with Java Spring Boot for expense tracking, featuring expense management, categorization, and comprehensive statistics endpoints.

Features

  • RESTful API with full CRUD operations
  • SQLite database for data persistence
  • Expense and Category management
  • Comprehensive statistics endpoints:
    • Total expenses
    • Average expense
    • Daily statistics
    • Monthly statistics
    • Category-based statistics

Technology Stack

  • Java 21
  • Spring Boot 3.5.7
  • Spring Data JPA
  • SQLite Database
  • Maven

Project Structure

expense-tracker/
└── backend/
    └── expense-tracker/
        ├── src/
        │   └── main/
        │       ├── java/com/example/expense_tracker/
        │       │   ├── model/           # Entity classes
        │       │   ├── repository/      # Data access layer
        │       │   ├── service/         # Business logic
        │       │   └── controller/      # REST endpoints
        │       └── resources/
        │           └── application.properties
        └── pom.xml

Setup and Installation

Prerequisites

  • Java 21 or higher
  • Maven

Backend Setup

  1. Navigate to the backend directory:
cd backend/expense-tracker
  1. Build the project:
./mvnw clean install
  1. Run the Spring Boot application:
./mvnw spring-boot:run

The backend server will start on http://localhost:8080

API Endpoints

Categories

  • GET /api/categories - Get all categories
  • GET /api/categories/{id} - Get category by ID
  • POST /api/categories - Create new category
  • PUT /api/categories/{id} - Update category
  • DELETE /api/categories/{id} - Delete category

Expenses

  • GET /api/expenses - Get all expenses
  • GET /api/expenses/{id} - Get expense by ID
  • POST /api/expenses - Create new expense
  • PUT /api/expenses/{id} - Update expense
  • DELETE /api/expenses/{id} - Delete expense
  • GET /api/expenses/category/{categoryId} - Get expenses by category

Statistics

  • GET /api/expenses/statistics - Get overall statistics (total, average)
  • GET /api/expenses/statistics/daily - Get today's statistics
  • GET /api/expenses/statistics/monthly - Get current month's statistics
  • GET /api/expenses/statistics/by-category - Get expenses grouped by category

Usage

Use the REST API endpoints to:

  1. Create Categories: Create expense categories (e.g., Food, Transport, Entertainment)
  2. Add Expenses: Add expenses with description, amount, and category
  3. Filter Expenses: Query expenses by specific categories
  4. View Statistics: Get statistics on your spending including total, average, daily, and monthly summaries
  5. Manage Data: Update or delete expenses and categories as needed

Database

The application uses SQLite database which is automatically created as expense_tracker.db in the backend project root directory when you first run the application.

Features in Detail

Expense Management

  • CRUD operations for expenses (description, amount, category)
  • Retrieve all expenses with timestamps
  • Filter expenses by category
  • Get individual expense by ID

Category Management

  • CRUD operations for categories (name, description)
  • Retrieve all categories
  • Unique category names enforced
  • Cascade deletion (deleting a category removes associated expenses)

Statistics

  • Overall statistics (total expenses, average expense)
  • Daily expense tracking
  • Monthly expense tracking
  • Category-based expense grouping

Development

The backend uses Spring Boot with JPA/Hibernate for database operations. SQLite dialect is configured for compatibility.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages