# devcyberlearnix-art/cyberlearnixapi architecture

> Architecture diagram of the GitHub repository devcyberlearnix-art/cyberlearnixapi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devcyberlearnix-art/cyberlearnixapi
- Repository: https://github.com/devcyberlearnix-art/cyberlearnixapi

## Overview

#### Purpose and topology
CyberLearnix is a Java/Spring LMS backend organized as independently deployable domain services. Gradle multi-project files (`settings.gradle`, `build.gradle`) coordinate modules; each service has a Spring Boot entry point and Dockerfile. The public edge is `api-gateway/src/main/java/com/swachvega/apigateway/ApiGatewayApplication.java`; local shared infrastructure is defined in `docker/compose.yml` and `docker/init-databases.sql`.

#### Edge gateway, identity, and authorization
The reactive API gateway routes requests, validates JWTs, and manages sessions backed by Redis. Its key request boundary is `api-gateway/src/main/java/com/swachvega/apigateway/filter/JwtAuthenticationFilter.java`, with session APIs in `api-gateway/src/main/java/com/swachvega/apigateway/controller/SessionManagementController.java` and Redis wiring in `api-gateway/src/main/java/com/swachvega/apigateway/config/RedisConfig.java`.

User service is the principal identity lifecycle owner: registration, unified login/refresh/password-reset/OTP flows, OAuth2 success handling, token blacklisting, sessions, audit logs, and instructor applications. Core paths: `user-service/src/main/java/com/user/register/controller/UnifiedAuthenticationController.java`, `user-service/src/main/java/com/user/register/service/UnifiedAuthenticationService.java`, and `user-service/src/main/java/com/user/register/entity/UserSession.java`. Services also contain local JWT filters/configurations; `commonlibs/src/main/java/com/cyberlearnix/security/SharedJwtValidator.java` provides a shared validation implementation.

#### Learning content and instructor operations
Course service owns learner-facing course structure and enrollment records: courses, sections, lectures, previews, and enrollments. Entry APIs are split across `course-service/src/main/java/com/lms/courseservice/controller/CourseController.java`, `course-service/src/main/java/com/lms/courseservice/controller/EnrollmentController.java`, and persistence entities under `course-service/src/main/java/com/lms/courseservice/entity/`.

Instructor service is a separate authoring and instructor-workflow boundary: instructor profiles, course/modules/content/resources, announcements/messages, dashboard and earnings data. It exposes authoring/public-course endpoints through `instructor-service/src/main/java/com/example/instructorservice/controller/CourseController.java` and `instructor-service/src/main/java/com/example/instructorservice/controller/PublicCourseController.java`; it integrates course data through `instructor-service/src/main/java/com/example/instructorservice/integration/CourseIntegrationService.java`. Cloudinary configuration indicates external media/document storage (`instructor-service/src/main/java/com/example/instructorservice/config/CloudinaryConfig.java`).

#### Discovery, cart, and promotions
Wishlist and cart are user-scoped commerce-preparation services. Both call course service through clients: `wishlist-service/src/main/java/com/lms/wishlist_service/client/CourseClient.java` and `cart-service/src/main/java/com/lms/cart_service/client/CourseClient.java`. Cart also calls coupons and handles checkout-oriented summaries in `cart-service/src/main/java/com/lms/cart_service/service/CartServiceImpl.java`.

Coupon service owns campaigns, coupons, usage/redeeming, validation, auto-apply, and referral/bulk operations. Its transactional boundary is represented by `coupon-service/src/main/java/com/lms/coupon_service/entity/CouponUsage.java`; service behavior is in `coupon-service/src/main/java/com/lms/coupon_service/service/CouponServiceImpl.java`. Redis is configured here (`coupon-service/src/main/java/com/lms/coupon_service/config/RedisConfig.java`).

#### Order, payment, and fulfillment flow
The commerce flow is synchronous service-to-service orchestration: order service reads cart and coupon state via Feign clients, persists orders/items/refunds, then payment service creates/verifies payment links/callbacks and handles refunds. Key integration points are `order-service/src/main/java/com/lms/orderservice/client/CartClient.java`, `order-service/src/main/java/com/lms/orderservice/service/OrderService.java`, and `payment-service/src/main/java/com/lms/paymentservice/service/PaymentService.java`.

