# saidshi4/texnoera-crm architecture

> Architecture diagram of the GitHub repository saidshi4/texnoera-crm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saidshi4/texnoera-crm
- Repository: https://github.com/saidshi4/texnoera-crm

## Overview

##### Project Type and Purpose
- It’s a monolithic, full-stack (backend-only) CRM service for course/institution management.
- Purpose: manage customers, courses, groups, payments, tasks, attendance, and send notifications.

##### File Structure and README
- Top-level build files (build.gradle, settings.gradle, gradle wrapper) indicate a Java/Gradle Spring Boot project.
- src/main/java/com/example/texnoeracrm contains:
– config (security, CORS, JWT filter, Swagger)
– controller (REST endpoints)
– service (business logic, including auth, scheduling)
– dao/entity & repository (JPA entities + Spring Data)
– mapper (entity ↔ DTO)
– model (DTOs for “get” and “set”)
– scheduler (cron jobs for attendance, tasks, notifications)
- External integrations: PostgreSQL (liquibase migrations) and Firebase (push notifications).
- Authentication: JWT via JwtAuthenticationFilter and SecurityConfiguration.
- DataLoader seeds initial data on startup.

##### Main Components
1. Clients
– Web or mobile front end or any HTTP client calling the REST API
2. API Layer (Spring Boot)
a. Security Layer
- JWTAuthenticationFilter
- AuthorizationInterceptor
- SecurityConfiguration
b. Web Layer (Controllers)
- AuthController
- UserController, GroupController, TaskController, etc.
c. Service Layer
- AuthService, JwtService
- UserService, GroupService, TaskService, AttendanceService, NotificationService, CommentService, UserTaskService
- SchedulerServices (AttendanceSchedulerService, TaskSchedulerService, NotificationSchedulerService)
d. Data Layer
- DAOs / Repositories (Spring Data JPA)
- Entities (UserEntity, TaskEntity, GroupEntity, etc.)
- Mappers (convert Entities ↔ DTOs)
3. Database
– PostgreSQL (liquibase drives schema migrations)
4. External System
– Firebase Cloud Messaging (via FirebaseMessagingService)

##### Relationships and Data Flow
- Client → HTTP Request → JWT Filter → Controller
- Controller delegates to appropriate Service
- Service uses Mappers + Repositories to read/write Entities in PostgreSQL
- SchedulerServices trigger on cron schedules → Service methods → DB or FCM
- NotificationService → FirebaseMessagingService → FCM
- DataLoader (on startup) → seeds DB

