# hikmetbozkurt/learnlinkproject architecture

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

- Interactive diagram: https://gitdiagram.com/hikmetbozkurt/learnlinkproject
- Repository: https://github.com/hikmetbozkurt/learnlinkproject

## Overview

##### Project type and purpose
- LearnLink is a full-stack educational platform comprising two main deliverables:
- learnlink_gui (a React+TypeScript SPA)
- learnlink_api (a Node.js/Express REST+WebSocket API with PostgreSQL)
- Purpose: to deliver course management, real-time chat, assignments, events, notifications, user profiles and collaboration features.

##### File structure
- Top-level directories:
- learnlink_api – backend code (MVC controllers/models/routes, service layer, middleware, socket handlers, config)
- learnlink_gui – frontend code (React components, routes, context, hooks, services, styles)
- Patterns & conventions:
- Backend follows MVC + Service pattern + Middleware pipeline + Socket.IO handlers
- Frontend organized by features/components, uses Context API and custom hooks
- Config/deployment files: .env, nginx_timeout.config, DEPLOYMENT.md, package.json, pnpm-lock, tsconfig.json

##### README for additional insights
- Tech stack: React, TS, Express, Node.js, PostgreSQL, Socket.IO, JWT, Multer, Nodemailer
- Architectural notes: client-server separation, RESTful API, real-time bidirectional events, MVC, service layer, component-based UI, Context API

##### Elements
- Labels: “React SPA”, “Nginx/Load Balancer”, “Express API”, “PostgreSQL DB”, “Amazon S3”, “SMTP Server”
- API server & middleware in another (e.g., green)
- Data stores/external services in a third (e.g., orange)
- Rounded rectangles for services
- Clouds for external services

7. Middleware on the path (AuthMiddleware, ErrorMiddleware, UploadMiddleware).
8. CI/CD or deployment infra if relevant (e.g., AWS Elastic Beanstalk).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        CB["Client Browser\n(React+TS, Context, Hooks)"]:::frontend
    end

    %% Server Layer
    subgraph "Server Layer"
        NG["Nginx Load Balancer"]:::api
        subgraph "Express API Server"
            SR["server.js / app.ts\nEntry Point"]:::api

            subgraph "Middleware Chain"
                AM["AuthMiddleware"]:::api
                VM["Validation/Error Middleware"]:::api
                UM["UploadMiddleware"]:::api
            end

            subgraph "MVC Pattern"
                R["Routes"]:::api
                C["Controllers"]:::api
                SVC["Service Layer"]:::api
                M["Models"]:::api
            end

            SH["Socket.IO Chat Handler"]:::api
        end
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        DB[(PostgreSQL Database)]:::datastore
        S3[(Amazon S3 Storage)]:::datastore
        SMTP([SMTP Email Service]):::external
    end

    %% Connections
    CB -->|"HTTP/HTTPS GET/POST"| NG
    NG -->|"/api/*"| SR
    SR --> AM
    AM --> VM
    VM --> UM
    UM --> R
    R --> C
    C --> SVC
    SVC --> M
    M --> DB
    SVC --> S3
    SVC --> SMTP
    CB <-->|"WebSocket emit/on"| SH
    SH --> SR

    %% Click Events
    click CB "https://github.com/hikmetbozkurt/learnlinkproject/tree/main/learnlink_gui/src"
    click NG "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/nginx_timeout.config"
    click SR "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/server.js"
    click AM "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/middleware/authMiddleware.js"
    click VM "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/middleware/errorMiddleware.js"
    click UM "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/middleware/uploadMiddleware.js"
    click R "https://github.com/hikmetbozkurt/learnlinkproject/tree/main/learnlink_api/routes"
    click C "https://github.com/hikmetbozkurt/learnlinkproject/tree/main/learnlink_api/controllers"
    click SVC "https://github.com/hikmetbozkurt/learnlinkproject/tree/main/learnlink_api/services"
    click SH "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/socket/chatSocket.js"
    click DB "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/config/schema.sql"
    click S3 "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/services/s3Service.js"
    click SMTP "https://github.com/hikmetbozkurt/learnlinkproject/blob/main/learnlink_api/services/emailService.js"

    %% Styles
    classDef frontend fill:#9fcdff,stroke:#333,stroke-width:1px;
    classDef api fill:#a2f5a2,stroke:#333,stroke-width:1px;
    classDef datastore fill:#ffcc99,stroke:#333,stroke-width:1px;
    classDef external fill:#f2f2f2,stroke:#333,stroke-width:1px;
```
