How makkenzo/codehorizon-api works
Project Type & Purpose
• The project is a backend REST API designed for an educational platform. Its primary goal is to manage and deliver educational materials such as courses, lessons, assignments, and related content.
• It uses Kotlin with Spring Boot (running on JDK 21) and integrates features like JWT-based security, Swagger API documentation, external service integrations (such as Cloudflare R2 and Stripe), and progress tracking.
Main Architectural Components
a. API Layer (Controllers):
– Include components for various controllers like AuthController, CourseController, PaymentController, ProfileController, etc.
– This layer exposes REST endpoints for client interactions.
b. Service Layer:
– Display services that implement the business logic (e.g., CourseService, UserService, PaymentService, StripeService, EmailService, CloudflareService).
– Show that these services handle application logic and interact with other layers.
c. Data Access Layer:
– Represent repositories such as CourseRepository, UserRepository, ProfileRepository, and others.
– This layer abstracts database interactions and data persistence.
d. Domain Models & DTOs:
e. Security & Configurations:
– Highlight components handling JWT security, CORS configurations, Swagger setup, and authentication (e.g., SecurityConfig, JwtUtils, CookieAuthAspect, CookieConfig, AuthenticationEntryPoint).
f. External Integrations:
• Cloudflare R2 (CloudflareR2Config and CloudflareService)
• Stripe (StripeService, StripeCheckoutSession)
• Email service (EmailService)
g. Additional Layers:
– Include utility classes, aspects (for example, CookieAuthAspect for handling cookie-based auth encryption or verification), and configuration artifacts.
• A flow from Controllers → Service Layer → Repository/Data Access Layer.
• Security “guard” components (e.g., JWT filters, AuthenticationEntryPoint) intercepting requests.
Architectural Patterns & Design Principles
• MVC/Multi-Layered Pattern: Emphasize that the project cleanly separates the concerns of Controllers, Services, and Repositories.
• Configuration Driven: Capture how Spring Boot configuration files and properties (application.properties, application-dev.properties, etc.) provide environment-specific settings.
• Aspect-Oriented Programming: Note the use of aspects (e.g., for managing cookie-based authentication).