How mohitnamdev22/shelfsmart-backend works
Main Components
• REST API Layer (Controllers): Include components like UserController, InventoryController, AlertsController, ReportsController, SupplierController, and UserActivityController.
• Service Layer: Represent business logic with components such as InventoryService, UserService, SupplierService, UserActivityService, GeminiService (for AI suggestions), and InventoryTrendService.
• Data Access Layer: Illustrate the repositories (InventoryRepository, StockMovementRepository, SupplierRepository, UserActivityRepository, UserRepository) that manage database operations.
• Model Layer: Include key entities (InventoryItem, StockMovement, Supplier, User, UserActivity) that define the data models of the application.
• Security Layer: Show security configuration (SecurityConfig) and JWT-related components (JwtFilter, JwtUtil) ensuring the authentication and authorization aspects.
• Database: PostgreSQL (NeonDB) visualized as a separate component receiving data from the repositories.
Relationships and Data Flow
• Services, in turn, interact with the Repositories to perform CRUD operations on the PostgreSQL database.
• Also, indicate that certain service components (e.g., GeminiService) interface with the external Gemini API to get AI-driven suggestions.
• The Security components (SecurityConfig, JwtFilter, JwtUtil) intercept incoming requests to validate JWT tokens before controllers are invoked.
• A configuration block representing properties from application.properties.
Architectural Patterns & Design Principles
• Layered Architecture: Separate presentation (controllers), business logic (services), and persistence (repositories).
• Security Best Practices: Incorporate JWT-based authentication and authorization.
• RESTful API Design: Note the clearly defined endpoints with standardized HTTP methods for resource management.
• External API Integration: Emphasize the decoupling for AI suggestions via a service component that abstracts Gemini API calls.
Relevant Technologies
• Spring Boot (as the primary framework)
• Java 17
• Spring Security & JWT for authentication
• Spring Data JPA for ORM
• PostgreSQL for the database
• Maven for build management
• Gemini API for external integration
• Labels are legible and each component’s role is clear.