# kubra-kzlk/webapp-illumination architecture

> Architecture diagram of the GitHub repository kubra-kzlk/webapp-illumination, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kubra-kzlk/webapp-illumination
- Repository: https://github.com/kubra-kzlk/webapp-illumination

## Overview

##### Main Components

a) Client Layer:
- It to the public assets (CSS, images) and EJS views

b) Application Layer (Express.js Server):
- Following sub-components:
- Route Controllers (loginRouter, registerRouter)
- Middleware (secureMiddleware)
- Session Management
- EJS Template Engine
- Use green to represent server-side components

c) Data Layer:
- MongoDB database at the bottom
- Use orange for database components

##### Detailed Component Breakdown

**Client Layer**
- Public Assets
- CSS (style.css)
- Images
- Views (EJS)
- Main Views (index, fabrics, etc.)
- Auth Views (login, register)
- Partials (header, footer)

**Application Layer (Express.js + TypeScript)**
- Routes
- Login Router
- Register Router
- Middleware
- Secure Middleware
- Session Management
- Type Definitions

**Data Layer**
- MongoDB

##### Technical Stack Indicators

- TypeScript
- Express.js
- MongoDB
- EJS
- Bootstrap
- Node.js

##### Authentication Flow

- Login/Register process
- Session creation
- Secure routes protection

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        PublicAssets["Public Assets"]
        Views["View Templates"]
        
        subgraph Assets
            CSS["CSS Styles"]:::file
            Images["Images"]:::directory
        end
        
        subgraph ViewTemplates
            MainViews["Main Views"]
            AuthViews["Auth Views"]
            Partials["Partials"]
        end
    end
    
    subgraph Server
        Express["Express.js Server"]:::file
        
        subgraph Controllers
            LoginRouter["Login Router"]:::file
            RegisterRouter["Register Router"]:::file
        end
        
        subgraph Middleware
            SecureMiddleware["Secure Middleware"]:::file
            SessionMgmt["Session Management"]:::file
        end
        
        TypeDefs["Type Definitions"]:::file
        AppConfig["App Configuration"]:::file
    end
    
    subgraph Database
        MongoDB[(MongoDB)]
        DBConn["Database Connection"]:::file
    end
    
    %% Relationships
    Browser --> PublicAssets
    Browser --> Views
    PublicAssets --> CSS
    PublicAssets --> Images
    Views --> MainViews
    Views --> AuthViews
    Views --> Partials
    
    Browser --> Express
    Express --> LoginRouter
    Express --> RegisterRouter
    Express --> SecureMiddleware
    Express --> SessionMgmt
    Express --> AppConfig
    
    LoginRouter --> DBConn
    RegisterRouter --> DBConn
    DBConn --> MongoDB
    
    %% Click Events
    click CSS "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/public/style.css"
    click Images "https://github.com/kubra-kzlk/webapp-Illumination/tree/main/public/assets/images"
    click MainViews "https://github.com/kubra-kzlk/webapp-Illumination/tree/main/views"
    click AuthViews "https://github.com/kubra-kzlk/webapp-Illumination/tree/main/views"
    click Partials "https://github.com/kubra-kzlk/webapp-Illumination/tree/main/views/partials"
    click LoginRouter "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/routes/loginRouter.ts"
    click RegisterRouter "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/routes/registerRouter.ts"
    click SecureMiddleware "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/secureMiddleware.ts"
    click SessionMgmt "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/session.ts"
    click TypeDefs "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/types.ts"
    click Express "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/index.ts"
    click AppConfig "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/app.ts"
    click DBConn "https://github.com/kubra-kzlk/webapp-Illumination/blob/main/database.ts"
    
    %% Styles
    classDef file fill:#f9f,stroke:#333,stroke-width:2px
    classDef directory fill:#bbf,stroke:#333,stroke-width:2px
    classDef database fill:#feb,stroke:#333,stroke-width:2px
    
    %% Legend
    subgraph Legend
        L1["File"]:::file
        L2["Directory"]:::directory
        L3["Database"]:::database
    end
```
