Microservices-based Backend for On-Demand Roadside Assistance & Fuel Delivery Platform
PitStop Backend is a Java Spring Boot microservices architecture designed to power the PitStop mobile app β a futuristic platform offering real-time roadside assistance, fuel delivery, emergency help, BNPL (Buy-Now-Pay-Later) payments, and intelligent analytics.
Each microservice is modular, independently deployable, and communicates securely through REST and Feign clients via an API Gateway. The backend ensures scalability, fault tolerance, and high availability using the Spring Cloud Netflix Stack.
- π§© Microservices Architecture
- Fully decoupled domain-based services (User, Order, Payment, BNPL, etc.)
- π° Spring Cloud Integration
- Eureka Discovery Server
- Config Server
- API Gateway (Routing + Load Balancing)
- π§Ύ RESTful API Design
- Clean controller-service-repo structure with DTOs
- Unified JSON responses and exception handling
- π Secure Authentication
- JWT-based user authentication and role-based authorization
- β‘ Asynchronous Communication
- Feign clients for inter-service calls
- RabbitMQ or internal REST integration (optional)
- π Analytics & Monitoring
- Analytics service for logs, metrics, and usage tracking
- π§ BNPL Integration
- Split payments and deferred payment logic for fuel or services
- π¨ Notification Service
- Email/SMS/Push event triggers for orders and emergencies
- π§° Swagger Documentation
- Auto-generated API docs per service at
/swagger-ui.html
- Auto-generated API docs per service at
pitstop-backend/
β
βββ config-server/ # Centralized config management
β βββ src/main/resources/
β βββ application.yml
β
βββ discovery-server/ # Eureka service registry
β βββ src/main/resources/
β βββ application.yml
β
βββ api-gateway/ # API routing and authentication entrypoint
β βββ src/main/resources/
β βββ application.yml
β
βββ common-lib/ # Shared DTOs and utility classes
β βββ src/main/java/com/pitstop/common/
β
βββ user-service/ # Handles user accounts, profiles, JWT
β βββ controller/
β βββ service/
β βββ repository/
β βββ entity/
β βββ dto/
β βββ application.yml
β
βββ order-service/ # Manages fuel orders, requests, tracking
β βββ controller/
β βββ service/
β βββ repository/
β βββ feign/
β βββ entity/
β βββ dto/
β βββ application.yml
β
βββ payment-service/ # Handles transactions, BNPL, gateways
βββ bnpl-service/ # Deferred billing logic
βββ mechanic-service/ # Mechanic and service provider registry
βββ emergency-service/ # Emergency call and dispatch
βββ notification-service/ # Notification management
βββ analytics-service/ # Data logs, metrics, usage analytics
β
βββ pom.xml # Parent Maven config
βββ README.md
| Layer | Technology | Description |
|---|---|---|
| Language | Java 8 | Modern, type-safe JVM language |
| Framework | Spring Boot 2.7.x | Microservice foundation |
| Cloud Tools | Spring Cloud Netflix | Eureka, Gateway, Config |
| Build Tool | Maven 3.9.x | Multi-module dependency management |
| Security | Spring Security + JWT | Authentication & Authorization |
| Database | MySQL 8 | Persistent data store |
| API Docs | Swagger / OpenAPI | Auto API documentation |
| Testing | JUnit 5 + Mockito | Unit and integration tests |
| CI/CD | GitHub Actions / Docker | Automated build & deploy |
| Monitoring | Spring Actuator | Service health endpoints |
| Service | Port | Description |
|---|---|---|
| Config Server | 8888 | Central configuration management |
| Discovery Server (Eureka) | 8761 | Service registry |
| API Gateway | 8080 | Unified routing and authentication layer |
| User Service | 8081 | Manages user authentication and profiles |
| Order Service | 8082 | Handles orders, requests, and tracking |
| Payment Service | 8083 | Processes transactions |
| BNPL Service | 8084 | Manages deferred payments |
| Mechanic Service | 8085 | Mechanic and workshop data |
| Emergency Service | 8086 | Emergency dispatch and assistance |
| Notification Service | 8087 | Email/SMS/push notifications |
| Analytics Service | 8088 | Logging and analytics |
Holds all shared configurations in one repository:
spring:
cloud:
config:
server:
git:
uri: https://github.com/srivilliamsai/pitstop-config-repoEach service connects to it:
spring:
config:
import: optional:configserver:http://localhost:8888- Login β Generates a JWT token
- Token β Attached to all service requests via headers
- Gateway validates token β routes request only if valid
- Role-based authorization for admin, mechanic, and user
Example Header:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6...
Services communicate using OpenFeign Clients:
@FeignClient(name = "payment-service")
public interface PaymentClient {
@PostMapping("/payments/process")
PaymentResponse processPayment(@RequestBody PaymentRequest request);
}Each service includes:
- β Unit tests with JUnit 5
- π Mocked dependencies using Mockito
- π Code coverage with JaCoCo
Example:
src/test/java/com/pitstop/user/service/UserServiceTest.java
Available per service at:
http://localhost:<port>/swagger-ui.html
Example:
- User Service β
http://localhost:8081/swagger-ui.html - Order Service β
http://localhost:8082/swagger-ui.html
mvn clean install -DskipTests(In separate terminals)
cd config-server
mvn spring-boot:runcd ../discovery-server
mvn spring-boot:run(In separate terminals)
cd ../api-gateway
mvn spring-boot:run# Start other services
mvn spring-boot:run -pl user-service
mvn spring-boot:run -pl order-service
mvn spring-boot:run -pl payment-service
# ... and so on for all other servicesPOST /orders/create
Request:
{
"userId": "U001",
"serviceType": "Fuel Delivery",
"location": "Anna Salai, Chennai",
"paymentMode": "BNPL"
}Response:
{
"orderId": "O12345",
"status": "CONFIRMED",
"eta": "15 mins"
}Each service has a Dockerfile:
docker build -t pitstop-user-service .
docker run -p 8081:8081 pitstop-user-service- Oracle Cloud Infrastructure / AWS ECS / Render
- Use
docker-compose.ymlor Kubernetes YAML for orchestration
- π Service Mesh (Istio / Linkerd)
- π Centralized ELK logging stack
- π OAuth2 + Refresh Token flow
- π§ AI-driven emergency prediction model integration
- π Integration with vehicle telematics APIs
Sri Villiam Sai Ayyappan B.Tech (Information Technology) | SRM Valliammai Engineering College
π Chennai, India
π LinkedIn
π GitHub
This project is licensed under the MIT License β see the LICENSE file for details.
βPowering safer journeys through intelligent service architecture β PitStop Backend.β βοΈ