How team-moiza/moiza_server works
Project Type and Purpose
• This is clearly a backend server application written in Kotlin with Gradle as the build tool. It appears to be organized around domain-driven design with clearly separated modules for different business concerns (authentication, code management, likes, portfolios, and user management).
• The project leverages a layered architecture (presentation, service, and repository/domain layers) along with global concerns such as error handling, configuration, security, and external API integration (using Feign clients).
Break Down the File Structure into Main Architectural Components
• Application Entry Point:
• At the root of the business logic is the MoizaApplication.kt which bootstraps the Spring Boot application.
• Domain Modules (each in its own subpackage):
• Auth Module: Contains domain entities, repositories, exception handling, controllers, DTOs, and services (e.g., GoogleAuthService, ReissueService). This module also handles external token management (JWT) and integration with Google.
• Code Module: Manages “code” entities (Code, ProjectCode, PortfolioCode) along with corresponding repositories, exceptions, controllers, DTOs, and services.
• Like Module: Manages functionality for handling likes (entities, repositories, exceptions, controllers, DTOs, and services).
• Portfolio Module: Deals with portfolio-related entities (Portfolio, Award, Introduction, etc.), repositories, controllers, DTOs, and services (including creation, update, deletion, and queries).
• User Module: Manages user-related entities including repositories, services, controllers, and presentation DTOs.
• Global/Common Packages:
• Global Config: Configuration files (SecurityConfig, FeignConfig, RedisConfig, QuerydslConfig, etc.) and properties files that set up the environment for the application.
• Global Error Handling: Contains a unified error handling strategy (GlobalExceptionHandler, custom BusinessException and ErrorCode definitions).
• Global Security and JWT: Classes associated with JWT filter, token provider, and principal details for authentication.
• Global Feign Clients: Responsible for communicating with external services like Google (GoogleInformationClient) and Nextcloud (NextcloudShareClient, NextcloudUploadClient) for file sharing/uploads.
• Utility Packages: Utilities for nextcloud functionalities and Thymeleaf template processing (e.g., ProcessTemplateService).
Relationships and Interactions
• Client/API Layer → Controller:
• Clients (web or mobile) send HTTP requests which are routed by Spring controllers (e.g., AuthController, CodeController, LikeController, PortfolioController, UserController). Indicate these as “Presentation Layer” components.
• Controller → Service:
• Once a request is received, controllers delegate to service classes (e.g., GoogleAuthService, CreateCodeService, LikeService, CreatePortfolioService, RegisterProfileService, etc.) which implement the business logic.
• Service → Repository/Domain Layer:
• Services interact with repositories (e.g., UserRepository, CodeRepository, PortfolioRepository, RefreshTokenRepository) to perform data operations.
• External Integrations:
• Some services or global configurations interact with external APIs via Feign (GoogleInformationClient for authentication details and Nextcloud clients for file handling). These should be shown linking to external systems.
• Utility & Configurations:
• Global configurations (SecurityConfig, QuerydslConfig, RedisConfig, etc.) and error handling modules sit alongside these layers to provide cross-cutting concerns.
Important Architectural Patterns and Technologies
• Layered Architecture: Clear separation into presentation (controllers), service (business logic), and persistence (repository/domain) layers.
• Domain-Driven Design: Each feature (auth, code, like, portfolio, user) is self-contained with its own domain entities, business rules, and handling.
• External Integration via Feign: The project uses Feign clients for integrating with services like Google and Nextcloud.
• Security: JWT-based security (filters, token providers, and custom exceptions) are present.
• Config & Error Handling: Global configuration and error management are modular and reusable across layers.
Elements
• Clear labels for each component:
• Annotate:
• Brief notes (e.g., “Handles OAuth token reissue”, “Integrates with external Nextcloud API”) to capture critical functionality and interactions.