This is a distributed microservices application with the following architecture:
┌─────────────────────────────────────────────────┐
│ API Gateway (Spring Cloud) │
│ JWT Validation & Routing │
└────────────┬───────────────���────────────────────┘
│
┌────────┴──────────────────────┬──────────────────┬──────────────┐
│ │ │ │
┌───▼───┐ ┌──────────┐ ┌────────▼───┐ ┌──────────▼──┐ ┌───────▼──┐
│ Auth │ │ Profile │ │ Order │ │ Bill │ │ Discovery│
│Service│ │ Service │ │ Service │ │ Service │ │ Service │
└───┬───┘ └────┬─────┘ └────┬───────┘ └───────┬─────┘ └──────────┘
│ │ │ │
└───────────┴─────────────┴──────────────────┘
│
┌────────┴──────────────┐
│ │
┌───▼──────┐ ┌──────▼────┐
│ MySQL │ │ Redis │
│Database │ │ Cache │
└──────────┘ └───────────┘
Manages user authentication with hybrid JWT and stateful session control.
Key Features:
- ✅ Hybrid JWT Authentication (stateless + stateful)
- ✅ AES-192 Password Encryption
- ✅ Redis-based Token Session Management
- ✅ Employee Role-Based Access Control
- ✅ Immediate Token Revocation Support
Technology Stack:
- Spring Boot 4.0.1
- Spring Security
- JWT (JSON Web Tokens)
- Redis
- MySQL
Key Files:
AuthService.md- Hybrid JWT documentationTokenService.java- Token generation, validation, logoutEmployeeService.java- Employee CRUD operationsAES.java- Password encryption/decryption
Manages client and publication profiles with caching and circuit breaker protection.
Key Features:
- ✅ Client Profile Management
- ✅ Publication Management
- ✅ Redis Cache-First Pattern
- ✅ Circuit Breaker (Resilience4j)
- ✅ GST & State Code Management
- ✅ Pagination Support
Technology Stack:
- Spring Boot 3.5.7
- Spring Data JPA
- Redis (Caching)
- MySQL
- Swagger/OpenAPI
Key Files:
ClientService.md- Cache-first pattern & circuit breaker documentationPublicationRepo.java- Publication data accessGstRepo.java- GST managementSecurityConfig.java- Role-based access control
Manages orders and release orders (RO) for publications.
Key Features:
- ✅ Estimate Creation & Management
- ✅ Release Order (RO) Generation
- ✅ PDF Report Generation
- ✅ Publication Rate Management
- ✅ Order Status Tracking
- ✅ Service-to-service Communication
Technology Stack:
- Spring Boot 4.0.1
- Spring Data JPA
- Redis
- MySQL
- Thymeleaf (HTML Templates)
Key Templates:
estimateMultiPageFirstPage.html- Estimate documentroPage.html- Release order document
Manages billing and invoice generation with automatic bill ID generation.
Key Features:
- ✅ Monthly Auto-Reset Bill Counter
- ✅ Financial Year Calculation (April-March cycle)
- ✅ Tax Invoice Generation
- ✅ Publication-wise Billing
- ✅ Discount & GST Calculation
- ✅ Thread-Safe Bill ID Generation
Bill ID Format: MM/COUNT/YY-YY
- Example:
01/1/24-25(First bill of January 2025) - Auto-resets to 1 each month
- Financial year: April to March
Technology Stack:
- Spring Boot 4.0.1
- Spring Cloud (Circuit Breaker, Load Balancer)
- Thymeleaf (HTML Templates)
- MySQL
Key Files:
BillIdGenerator.md- Complete ID generation documentationBillService.java- Bill operationsbillSinglePage.html- Single-page invoicebillMultiPageLastPage.html- Multi-page invoice
Eureka service registry for microservice discovery.
Key Features:
- ✅ Service Registration & Discovery
- ✅ Health Checks
- ✅ Load Balancing Support
Technology Stack:
- Spring Cloud Netflix Eureka
- Spring Boot 4.0.1
Ports:
- Development:
8086 - Production: Configurable via
${PORT}
API Gateway with JWT validation and request routing.
Key Features:
- ✅ JWT Token Validation
- ✅ Request Routing to Microservices
- ✅ Custom Gateway Filters
- ✅ Path Blocking
- ✅ Service Discovery Integration
Gateway Routes:
/api/v1/auth/**→ Auth Service/api/v1/profile/**→ Profile Service/api/v1/order/**→ Order Service/api/v1/billing/**→ Bill Service
Technology Stack:
- Spring Cloud Gateway
- Spring Cloud Netflix Eureka Client
- Reactive (WebFlux)
Key Files:
JwtValidationGatewayFilterFactory.java- Token validation filterBlockValidateGatewayFilterFactory.java- Path blocking filterapplication-dev.yml- Development routes configuration
Four separate databases for each service:
CREATE DATABASE icProfile; -- Client & Publication data
CREATE DATABASE icOrder; -- Orders & Estimates
CREATE DATABASE icBill; -- Billing & Invoices
CREATE DATABASE icAuth; -- Employee & AuthenticationShared Sequences Table:
CREATE TABLE `id_sequence` (
`sequence_name` varchar(30) NOT NULL,
`current_value` bigint NOT NULL DEFAULT '0',
PRIMARY KEY (`sequence_name`)
);Sequences:
BILLCOUNT- Bill ID counterCLIENTID- Client identifierEMPLOYEEID- Employee identifierESTIMATEID- Estimate identifierPUBLICATIONID- Publication identifierREPRESENTATIVEID- Representative identifierROID- Release Order identifier
docker-compose up -dStateless JWT:
- Claims:
empId,role,jti(JWT ID) - Fast authentication without database hits
Stateful Server Control:
- Redis stores
jtifor each employee - Immediate token revocation capability
- Single active session per employee (configurable)
Benefits:
- ✅ High security (stolen tokens can be revoked)
- ✅ High performance (stateless JWT verification)
- ✅ Admin control (force logout, session management)
- ✅ Device-specific session management
Algorithm: AES-192 (ECB mode with PKCS5Padding)
- Configured in
AES.java - Secret key length: 24 characters
Roles:
USER- Basic user accessEDITOR- Create/update contentADMIN- Full administrative accessORDER_SERVICE- Service-to-service callsBILLING_SERVICE- Service-to-service calls
Services communicate through:
- HTTP/REST via Spring WebClient
- Service Discovery via Eureka
- Load Balancing via Spring Cloud LoadBalancer
- Circuit Breaker via Resilience4j
// Fetch client details from Profile Service
profile-service://ic-profile-service/v1/profile/clients/{clientId}Profile Service:
- Key Format: Entity ID or custom patterns
- TTL: 10 minutes (configurable)
- Fallback: Database query on cache miss
Cache-First Pattern:
- Check Redis cache
- If miss, fetch from database
- Update cache with fresh data
- Return to client
Profile Service (Read Operations):
- Name:
clientServiceRead - Failure Rate: 50%
- Sliding Window: 100 calls
- Minimum Calls: 10
- Wait Duration (OPEN): 30 seconds
- Fallback: Return cached data if available
Each service provides Swagger/OpenAPI documentation:
- Auth Service:
/auth/api-docs - Profile Service:
/profile/api-docs - Order Service:
/order/api-docs - Bill Service:
/billing/api-docs
Gateway routes these to Swagger UI:
http://localhost:8082/auth/swagger-ui.htmlhttp://localhost:8082/profile/swagger-ui.html- etc.
- Java 21 (Auth, Bill, Order, Discovery, Gateway services)
- Java 17 (Gateway service)
- Maven 3.9.9
- Docker & Docker Compose
- MySQL 8.0+
- Redis Alpine
# Build Auth Service
cd auth-service
mvn clean package
# Build Profile Service
cd profile-service
mvn clean package
# Similar for other services# From each service directory
docker build -t debayan2003/ic-{service-name}:v1 .- Start MySQL and Redis locally
- Create databases using
db create.txtscript - Run each service from IDE or command line:
cd auth-service
mvn spring-boot:runEach service exposes:
/actuator/health- Service health status/actuator/metrics- Application metrics/actuator/**- Full actuator endpoints
http://localhost:8082/auth/actuator/**http://localhost:8082/profile/actuator/**- etc.
This project is managed by Debayan-Guha.