How subhash307/springboot-bitsandbytes works
Main Components
a. Client & API Layer
• External Clients (Postman, Swagger UI, Web Frontend)
• HTTP Endpoints (REST controllers: ProductController, CategoryController, UserController, CustomEndpoint)
b. Security Layer
• JwtRequestFilter (intercepts requests)
• SecurityConfig (configures HTTP security rules)
• JwtUtil + UserPrincipal + MyUserDetailsService (handles token creation & validation)
c. Service Layer
• ProductService, CategoryService, MyUserDetailsService
d. Data Access Layer
• Repositories (ProductRepository, CategoryRepository, UserRepository)
• Entities (Product, Category, User)
• Mappers (ProductMapper, CategoryMapper)
e. Persistence
• MySQL Database
f. Cross-Cutting Concerns
• DTOs (ProductDTO, CategoryDTO, UserDTO, ExceptionResponseDTO)
• GlobalExceptionHandler
• Logging (logback-spring.xml)
• Configuration (application.properties)
Relationships & Data Flow
1. Client → HTTP Request → Controllers
2. Controllers → call Services → (DTOs ↔ Entities mapped by Mappers)
3. Services → Repositories → Database
4. Repositories → return Entities → Services → Controllers → Response DTO
5. JwtRequestFilter intercepts incoming requests before Controllers; JwtUtil & UserPrincipal validate tokens against MyUserDetailsService.
6. GlobalExceptionHandler catches and formats exceptions into ExceptionResponseDTO.
Architectural Patterns
• Layered Architecture (Controller → Service → Repository → DB)
• DTO Pattern (separate data transfer objects vs. persistence entities)
• Spring Security Filter Chain (JWT authentication)
• Spring Data JPA (repository abstractions)
• All components (controllers, services, repos, entities, DTOs, mappers, security classes) clearly labeled
• External dependencies (MySQL, Swagger, Postman) shown as separate nodes
• Cross-cutting elements (GlobalExceptionHandler, logging config) noted on the side