Payment explicitly integrates PayU via `payment-service/src/main/java/com/lms/paymentservice/service/PayUCommandService.java` and `payment-service/src/main/java/com/lms/paymentservice/service/PayUPaymentLinkService.java`. It calls enrollment through `payment-service/src/main/java/com/lms/paymentservice/client/EnrollmentClient.java`, making successful payment the likely boundary that grants course access.

#### Engagement and moderation
Review service manages submitted reviews, ratings summaries, and administrative moderation. It verifies course/enrollment/user eligibility through Feign clients and fallbacks: `review-service/src/main/java/com/lms/review/service/ReviewService.java`, `review-service/src/main/java/com/lms/review/client/EnrollmentClient.java`, and `review-service/src/main/java/com/lms/review/service/AdminReviewService.java`.

Notification service persists notifications, delivery state, device tokens, templates, and user preferences; it supports course/instructor/admin/reminder workflows and sends push notifications through Firebase. Core paths: `notification-service/src/main/java/com/example/notification/service/FirebasePushService.java`, `notification-service/src/main/java/com/example/notification/entity/DeviceToken.java`, and `notification-service/src/main/java/com/example/notification/service/NotificationService.java`.

#### Administrative control plane
Admin service provides privileged authentication, bootstrap/main-admin setup, permission checks, audits, reports, and cross-service administration. It acts as an aggregation/orchestration layer through REST clients for users, courses, carts, coupons, instructors, notifications, and wishlists: `admin-service/src/main/java/com/example/admin/controller/AdminController.java`, `admin-service/src/main/java/com/example/admin/service/AdminPermissionService.java`, and `admin-service/src/main/java/com/example/admin/client/AdminUserServiceClient.java`. Its own persisted admin/course records and audit service establish a separate administrative authority boundary.

