# nirajsingh-007/esharefiles architecture

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

- Interactive diagram: https://gitdiagram.com/nirajsingh-007/esharefiles
- Repository: https://github.com/nirajsingh-007/esharefiles

## Overview

##### Main System Components

a) Client-Side Layer:
- Static content (HTML, CSS)
- Client-side JavaScript
- User Interface components (Dashboard, Login/Register, File Management)

b) Server-Side Layer:
- PHP Core Components
- Authentication System
- File Management System
- Email Service Integration (PHPMailer)

c) Data Layer:
- A "Database" block representing MySQL with two main tables:
- Users table
- Files table

##### Component Relationships

a) User Flow:
- How authentication requests flow from frontend → PHP auth system → database
- File upload/download paths from frontend → file management system → storage
- Email verification flow from auth system → PHPMailer → external email service

b) Data Flow:
- CRUD operations between PHP backend and MySQL database
- File storage and retrieval paths

##### Specific Implementation Details

Crucial elements:

a) Authentication Module:
- Login.php, register.php, auth.php, verify.php
- Email verification flow

b) File Management Module:
- Link upload.php, download.php, deletefile.php
- Storage limit checking (increasestorage.php)

c) User Interface Components:
- Dashboard interface (dashboard.php)
- Profile management (profile.php)
- File listing (myfiles.php)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI["User Interface"]:::frontend
        click UI "https://github.com/nirajsingh-007/eShareFiles/blob/main/index.html"
        CSS["Static Content (CSS)"]:::frontend
        click CSS "https://github.com/nirajsingh-007/eShareFiles/blob/main/style.css"
        JS["Client JavaScript"]:::frontend
        click JS "https://github.com/nirajsingh-007/eShareFiles/blob/main/js/main.js"
        Dashboard["Dashboard Interface"]:::frontend
        click Dashboard "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/dashboard.php"
        FileUI["File Management UI"]:::frontend
        click FileUI "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/myfiles.php"
    end

    subgraph Authentication
        Auth["Authentication System"]:::backend
        click Auth "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/auth.php"
        Login["Login Handler"]:::backend
        click Login "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/login.php"
        Register["Registration Handler"]:::backend
        click Register "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/register.php"
        Verify["Email Verification"]:::backend
        click Verify "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/verify.php"
        Reset["Password Reset"]:::backend
        click Reset "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/resetpwd.php"
    end

    subgraph "File Management"
        Upload["Upload Handler"]:::backend
        click Upload "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/upload.php"
        Download["Download Handler"]:::backend
        click Download "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/download.php"
        Delete["File Deletion"]:::backend
        click Delete "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/deletefile.php"
        Storage["Storage Manager"]:::backend
        click Storage "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/increasestorage.php"
    end

    subgraph "User Management"
        Profile["Profile Manager"]:::backend
        click Profile "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/profile.php"
        Session["Session Handler"]:::backend
        click Session "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/process.php"
        Logout["Logout Handler"]:::backend
        click Logout "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/logout.php"
    end

    subgraph Database
        DB["Database Connection"]:::database
        click DB "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/db.php"
        UsersTable["Users Table"]:::database
        FilesTable["Files Table"]:::database
    end

    subgraph "Email Service"
        PHPMailer["PHPMailer"]:::external
        EmailVerification["Email Verification Service"]:::external
        click EmailVerification "https://github.com/nirajsingh-007/eShareFiles/blob/main/users/resendemailverification.php"
    end

    UI --> Dashboard
    UI --> FileUI
    Dashboard --> Auth
    FileUI --> Upload
    FileUI --> Download
    FileUI --> Delete
    
    Auth --> DB
    Login --> Auth
    Register --> Auth
    Verify --> Auth
    Reset --> Auth
    
    Auth --> PHPMailer
    PHPMailer --> EmailVerification
    
    Upload --> Storage
    Download --> Storage
    Storage --> DB
    
    Profile --> DB
    Session --> DB
    
    DB --> UsersTable
    DB --> FilesTable

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DatabaseComp["Database Component"]:::database
        ExternalComp["External Service"]:::external
    end
```