##### Architectural Patterns & Design Principles
- Layered architecture (Controller → Service → Repository)
- DTO pattern (separate model/get vs. model/set)
- Dependency injection (Spring Boot)
- JWT stateless authentication
- Externalized configuration (application.yml + Firebase JSON)
- Schema versioning via Liquibase
- Separation of concerns: config, auth, mapping, scheduling

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Client
    Client["Client (Web/Mobile)"]:::external

    %% Security Layer
    subgraph "Security Layer"
        direction TB
        JWTFilter["JwtAuthenticationFilter"]:::security
        AuthInterceptor["AuthorizationInterceptor"]:::security
        SecurityConfig["SecurityConfiguration"]:::security
    end

    %% Controllers Layer
    subgraph "Controllers"
        direction TB
        AuthController["AuthController"]:::controller
        UserController["UserController"]:::controller
        GroupController["GroupController"]:::controller
        TaskController["TaskController"]:::controller
        AttendanceController["AttendanceController"]:::controller
        NotificationController["NotificationController"]:::controller
        CommentController["CommentController"]:::controller
        UserTaskController["UserTaskController"]:::controller
        ErrorHandler["ErrorHandler"]:::controller
    end

    %% Services Layer
    subgraph "Service Layer"
        direction TB
        AuthService["AuthService"]:::service
        JwtService["JwtService"]:::service
        UserService["UserService"]:::service
        GroupService["GroupService"]:::service
        TaskService["TaskService"]:::service
        AttendanceService["AttendanceService"]:::service
        NotificationService["NotificationService"]:::service
        CommentService["CommentService"]:::service
        UserTaskService["UserTaskService"]:::service
        FirebaseMessagingService["FirebaseMessagingService"]:::service
    end

    %% Scheduler Layer
    subgraph "Schedulers"
        direction TB
        AttendanceSchedulerService["AttendanceSchedulerService"]:::scheduler
        TaskSchedulerService["TaskSchedulerService"]:::scheduler
        NotificationSchedulerService["NotificationSchedulerService"]:::scheduler
    end

    %% Data Access Layer
    subgraph "Data Access"
        direction TB
        Entities["Entities"]:::data
        Repositories["Repositories"]:::data
        Mappers["Mappers"]:::data
    end

    %% Configuration
    subgraph "Configuration"
        direction TB
        ApplicationConfig["ApplicationConfig"]:::config
        CorsConfig["CorsConfig"]:::config
        FirebaseConfig["FirebaseConfig"]:::config
        SwaggerConfig["SwaggerConfig"]:::config
        WebConfig["WebConfig"]:::config
        DataLoader["DataLoader"]:::config
    end

    %% Database and External
    PostgreSQL["PostgreSQL\n(Liquibase)"]:::db
    FCM["Firebase Cloud Messaging"]:::fcm

    %% Data Flows
    Client --> JWTFilter
    JWTFilter --> AuthController
    JWTFilter --> UserController
    JWTFilter --> GroupController
    JWTFilter --> TaskController
    JWTFilter --> AttendanceController
    JWTFilter --> NotificationController
    JWTFilter --> CommentController
    JWTFilter --> UserTaskController

    AuthController --> AuthService
    AuthService --> JwtService

    UserController --> UserService
    GroupController --> GroupService
    TaskController --> TaskService
    AttendanceController --> AttendanceService
    NotificationController --> NotificationService
    CommentController --> CommentService
    UserTaskController --> UserTaskService

    %% Services to Data Access
    AuthService --> Mappers
    JwtService --> Repositories
    UserService --> Repositories
    GroupService --> Repositories
    TaskService --> Repositories
    AttendanceService --> Repositories
    NotificationService --> Repositories
    CommentService --> Repositories
    UserTaskService --> Repositories

    Mappers --> Entities
    Repositories --> Entities
    Entities --> PostgreSQL

    %% Scheduler flows
    AttendanceSchedulerService --> AttendanceService
    TaskSchedulerService --> TaskService
    NotificationSchedulerService --> NotificationService

    NotificationService --> FirebaseMessagingService
    FirebaseMessagingService --> FCM

    DataLoader --> Entities
    DataLoader --> PostgreSQL

    %% Click events
    click JWTFilter "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/JwtAuthenticationFilter.java"
    click AuthInterceptor "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/interceptor/AuthorizationInterceptor.java"
    click SecurityConfig "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/SecurityConfiguration.java"

    click AuthController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/auth/AuthController.java"
    click UserController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/UserController.java"
    click GroupController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/GroupController.java"
    click TaskController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/TaskController.java"
    click AttendanceController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/AttendanceController.java"
    click NotificationController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/NotificationController.java"
    click CommentController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/CommentController.java"
    click UserTaskController "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/UserTaskController.java"
    click ErrorHandler "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/controller/ErrorHandler.java"

    click AuthService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/auth/AuthService.java"
    click JwtService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/auth/JwtService.java"
    click UserService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/UserService.java"
    click GroupService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/GroupService.java"
    click TaskService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/TaskService.java"
    click AttendanceService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/AttendanceService.java"
    click NotificationService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/NotificationService.java"
    click CommentService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/CommentService.java"
    click UserTaskService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/UserTaskService.java"
    click FirebaseMessagingService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/service/FirebaseMessagingService.java"

    click AttendanceSchedulerService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/scheduler/AttendanceSchedulerService.java"
    click TaskSchedulerService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/scheduler/TaskSchedulerService.java"
    click NotificationSchedulerService "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/scheduler/NotificationSchedulerService.java"

    click Entities "https://github.com/saidshi4/texnoera-crm/tree/master/src/main/java/com/example/texnoeracrm/dao/entity"
    click Repositories "https://github.com/saidshi4/texnoera-crm/tree/master/src/main/java/com/example/texnoeracrm/dao/repository"
    click Mappers "https://github.com/saidshi4/texnoera-crm/tree/master/src/main/java/com/example/texnoeracrm/mapper"

    click ApplicationConfig "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/ApplicationConfig.java"
    click CorsConfig "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/CorsConfig.java"
    click FirebaseConfig "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/FirebaseConfig.java"
    click SwaggerConfig "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/SwaggerConfig.java"
    click WebConfig "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/WebConfig.java"
    click DataLoader "https://github.com/saidshi4/texnoera-crm/blob/master/src/main/java/com/example/texnoeracrm/config/DataLoader.java"

    classDef external fill:#f2f2f2,stroke:#333,stroke-width:1px
    classDef security fill:#bbdefb,stroke:#1e88e5,stroke-width:1px
    classDef controller fill:#c8e6c9,stroke:#2e7d32,stroke-width:1px
    classDef service fill:#dcedc8,stroke:#558b2f,stroke-width:1px
    classDef scheduler fill:#dcedc8,stroke:#558b2f,stroke-width:1px
    classDef data fill:#fff9c4,stroke:#f9a825,stroke-width:1px
    classDef config fill:#e1bee7,stroke:#8e24aa,stroke-width:1px
    classDef db fill:#ffcc80,stroke:#ef6c00,stroke-width:1px
    classDef fcm fill:#e1bee7,stroke:#6a1b9a,stroke-width:1px
```
