# kw-classlog/classlog architecture

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

- Interactive diagram: https://gitdiagram.com/kw-classlog/classlog
- Repository: https://github.com/kw-classlog/classlog

## Overview

##### Project type and purpose
- This is a full-stack, data-driven online lecture management platform.
- Front-end: Next.js/React PWA handling student/teacher UIs.
- Back-end: Spring Boot monolith exposing REST endpoints, performing business logic (user, classroom, lecture, quiz, notifications).
- Infrastructure: MySQL for relational data, Redis for cache/session, AWS S3 for file storage, external LangChain AI integration, JWT-based security.

##### File structure for architectural cues
- Top-level “frontend” folder holds the Next.js app, organized by routes (student/teacher/non-login) plus shared components, API wrappers, state stores (Zustand).
- Top-level “backend” folder is a Spring Boot service: domain packages (user, classroom, lecture, lectureNote, quiz, notification, etc.), global cross-cutting concerns (security, exception handling, Redis config, S3 config), and an infra/langchain client.
- Dockerfile and docker-compose.yml in backend suggest containerization of the service and local orchestration with dependent services (MySQL, Redis).

##### Key insights from the README
- Back-end tech: Spring Boot (Java 17), MySQL, Redis, AWS S3.
- Front-end tech: Next.js (TypeScript), React, Zustand, SCSS, PWA.
- CI/CD/Deployment on AWS (but not detailed here).
- Business features: user sign-up/login (JWT + Redis), class & lecture management, quiz generation & analysis (with AI), notifications and settings, file storage for lecture materials.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client"
        Browser["User Browser"]:::frontend
    end

    %% Frontend Layer
    subgraph "Frontend: Next.js PWA"
        PWA["Next.js PWA"]:::frontend
        APIWrappers["API Wrappers"]:::frontend
        State["Zustand Stores"]:::frontend
    end

    Browser -->|"HTTP/HTTPS"| PWA
    PWA -->|"REST API calls"| APIWrappers
    APIWrappers -->|"State updates"| State
    APIWrappers -->|"API requests"| BackendApp

    click PWA "https://github.com/kw-classlog/classlog/tree/dev/frontend/"
    click APIWrappers "https://github.com/kw-classlog/classlog/tree/dev/frontend/api/"
    click State "https://github.com/kw-classlog/classlog/tree/dev/frontend/store/"

    %% Backend Container & Build
    subgraph "Backend Container"
        BackendApp["Spring Boot API"]:::backend
        Build["build.gradle"]:::backend
        Dockerfile["Dockerfile"]:::backend
        Compose["docker-compose.yml"]:::backend
    end

    APIWrappers -->|"HTTP/HTTPS"| BackendApp

    click BackendApp "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/BackendApplication.java"
    click Build "https://github.com/kw-classlog/classlog/blob/dev/backend/build.gradle"
    click Dockerfile "https://github.com/kw-classlog/classlog/tree/dev/backend/Dockerfile"
    click Compose "https://github.com/kw-classlog/classlog/blob/dev/backend/docker-compose.yml"

    %% Domain Modules
    subgraph "Backend Domain Modules"
        UM["User Domain"]:::backend
        CM["Classroom Domain"]:::backend
        LM["Lecture Domain"]:::backend
        LN["LectureNote Domain"]:::backend
        QM["Quiz Domain"]:::backend
        QA["QuizAccuracy Domain"]:::backend
        QAns["QuizAnswer Domain"]:::backend
        SC["StudentClass Domain"]:::backend
        N["Notification Domain"]:::backend
        NS["NotificationSetting Domain"]:::backend
        Opt["Option Domain"]:::backend
    end

    BackendApp -->|"uses"| UM
    BackendApp -->|"uses"| CM
    BackendApp -->|"uses"| LM
    BackendApp -->|"uses"| LN
    BackendApp -->|"uses"| QM
    BackendApp -->|"uses"| QA
    BackendApp -->|"uses"| QAns
    BackendApp -->|"uses"| SC
    BackendApp -->|"uses"| N
    BackendApp -->|"uses"| NS
    BackendApp -->|"uses"| Opt

    click UM "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/user/"
    click CM "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/classroom/"
    click LM "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/lecture/"
    click LN "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/lectureNote/"
    click QM "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/quiz/"
    click QA "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/quizAccuracy/"
    click QAns "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/quizAnswer/"
    click SC "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/studentClass/"
    click N "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/notification/"
    click NS "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/notificationSetting/"
    click Opt "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/domain/option/"

    %% Global Cross-Cutting
    subgraph "Global Cross-Cutting Concerns"
        Ex["GlobalExceptionHandler"]:::backend
        ApiResp["ApiResponse Wrapper"]:::backend
    end

    BackendApp -->|"exception & response"| Ex
    BackendApp -->|"wraps responses"| ApiResp

    click Ex "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/exception/GlobalExceptionHandler.java"
    click ApiResp "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/ApiResponse.java"

    %% Security Layer
    subgraph "Security"
        SecCfg["SecurityConfig"]:::backend
        JWTUtil["JWTUtil & Props"]:::backend
        Filters["JWTFilter & LoginFilter"]:::backend
        Auth["Auth Utils & CustomDetails"]:::backend
    end

    BackendApp -->|"secure APIs"| SecCfg
    SecCfg --> JWTUtil
    SecCfg --> Filters
    Filters --> Auth

    click SecCfg "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/security/config/SecurityConfig.java"
    click JWTUtil "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/security/token/JWTUtil.java"
    click Filters "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/security/filter/JWTFilter.java"
    click Auth "https://github.com/kw-classlog/classlog/tree/dev/backend/src/main/java/org/example/backend/global/security/auth/"

    %% Infra Layer
    subgraph "Infrastructure"
        RedisCfg["RedisConfig & Util"]:::backend
        S3Cfg["S3Config & Service"]:::backend
        LangChain["LangChain Client"]:::backend
    end

    BackendApp --> RedisCfg
    BackendApp --> S3Cfg
    BackendApp --> LangChain

    click RedisCfg "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/redis/RedisConfig.java"
    click S3Cfg "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/global/S3/config/S3Config.java"
    click LangChain "https://github.com/kw-classlog/classlog/blob/dev/backend/src/main/java/org/example/backend/infra/langchain/LangChainClient.java"

    %% Data Stores
    subgraph "Data Stores"
        MySQL["MySQL RDS"]:::database
        RedisDB["Redis Cache"]:::database
    end

    BackendApp -->|"JPA Queries"| MySQL
    RedisCfg -->|"Cache & Session"| RedisDB
    Filters -->|"token storage"| RedisDB

    %% External Services
    subgraph "External Services"
        S3["AWS S3 Bucket"]:::external
        AI["LangChain AI Service"]:::external
        Email["Email Service"]:::external
    end

    S3Cfg -->|"upload/download"| S3
    LangChain -->|"AI requests"| AI
    BackendApp -->|"Email notifications"| Email

    classDef frontend fill:#f9f,stroke:#333,stroke-width:1px
    classDef backend fill:#bbf,stroke:#333,stroke-width:1px
    classDef database fill:#bfb,stroke:#333,stroke-width:1px
    classDef external fill:#fbf,stroke:#333,stroke-width:1px
```
