How hemanthjinnala7/travtronics-assignment works
Project Type and Purpose
• This is a standalone Spring Boot microservice providing RESTful APIs for product and user management.
• It uses an embedded Tomcat server to expose HTTP endpoints and an in-memory H2 database for persistence.
a. Client Layer
• Any HTTP client (Postman, front-end app, CLI) that calls the REST API on port 9090.
b. API Layer (Controllers)
• ProductController – exposes /api/getAllProducts, /api/getProductById/{id}, /api/admin/addProduct, etc.
• UserController – exposes /api/user/register, /api/user/addItemToCartById, /api/user/Orderitem, etc.
c. Domain Layer (Models)
• ProductModel – JPA entity defining id, name, price, type, gender
• UserModel – JPA entity defining id, username, password, cart, orders
d. Data Access Layer (Repositories)
• ProductRepository – extends JpaRepository<ProductModel, Long>
• UserRepository – extends JpaRepository<UserModel, Long>
e. Persistence (Database)
• H2 in-memory database (configured in application.properties)
f. Infrastructure
• Embedded Tomcat (via Spring Boot)
• Maven build lifecycle (pom.xml, mvnw scripts)
• Configuration – src/main/resources/application.properties
Relationships & Data Flow
• Client → Controllers (HTTP request/response)
• Controllers → Repositories (via Spring Data JPA calls)
• Repositories ↔ H2 database (SQL read/write)
• Application.properties configures port 9090 and H2 console (optional)
• Controllers and Repositories both depend on Domain Models
Architectural Patterns & Design Principles
• Layered architecture (HTTP → Controller → Repository → DB)
• Convention-over-configuration (Spring Boot auto-configuration)
• Dependency injection (controllers auto-wire repositories)
• In-memory database for rapid development/testing