Spring Boot microservices architecture for the Autonova automobile service management platform
- Overview
- Architecture
- Services
- Technologies
- Quick Start
- API Documentation
- Configuration
- Testing
- Monitoring
- Troubleshooting
The Autonova backend is a microservices-based system built with Spring Boot and Spring Cloud. It provides RESTful APIs for managing vehicle services, appointments, customer data, employee tasks, and billing. The system uses Netflix Eureka for service discovery, Spring Cloud Gateway for API routing, and RabbitMQ for event-driven communication.
- 🏗️ 9+ Microservices - Independently deployable services
- 🔐 Secure Authentication - JWT + OAuth2 Google login
- 📊 Service Discovery - Dynamic registration with Eureka
- 🔄 Event-Driven - RabbitMQ for async messaging
- 🐳 Docker Ready - Full containerization support
- 📈 Monitoring - Spring Actuator health checks
- 📖 API Docs - Swagger/OpenAPI documentation
┌─────────────────────────────────────────────────────────────────┐
│ API Gateway (:8080) │
│ (Spring Cloud Gateway - Routing, Load Balancing, CORS) │
└────────────────────────┬────────────────────────────────────────┘
│
┌──────────────┼──────────────┐
│ │ │
┌─────▼─────┐ ┌─────▼─────┐ ┌────▼──────┐
│ Service │ │ Auth │ │ Customer │
│ Discovery │ │ Service │ │ Service │
│ (Eureka) │ │ :8081 │ │ :8087 │
│ :8761 │ └─────┬─────┘ └─────┬─────┘
└───────────┘ │ │
│ │
┌──────────┴──────────────┴──────────────┐
│ │
┌────▼────┐ ┌──────────┐ ┌────────────▼──┐
│Employee │ │Appointment│ │ Progress │
│Dashboard│ │ Booking │ │ Monitoring │
│ :8084 │ │ :8083 │ │ :8085 │
└────┬────┘ └─────┬─────┘ └───────┬───────┘
│ │ │
└───────────────┼──────────────────┘
│
┌────▼─────┐
│PostgreSQL│
│ :5432 │
└──────────┘
│
┌────▼─────┐
│ RabbitMQ │
│:5672,15672│
└──────────┘
- Microservices Architecture - Loosely coupled, independently deployable services
- API Gateway Pattern - Centralized entry point for all client requests
- Service Discovery - Dynamic service registration and discovery with Eureka
- Event-Driven Architecture - Asynchronous communication via RabbitMQ
- Database per Service - Each service has its own database schema
- CQRS - Command Query Responsibility Segregation for complex queries
| Service | Port | Description | Key Features |
|---|---|---|---|
| Gateway Service | 8080 | API Gateway - Single entry point | Routing, CORS, Load balancing |
| Discovery Service | 8761 | Eureka - Service registry | Service registration, Health checks |
| Auth Service | 8081 | Authentication & authorization | JWT, OAuth2, User management, RBAC |
| Customer Service | 8087 | Customer & vehicle management | CRUD operations, Vehicle tracking |
| Employee Dashboard | 8084 | Employee tasks & time logs | Task assignment, Time tracking |
| Appointment Booking | 8083 | Service booking management | Scheduling, Availability checks |
| Progress Monitoring | 8085 | Real-time service tracking | Status updates, Progress notifications |
| Time Logging | 8086 | Time tracking analytics | Log management, Reports, Analytics |
| Notification Service | 8088 | Email/SMS notifications | Template engine, Multi-channel alerts |
| Project Service | 8082 | Project management (.NET) | .NET Core integration, Project CRUD |
- 🔐 Auth Service README - Authentication & user management
- 👥 Customer Service README - Customer & vehicle operations
- 💼 Employee Dashboard README - Employee features
- Java 17 - Programming language
- Spring Boot 3.3.3 - Application framework
- Spring Cloud 2023.0.3 - Microservices infrastructure
- Maven 3.9 - Build automation and dependency management
- Spring Security 6 - Authentication and authorization
- Spring Data JPA - Database ORM and repositories
- Spring Cloud Gateway - API Gateway
- Spring Cloud Netflix Eureka - Service discovery
- Spring AMQP - RabbitMQ integration
- Spring Actuator - Health monitoring and metrics
- Spring Boot DevTools - Development productivity
- PostgreSQL 17 - Primary database
- Flyway - Database migration tool
- RabbitMQ 4.1.4 - Message broker (AMQP protocol)
- JJWT 0.11.5 - JWT token generation and validation
- BCrypt - Password hashing algorithm
- OAuth2 Client - Google authentication integration
- JUnit 5 - Unit testing framework
- Spring Boot Test - Integration testing
- Mockito - Mocking framework
- H2 Database - In-memory testing database
- Springdoc OpenAPI 3 - API documentation (Swagger UI)
- Micrometer - Application metrics
- Logback - Logging framework
- SLF4J - Logging facade
- Docker - Containerization
- Docker Compose - Multi-container orchestration
- GitHub Actions - CI/CD pipeline
# Check installations
java -version # Java 17 or higher
mvn -version # Maven 3.9+
docker --version # Docker 20.10+
docker-compose --versioncd infra
cp .env.example .env # Create environment file
# Edit .env with your configurations
nano .env
# Start PostgreSQL, RabbitMQ, and Eureka
docker-compose up -dServices Started:
- ✅ PostgreSQL (:5432)
- ✅ RabbitMQ (:5672, :15672 management UI)
- ✅ Eureka Discovery (:8761)
# From autonova-backend root
docker-compose up --buildOr start individual services:
docker-compose up -d gateway-service
docker-compose up -d auth-service
docker-compose up -d customer-service- Eureka Dashboard: http://localhost:8761
- RabbitMQ Management: http://localhost:15672 (admin/admin123)
- Gateway Health: http://localhost:8080/actuator/health
cd infra
docker-compose up -d postgres rabbitmq# From autonova-backend root
mvn clean install -DskipTestsTerminal 1 - Discovery Service (Start First):
cd discovery-service
mvn spring-boot:runWait for Eureka to start (check http://localhost:8761)
Terminal 2 - Gateway Service:
cd gateway-service
mvn spring-boot:runTerminal 3 - Auth Service:
cd auth-service
mvn spring-boot:runTerminal 4 - Customer Service:
cd customer-service
mvn spring-boot:runTerminal 5 - Employee Dashboard:
cd employee-dashboard-service
mvn spring-boot:runcd services/project-service
dotnet restore
dotnet build
dotnet run --urls "http://localhost:8082"# Build JAR files
mvn clean package -DskipTests
# Run each service
java -jar gateway-service/target/gateway-service-*.jar
java -jar auth-service/target/auth-service-*.jar
# ... repeat for other servicesOnce services are running, access Swagger documentation:
- Gateway Aggregated API: http://localhost:8080/swagger-ui.html
- Auth Service: http://localhost:8081/swagger-ui.html
- Customer Service: http://localhost:8087/swagger-ui.html
- Employee Dashboard: http://localhost:8084/swagger-ui.html
POST /api/auth/login # User login (returns JWT)
POST /api/auth/signup # User registration
POST /api/auth/refresh # Refresh JWT token
GET /api/auth/google # OAuth2 Google login redirect
POST /api/auth/logout # Logout (invalidate token)
POST /api/auth/forgot-password # Request password reset
POST /api/auth/reset-password # Reset password with tokenGET /api/users # List all users (Admin only)
POST /api/users # Create new user
GET /api/users/{id} # Get user details
PUT /api/users/{id} # Update user
DELETE /api/users/{id} # Delete user (Admin only)
GET /api/users/me # Get current user profileGET /api/customers # List customers
POST /api/customers # Create customer
GET /api/customers/{id} # Get customer details
PUT /api/customers/{id} # Update customer
DELETE /api/customers/{id} # Delete customer
GET /api/customers/{id}/vehicles # Get customer vehiclesGET /api/appointments # List appointments
POST /api/appointments # Create appointment
GET /api/appointments/{id} # Get appointment details
PUT /api/appointments/{id} # Update appointment
DELETE /api/appointments/{id} # Cancel appointmentGET /api/employees/tasks # Get assigned tasks
GET /api/employees/time-logs # Get time logs
POST /api/employees/time-logs # Create time log entry
GET /api/employees/performance # Get performance metricsAll protected endpoints require JWT token in Authorization header:
Authorization: Bearer <your-jwt-token>Create .env file in infra/ directory:
# Database Configuration
POSTGRES_DB=autonova
POSTGRES_USER=admin
POSTGRES_PASSWORD=secure_password_123
# RabbitMQ Configuration
RABBITMQ_USER=admin
RABBITMQ_PASS=secure_rabbitmq_pass
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
# JWT Configuration
JWT_SECRET=your-256-bit-secret-key-minimum-32-characters
JWT_EXPIRATION=3600000 # 1 hour in milliseconds
# OAuth2 Configuration
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:8080/login/oauth2/code/google
# Service Ports
GATEWAY_PORT=8080
EUREKA_PORT=8761
AUTH_SERVICE_PORT=8081
CUSTOMER_SERVICE_PORT=8087
EMPLOYEE_SERVICE_PORT=8084
# Spring Profiles
SPRING_PROFILES_ACTIVE=devThe Docker Compose setup includes automatic database initialization:
# infra/init-scripts/ contains initialization SQL
# Databases created automatically on first run:
- autonova (main database)
- auth_service_db
- customer_service_db
- employee_service_db-- Connect to PostgreSQL
psql -h localhost -U admin -d postgres
-- Create databases
CREATE DATABASE autonova;
CREATE DATABASE auth_service_db;
CREATE DATABASE customer_service_db;
-- Verify
\lDatabase schemas are managed with Flyway:
src/main/resources/db/migration/
├── V1__Create_users_table.sql
├── V2__Create_vehicles_table.sql
└── V3__Create_appointments_table.sql
Migrations run automatically on application startup.
# From autonova-backend root
mvn testcd auth-service
mvn test
cd customer-service
mvn testmvn verify -P integration-testsmvn jacoco:report
# View report
open target/site/jacoco/index.htmlmvn test -Dtest=UserServiceTestCheck service health via Actuator endpoints:
# Gateway health
curl http://localhost:8080/actuator/health
# Auth service health
curl http://localhost:8081/actuator/health
# All registered services (Eureka)
curl http://localhost:8761/eureka/apps# Application metrics
curl http://localhost:8080/actuator/metrics
# JVM memory
curl http://localhost:8080/actuator/metrics/jvm.memory.used
# HTTP request stats
curl http://localhost:8080/actuator/metrics/http.server.requestsView all registered services at Eureka Dashboard:
RabbitMQ Management Console:
- URL: http://localhost:15672
- Username:
admin - Password:
admin123
# Check if ports are available
lsof -i :8080 # Gateway
lsof -i :8081 # Auth service
lsof -i :5432 # PostgreSQL
# Kill processes if needed
kill -9 <PID># Check Eureka is running
curl http://localhost:8761/actuator/health
# Verify application.yml has correct eureka config
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/# Check PostgreSQL is running
docker ps | grep postgres
# Test connection
psql -h localhost -U admin -d autonova
# Check logs
docker logs <postgres-container-id># Verify RabbitMQ is running
docker ps | grep rabbitmq
# Check RabbitMQ logs
docker logs <rabbitmq-container-id>
# Test connection
curl http://localhost:15672# Verify JWT_SECRET is set correctly in .env
# Ensure secret is at least 256 bits (32 characters)
# Check token hasn't expired (default: 1 hour)# Clean and rebuild
mvn clean install -U
# Skip tests if needed
mvn clean install -DskipTests
# Update dependencies
mvn dependency:resolveEnable debug logging:
# application.yml
logging:
level:
com.autonova: DEBUG
org.springframework.security: DEBUG
org.springframework.cloud: DEBUGOr via environment variable:
LOGGING_LEVEL_COM_AUTONOVA=DEBUG mvn spring-boot:run# Docker Compose logs
docker-compose logs -f gateway-service
docker-compose logs -f auth-service
# Follow all logs
docker-compose logs -f
# Spring Boot application logs
tail -f logs/spring.log- 🏠 Main Project README - Project overview
- 🎨 Frontend README - React application
- 📊 API Contracts - OpenAPI specifications
- 📧 Event Schemas - RabbitMQ event definitions
- Spring Boot Documentation
- Spring Cloud Documentation
- PostgreSQL Documentation
- RabbitMQ Documentation
See main Contributing Guidelines
- Follow Spring Boot best practices
- Write unit tests for all service methods
- Update Swagger documentation for new endpoints
- Use Flyway for database schema changes
- Follow REST API naming conventions
- Implement proper exception handling
- Log at appropriate levels (ERROR, WARN, INFO, DEBUG)
This project is licensed under the MIT License.
Part of the Autonova Platform