How seeongh/ttsengine works
Main Components
• Frontend / Web Presentation Layer:
• Represented by the controllers under the "src/main/java/com/kosaf/core/web" directory (e.g., for bbs, code, frequencyPhrases, log, member, menu, monitoring, replaceKeyword, ttsDemo).
• Indicates how web pages (HTML, CSS, JavaScript, JQuery code) interact with backend endpoints.
• API / Backend REST Layer:
• Components under "src/main/java/com/kosaf/core/api" (e.g., the different domain APIs such as TTS Demo, ReplaceKeyword, Log, Member, etc.) expose REST controllers (presentation sub-packages) for various functionalities.
• Application & Business Logic Layer:
• Located in subpackages called "application" under each module (for example, ttsDemo/application, frequencyPhrases/application, etc.). This layer contains services (e.g., RequestTTSRestService, FrequencyPhrasesService) that encapsulate business logic.
• Domain Layer:
• Contains entity definitions and domain objects (e.g., User, Author, Bbs, CodeDetail, ReplaceKw) that represent the core business data.
• Infrastructure / Persistence Layer:
• Consists of Mappers and repositories, found in "infrastructure" subpackages and mybatis XML configurations under "src/main/resources/mybatis". This is where the project interacts with databases such as ORACLE and POSTGRESQL.
• Batch Processing Component:
• Under "src/main/java/com/kosaf/core/batch", the batch jobs (e.g., SyncJob, SyncSchedular) use Spring Batch to synchronize data between the TTS engine server and the WAS DB.
• Cross-Cutting Concerns & Configurations:
• Security configurations (Spring Security, interceptors, authentication/authorization handlers).
• Exception handling (CustomException handling via CustomException classes and ResponseExceptionHandler).
• Logging (custom logging aspects under config/logging and dedicated controllers for log modules).
• WebClient configuration for external API communication.
• Tiles configuration for view templating.
Relationships and Interactions
• Users interact either via the browser (web controllers) or through mobile/desktop client calls to REST endpoints.
• The Web Presentation Layer and API REST Controllers serve as entry points, routing requests to corresponding application services.
• Application services coordinate with the Domain Layer (entities and business rules) and then interact with the Infrastructure layer (using mappers and repositories) for data persistence.
• Batch jobs run independently to sync data between the TTS engine server and the application's databases.
• Security, interceptors (e.g., AuthInterceptor, UserAuthInterceptor, WebLogInterceptor), and exception handlers are applied across multiple layers to enforce authentication, logging, and error handling.
• Outbound calls via WebClient allow the application to interact with external services (e.g., possibly calling the TTS engine API or other external systems).
Architectural Patterns and Design Principles
• Layered Architecture (Presentation → Application → Domain → Infrastructure).
• Domain-Driven Design (clear separation between domain, application, and infrastructure components).
• MVC Pattern within the web component (separation of controllers, views, and models).
• Use of interceptors for cross-cutting concerns (security, logging).
• Batch processing using Spring Batch for asynchronous synchronization.
• External API integration managed via WebClient.
Relevant Technologies and Frameworks
• Spring Boot, Spring Batch, Spring Security.
• Java as the primary language.
• Oracle and PostgreSQL for databases.
• MyBatis with XML mapping.
• Frontend tools: HTML, CSS, JavaScript, JQuery.
• Tiles for view templating.