How font-king/fontory_be works
Project Type and Purpose
• This is a back-end service for an application named FONTory_BE. Its main purpose is to manage various domains such as authentication (OAuth2 and JWT-based), bookmarks, file operations (with S3 integration), font management, and member as well as provide services.
• The use of Gradle as the build tool, Docker configurations (Dockerfile and docker-compose.yml), and monitoring setups (Prometheus and Grafana configuration files) indicates that the project supports containerized deployments and is production-ready with observability instrumentation.
File Structure
• The src/main/java/org/fontory/fontorybe directory contains multiple modules, each mapped to a domain:
• authentication: handling security, token generation, OAuth2 flows.
• bookmark: managing bookmarks (with controllers, domain exceptions, and service implementations).
• file: integrating with cloud storage (AWS S3) and handling file upload/download.
• font: operations related to fonts (creation, deletion, update, status monitoring etc).
• member: CRUD operations and member management along with error handling.
• provide: likely manages external or internal resource data.
• The layered folder naming (controller, service, domain, infrastructure) clearly follows a typical hexagonal or layered architecture, separating the presentation, business logic, and persistence layers.
• Additional directories for configuration (src/main/java/org/fontory/fontorybe/config) and global filters/interceptors indicate cross-cutting concerns (such as security, logging, performance).
Recommended Components
a. Main Components:
• Client / API Consumers: Representing any external clients (mobile/web) that call the REST endpoints.
• Authentication Service:
• Contains controllers for login, OAuth2 handlers, JWT token management.
• Integrates with external OAuth2 providers.
• Domain Modules:
• Bookmark Module: Controller, service, domain entities (e.g., BookmarkEntity) and repository abstractions.
• File Module: Handling file upload/download requests, error management, and integration with AWS S3 (see S3Config and AmazonS3BucketService).
• Font Module: Manages font data and workflow endpoints (create, update, delete, progress monitoring).
• Member Module: Manages user/member-related actions such as creation, updates, disabling, and validation.
• Provide Module: Deals with resource provisioning, including domain exceptions and repository implementations.
• Common Infrastructure and Configurations:
• Global Exception Handling, Logging Aspects, Security configurations (WebConfig, SecurityConfig), and Health checks.
• Integration with external services (e.g., S3 for file storage, Prometheus for monitoring and Grafana dashboards).
• Database:
• Persistence layer for all modules which interacts via JPA repositories (e.g., BookmarkJpaRepository, FontJpaRepository, MemberJpaRepository, ProvideJpaRepository).
b. Supporting Components:
• CI/CD Pipeline Elements:
• Presence of GitHub Actions (workflows like CICD_DEVELOP.yml, CI_TEST.yml) which are part of the overall DevOps/automation workflow.
• Test Layers:
• Integration, unit, and mock tests are set up to verify the system components.
Relationships and Interactions
• Requests from external clients are received by the REST controllers that reside in each module (authentication, bookmark, file, font, member, provide).
• Cross-cutting concerns like authentication and exception handling are applied at the entry point (e.g., filters such as RequestUUIDFilter and AuthenticationEntryPoint).
• The controllers call the service layer which in turn interact with domain objects and perform business logic.
• The service layer communicates with the persistence layer (infrastructure package) via JPA repositories/other repository abstractions.
• Integration with external systems (AWS S3, monitoring tools like Prometheus and Grafana) is done through dedicated configuration and adapter classes.
Architectural Patterns and Technologies
• Layered (or hexagonal) architecture: Controllers → Services → Domain/Repositories.
• Use of OAuth2 and JWT for security.
• Cloud integration patterns using AWS S3 for file storage.
• Monitoring and logging integration using Prometheus and Grafana.
• Containerization and deployment using Docker and Docker Compose.
• CI/CD setup using GitHub Actions.