Skip to content

About

A Spring Boot microservices-based Expense Tracker with API Gateway, Eureka Service Discovery, Config Server, OpenFeign, and PostgreSQL.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Meridian β€” Expense Tracker Microservices

A backend Expense Tracker application built with Java, Spring Boot, and Spring Cloud, designed using a microservices architecture.

The project separates user management, expense management, service discovery, centralized configuration, and API routing into independent services.

Architecture

                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚       Client        β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚    API Gateway      β”‚
                         β”‚      :8088          β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β–Ό                               β–Ό
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚   User Service  β”‚             β”‚ Expense Service β”‚
          β”‚      :8087      β”‚             β”‚      :8086      β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚                               β”‚
                   β”‚          OpenFeign            β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                                   β–Ό
                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚  PostgreSQL   β”‚
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚  Eureka Server  β”‚              β”‚  Config Server  β”‚
       β”‚      :8761      β”‚              β”‚   configurable  β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Services

Service Responsibility Port
config-server Centralized configuration Configured in service
eureka-server Service discovery and registration 8761
user-service User registration and profile management 8087
expense-service Expense management 8086
api-gateway Single entry point and request routing 8088

Tech Stack

Backend

  • Java 21
  • Spring Boot 4.1.1
  • Spring Cloud 2025.1.3
  • Spring Web
  • Spring Data JPA
  • Hibernate
  • Jakarta Validation
  • Lombok

Microservices

  • Spring Cloud Netflix Eureka
  • Spring Cloud Config
  • Spring Cloud Gateway
  • OpenFeign
  • Service Discovery
  • Client-side load balancing

Database

  • PostgreSQL
  • JPA / Hibernate

Tools

  • Maven
  • IntelliJ IDEA
  • Git
  • GitHub
  • Postman

Key Features

  • Microservices-based backend architecture
  • Centralized configuration using Spring Cloud Config
  • Service registration and discovery using Eureka
  • API Gateway for routing client requests
  • User management APIs
  • Expense management APIs
  • Inter-service communication using OpenFeign
  • PostgreSQL persistence
  • RESTful APIs
  • Jakarta Bean Validation
  • Independent service structure suitable for deployment

Project Structure

Meridian-Spring/
β”‚
β”œβ”€β”€ api-gateway/
β”‚   β”œβ”€β”€ src/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ config-server/
β”‚   β”œβ”€β”€ src/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ eureka-server/
β”‚   β”œβ”€β”€ src/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ user-service/
β”‚   β”œβ”€β”€ src/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ expense-service/
β”‚   β”œβ”€β”€ src/
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ .gitignore
└── README.md

Service Communication

API Gateway

The API Gateway acts as the single entry point for client requests.

Client
  β”‚
  β–Ό
http://localhost:8088
  β”‚
  β”œβ”€β”€ /user-service/**
  β”‚
  └── /expense-service/**

Requests are routed to the corresponding service through service discovery.

Eureka Service Discovery

Application services register with the Eureka Server.

Eureka Server :8761
       β”‚
       β”œβ”€β”€ API-GATEWAY
       β”œβ”€β”€ USER-SERVICE
       └── MERIDIAN

MERIDIAN is the registered service name used by the Expense Service.

OpenFeign

The Expense Service communicates with the User Service using OpenFeign and Eureka-based service discovery rather than relying on a hardcoded service IP.

User Service

Base URL:

http://localhost:8087

Main APIs

Method Endpoint Description
POST /api/users/signup Create a user
GET /api/users/{id} Get user profile
GET /api/users/getAllUsers Get all users
PUT /api/users/editProfile/{id} Edit user profile
PATCH /api/users/editProfileField/{id} Edit individual profile fields
DELETE /api/users/deleteUserById/{id} Delete user

Expense Service

Base URL:

http://localhost:8086

The Expense Service manages expense-related operations and communicates with the User Service through OpenFeign.

API Gateway

Base URL:

http://localhost:8088

Example:

GET /user-service/api/users/getAllUsers

The Gateway resolves USER-SERVICE through Eureka and forwards the request to the User Service.

Config Server

The Config Server provides centralized configuration for the microservices.

This allows common and environment-specific configuration to be managed centrally instead of duplicating configuration across services.

For deployment, sensitive values such as database passwords, API keys, and tokens should be supplied through environment variables or platform secrets rather than committed to GitHub.

Running Locally

Prerequisites

  • Java 21
  • Maven
  • PostgreSQL
  • Git

Verify:

java -version
mvn -version

Startup Order

Start the services in this order:

1. Config Server
2. Eureka Server
3. User Service
4. Expense Service
5. API Gateway

Eureka dashboard:

http://localhost:8761

User Service:

http://localhost:8087

Expense Service:

http://localhost:8086

API Gateway:

http://localhost:8088

Database Configuration

The services use PostgreSQL for persistence.

Use environment variables for credentials:

spring.datasource.url=${DATABASE_URL}
spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}

Do not commit production credentials to GitHub.

Screenshots

Eureka Service Registry

Screenshot 2026-09-16 194914 Screenshot 2026-09-16 194923

API

Screenshot 2026-09-16 200757

Future Improvements

  • JWT authentication and authorization
  • Role-based access control
  • Expense categories and analytics
  • Pagination and sorting
  • Global exception handling
  • Swagger / OpenAPI documentation
  • Docker containerization
  • GitHub Actions CI/CD
  • Redis caching
  • Kafka-based event-driven communication
  • Prometheus and Grafana monitoring
  • Cloud deployment

Learning Goals

This project demonstrates practical experience with:

Java
  ↓
Spring Boot
  ↓
REST APIs
  ↓
Spring Cloud
  β”œβ”€β”€ Config Server
  β”œβ”€β”€ Eureka
  β”œβ”€β”€ Gateway
  └── OpenFeign
  ↓
PostgreSQL
  ↓
Microservices Architecture

Author

Krishna Sai Raj

Java | Spring Boot | Microservices | Cloud | GenAI

License

This project is intended for learning and portfolio purposes.

About

A Spring Boot microservices-based Expense Tracker with API Gateway, Eureka Service Discovery, Config Server, OpenFeign, and PostgreSQL.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages