Project Type: Backend REST API (Spring Boot + JPA)
You will extend and complete an existing backend project for a Subscription Management Platform.
The system allows service providers to offer subscription plans, while customers can browse plans and manage their
subscriptions.
Your implementation must follow the functional and technical requirements described below.
You are building a backend for a subscription management platform used by multiple service providers (operators).
Operators offer subscription plans in two categories:
- Fiber 50
- Fiber 100
- Fiber 300
- Mobile Basic
- Mobile Plus
- Mobile Unlimited
Each operator maintains its own catalog of plans.
Each plan contains:
- Name
- Price
- Service type (Internet or Mobile)
- Optional data limit
- Active/Inactive status
Customers can:
- Register and manage their profile
- Browse operators and active plans
- Subscribe to plans
- Change plans
- Cancel subscriptions
-
A customer may have at most one active subscription per service type:
- One Internet subscription
- One Mobile subscription
-
A subscription is created with status ACTIVE
-
Cancelled subscriptions must store a cancellation date
-
Only active plans are visible and subscribable
-
Plan changes are allowed only within the same operator and same service type
Violations of these rules must result in meaningful custom exceptions.
| Actor | Responsibilities |
|---|---|
| Admin | Create and manage operators and plans |
| Customer | Browse plans and manage own subscriptions |
erDiagram
CUSTOMER ||--o{ SUBSCRIPTION: has
PLAN ||--o{ SUBSCRIPTION: used_by
OPERATOR ||--o{ PLAN: offers
CUSTOMER ||--|| CUSTOMER_DETAIL: has
- Define JPA relationships and ownership
- Add required fields to
PlanandSubscription - Use enums where applicable (service type, subscription status)
- Enable auditing (
createdAt,updatedAt) - Add constraints (unique, not null, length, etc.)
- Implement services for all domain operations
- Use
@Transactionalon write operations - Enforce business rules inside services
- Throw custom exceptions for invalid operations
- Use DTOs (records recommended)
- Do not expose entities in controllers
- Use validation annotations (
@NotNull,@NotBlank, etc.) - Convert between Entity and DTO using MapStruct or manual mappers
- Controllers for Plan and Subscription
- Role-based access:
- ADMIN → manage operators & plans
- CUSTOMER → manage own subscriptions
- Return correct HTTP status codes
- Global exception handling
- (Optional) Swagger annotations
Expose endpoints that support the following operations.
ADMIN must be able to:
- Create a plan
- Update a plan
- Delete a plan
- View all plans (active and inactive)
CUSTOMER must be able to:
- View all active plans
- View active plans by service type (Internet / Mobile)
- View plans belonging to a specific operator
CUSTOMER must be able to:
- Subscribe to a plan
- View their own subscriptions
- Change subscription plan
- Cancel subscription
The API must enforce the business rules defined in this document (for example: one active subscription per service type).
Initialize:
- At least 2 operators
- Multiple plans per operator
- Both active and inactive plans
- Unit tests for repositories
- Unit tests for services
- Controller tests
- GitHub repository link
pom.xmlcontains required dependencies- Entities and relationships implemented
- Services, transactions, and exceptions
- DTOs and validation
- Swagger UI accessible
- README with run instructions
- Seed data included
- Java 25
- Spring Boot 4.x
- Spring Data JPA (Hibernate)
- Spring Security (JWT Authentication)
- MySQL 8.0 (Database)
- Redis (Token Blacklisting)
- MapStruct (Object Mapping)
- Lombok (Boilerplate reduction)
- Swagger/OpenAPI 3 (API Documentation)
- Maven (Build Tool)
- Docker & Docker Compose (Infrastructure)
Before running the application, ensure you have the following installed:
The project uses Docker Compose to manage the MySQL database and Redis server.
Run the following command in the project root:
docker-compose up -d- MySQL: Port
3307 - Redis: Port
6379
Navigate to the subscription-api directory and run:
mvn spring-boot:runOnce the app is running, access the Swagger UI at:
http://localhost:8080/swagger-ui.html