Main entry points: [`course-service/src/main/java/com/lms/courseservice/controller/EnrollmentController.java`](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/course-service/src/main/java/com/lms/courseservice/controller/EnrollmentController.java) (Course & enrollment), [`api-gateway/src/main/java/com/swachvega/apigateway/ApiGatewayApplication.java`](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/api-gateway/src/main/java/com/swachvega/apigateway/ApiGatewayApplication.java) (API Gateway), [`admin-service/src/main/java/com/example/admin/controller/AdminController.java`](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/admin-service/src/main/java/com/example/admin/controller/AdminController.java) (Admin control plane), [`api-gateway/src/main/java/com/swachvega/apigateway/filter/JwtAuthenticationFilter.java`](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/api-gateway/src/main/java/com/swachvega/apigateway/filter/JwtAuthenticationFilter.java) (JWT & sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge &amp; Identity"]
  node_gateway{{"API Gateway<br/>Spring gateway"}}
  node_gateway_jwt["JWT &amp; sessions<br/>gateway filter"]
  node_user_auth["User identity<br/>identity service"]
  node_shared_jwt["Shared JWT validator<br/>security library"]
end

subgraph group_learning["Learning"]
  node_course_api["Course &amp; enrollment<br/>learning service"]
  node_instructor["Instructor authoring<br/>instructor service"]
  node_media_storage[("Cloudinary<br/>external media storage")]
end

subgraph group_commerce["Commerce"]
  node_wishlist["Wishlist<br/>[CourseClient.java]"]
  node_cart["Cart"]
  node_coupon["Coupons<br/>promotion service"]
  node_order["Orders<br/>order service<br/>[OrderService.java]"]
  node_payment["Payments<br/>payment service"]
  node_payu{{"PayU<br/>payment provider"}}
end

subgraph group_engagement["Engagement"]
  node_review["Reviews &amp; moderation<br/>review service<br/>[ReviewService.java]"]
  node_notification["Notifications<br/>notification service"]
  node_firebase{{"Firebase push<br/>push provider"}}
end

subgraph group_admin["Admin"]
  node_admin["Admin control plane<br/>admin service"]
end

node_local_infra[("Local shared infrastructure<br/>Docker Compose<br/>[compose.yml]")]

node_gateway -->|"filters requests"| node_gateway_jwt
node_gateway_jwt -->|"identity/session flows"| node_user_auth
node_gateway_jwt -->|"validates with"| node_shared_jwt
node_gateway -->|"routes learner APIs"| node_course_api
node_gateway -->|"routes authoring APIs"| node_instructor
node_gateway -->|"routes commerce APIs"| node_cart
node_gateway -->|"routes checkout APIs"| node_order
node_instructor -->|"integrates course data"| node_course_api
node_instructor -->|"stores media"| node_media_storage
node_wishlist -->|"course lookup"| node_course_api
node_cart -->|"course lookup"| node_course_api
node_cart -->|"applies coupons"| node_coupon
node_order -->|"reads cart"| node_cart
node_order -->|"reads coupon state"| node_coupon
node_order -->|"initiates payment"| node_payment
node_payment -->|"payment links &amp; callbacks"| node_payu
node_payment -->|"grants enrollment"| node_course_api
node_review -->|"verifies enrollment"| node_course_api
node_notification -->|"sends push"| node_firebase
node_admin -->|"administers users"| node_user_auth
node_admin -->|"administers courses"| node_course_api
node_admin -->|"administers promotions"| node_coupon
node_admin -->|"administers notifications"| node_notification
node_gateway_jwt -.->|"Redis sessions"| node_local_infra
node_coupon -.->|"Redis cache"| node_local_infra

click node_gateway "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/api-gateway/src/main/java/com/swachvega/apigateway/ApiGatewayApplication.java"
click node_gateway_jwt "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/api-gateway/src/main/java/com/swachvega/apigateway/filter/JwtAuthenticationFilter.java"
click node_user_auth "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/user-service/src/main/java/com/user/register/service/UnifiedAuthenticationService.java"
click node_shared_jwt "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/commonlibs/src/main/java/com/cyberlearnix/security/SharedJwtValidator.java"
click node_course_api "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/course-service/src/main/java/com/lms/courseservice/controller/EnrollmentController.java"
click node_instructor "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/instructor-service/src/main/java/com/example/instructorservice/controller/CourseController.java"
click node_media_storage "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/instructor-service/src/main/java/com/example/instructorservice/config/CloudinaryConfig.java"
click node_wishlist "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/wishlist-service/src/main/java/com/lms/wishlist_service/client/CourseClient.java"
click node_cart "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/cart-service/src/main/java/com/lms/cart_service/service/CartServiceImpl.java"
click node_coupon "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/coupon-service/src/main/java/com/lms/coupon_service/service/CouponServiceImpl.java"
click node_order "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/order-service/src/main/java/com/lms/orderservice/service/OrderService.java"
click node_payment "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/payment-service/src/main/java/com/lms/paymentservice/service/PaymentService.java"
click node_payu "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/payment-service/src/main/java/com/lms/paymentservice/service/PayUCommandService.java"
click node_review "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/review-service/src/main/java/com/lms/review/service/ReviewService.java"
click node_notification "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/notification-service/src/main/java/com/example/notification/service/NotificationService.java"
click node_firebase "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/notification-service/src/main/java/com/example/notification/service/FirebasePushService.java"
click node_admin "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/admin-service/src/main/java/com/example/admin/controller/AdminController.java"
click node_local_infra "https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/docker/compose.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gateway,node_gateway_jwt,node_user_auth,node_shared_jwt toneBlue
class node_course_api,node_instructor,node_media_storage toneAmber
class node_wishlist,node_cart,node_coupon,node_order,node_payment,node_payu toneMint
class node_review,node_notification,node_firebase toneRose
class node_admin toneIndigo
class node_local_infra toneNeutral
```

## Components

### Edge & Identity

- [API Gateway](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/api-gateway/src/main/java/com/swachvega/apigateway/ApiGatewayApplication.java): Spring gateway · Public reactive request edge. · `api-gateway/src/main/java/com/swachvega/apigateway/ApiGatewayApplication.java`
- [JWT & sessions](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/api-gateway/src/main/java/com/swachvega/apigateway/filter/JwtAuthenticationFilter.java): gateway filter · Validates JWTs and manages Redis-backed sessions. · `api-gateway/src/main/java/com/swachvega/apigateway/filter/JwtAuthenticationFilter.java`
- [User identity](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/user-service/src/main/java/com/user/register/service/UnifiedAuthenticationService.java): identity service · Owns registration, login, tokens, sessions, and account recovery. · `user-service/src/main/java/com/user/register/service/UnifiedAuthenticationService.java`
- [Shared JWT validator](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/commonlibs/src/main/java/com/cyberlearnix/security/SharedJwtValidator.java): security library · `commonlibs/src/main/java/com/cyberlearnix/security/SharedJwtValidator.java`

### Learning

- [Course & enrollment](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/course-service/src/main/java/com/lms/courseservice/controller/EnrollmentController.java): learning service · Owns learner course structure and enrollment records. · `course-service/src/main/java/com/lms/courseservice/controller/EnrollmentController.java`
- [Instructor authoring](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/instructor-service/src/main/java/com/example/instructorservice/controller/CourseController.java): instructor service · Owns instructor workflows and authored course content. · `instructor-service/src/main/java/com/example/instructorservice/controller/CourseController.java`
- [Cloudinary](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/instructor-service/src/main/java/com/example/instructorservice/config/CloudinaryConfig.java): external media storage · Stores instructor media and documents. · `instructor-service/src/main/java/com/example/instructorservice/config/CloudinaryConfig.java`

### Commerce

- [Wishlist](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/wishlist-service/src/main/java/com/lms/wishlist_service/client/CourseClient.java): wishlist service · `wishlist-service/src/main/java/com/lms/wishlist_service/client/CourseClient.java`
- [Cart](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/cart-service/src/main/java/com/lms/cart_service/service/CartServiceImpl.java): cart service · Builds checkout-oriented user cart summaries. · `cart-service/src/main/java/com/lms/cart_service/service/CartServiceImpl.java`
- [Coupons](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/coupon-service/src/main/java/com/lms/coupon_service/service/CouponServiceImpl.java): promotion service · Owns campaigns, validation, redemption, and usage. · `coupon-service/src/main/java/com/lms/coupon_service/service/CouponServiceImpl.java`
- [Orders](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/order-service/src/main/java/com/lms/orderservice/service/OrderService.java): order service · Orchestrates cart and coupon state into orders, items, and refunds. · `order-service/src/main/java/com/lms/orderservice/service/OrderService.java`
- [Payments](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/payment-service/src/main/java/com/lms/paymentservice/service/PaymentService.java): payment service · Creates, verifies, and refunds payments; grants enrollment after success. · `payment-service/src/main/java/com/lms/paymentservice/service/PaymentService.java`
- [PayU](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/payment-service/src/main/java/com/lms/paymentservice/service/PayUCommandService.java): payment provider · `payment-service/src/main/java/com/lms/paymentservice/service/PayUCommandService.java`

### Engagement

- [Reviews & moderation](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/review-service/src/main/java/com/lms/review/service/ReviewService.java): review service · Checks enrollment eligibility and moderates ratings. · `review-service/src/main/java/com/lms/review/service/ReviewService.java`
- [Notifications](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/notification-service/src/main/java/com/example/notification/service/NotificationService.java): notification service · Persists delivery state and notification preferences. · `notification-service/src/main/java/com/example/notification/service/NotificationService.java`
- [Firebase push](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/notification-service/src/main/java/com/example/notification/service/FirebasePushService.java): push provider · `notification-service/src/main/java/com/example/notification/service/FirebasePushService.java`

### Admin

- [Admin control plane](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/admin-service/src/main/java/com/example/admin/controller/AdminController.java): admin service · Provides privileged administration, permissions, audits, and reports. · `admin-service/src/main/java/com/example/admin/controller/AdminController.java`

### Other components

- [Local shared infrastructure](https://github.com/devcyberlearnix-art/cyberlearnixapi/blob/main/docker/compose.yml): Docker Compose · Defines local shared services and database initialization. · `docker/compose.yml`

## Connections

- API Gateway → JWT & sessions: filters requests
- JWT & sessions → User identity: identity/session flows
- JWT & sessions → Shared JWT validator: validates with
- API Gateway → Course & enrollment: routes learner APIs
- API Gateway → Instructor authoring: routes authoring APIs
- API Gateway → Cart: routes commerce APIs
- API Gateway → Orders: routes checkout APIs
- Instructor authoring → Course & enrollment: integrates course data
- Instructor authoring → Cloudinary: stores media
- Wishlist → Course & enrollment: course lookup
- Cart → Course & enrollment: course lookup
- Cart → Coupons: applies coupons
- Orders → Cart: reads cart
- Orders → Coupons: reads coupon state
- Orders → Payments: initiates payment
- Payments → PayU: payment links & callbacks
- Payments → Course & enrollment: grants enrollment
- Reviews & moderation → Course & enrollment: verifies enrollment
- Notifications → Firebase push: sends push
- Admin control plane → User identity: administers users
- Admin control plane → Course & enrollment: administers courses
- Admin control plane → Coupons: administers promotions
- Admin control plane → Notifications: administers notifications
- JWT & sessions → Local shared infrastructure: Redis sessions
- Coupons → Local shared infrastructure: Redis cache
