# mdhasnainali/kuet-cse-bitfest-2024-hackathon-machine_mindset architecture

> Architecture diagram of the GitHub repository mdhasnainali/kuet-cse-bitfest-2024-hackathon-machine_mindset, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mdhasnainali/kuet-cse-bitfest-2024-hackathon-machine_mindset
- Repository: https://github.com/mdhasnainali/kuet-cse-bitfest-2024-hackathon-machine_mindset

## Overview

##### Data Flow Architecture

- User requests flow from frontend to backend
- Authentication flow
- AI model inference requests
- PDF generation pipeline
- Database interactions
- Training data flow for model improvement

##### Key Subsystems

a. Content Management System
- PDF Generation Pipeline
- Font Management
- Public/Private Content Handling

b. User Management
- Teacher Portal
- Student Portal
- Administrator Dashboard

c. AI Components
- Banglish to Bangla Converter
- Chatbot System
- Auto-correction System (GPT Integration)

##### Integration Points

Clear connections between:
- Frontend and Backend API endpoints
- Backend and AI Microservice
- MLflow monitoring and model training
- Mobile app API integration

##### Security Layer (Red)
- JWT Authentication flow
- API security middleware
- User role management

##### Deployment Architecture
- Docker container for backend
- AI model serving infrastructure
- Database system
- Frontend hosting

- Security boundaries
- External service integrations

Special Considerations:

##### AI Pipeline Flow
- Flow from Banglish input
- GPT preprocessing step
- Llama model processing
- Response generation

##### Content Management Flow
- Document the PDF generation pipeline
- Font selection system
- Storage and retrieval process

##### Analytics System
- Data collection points
- Metrics processing
- Dashboard data flow

##### Mobile Integration
- How the Flutter app interfaces with the backend
- Shared authentication system
- API endpoint usage

This system design should emphasize the unique aspects of BanglaShift, particularly the AI integration and language processing capabilities, while clearly showing how all components work together to deliver the core functionality.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef ai fill:#e67e22,stroke:#d35400,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef database fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef content fill:#9b59b6,stroke:#8e44ad,color:white

    %% Frontend Layer
    subgraph Frontend
        WA["Web App (NextJS)"]:::frontend
        MA["Mobile App (Flutter)"]:::frontend
        UI["UI Components"]:::frontend
        SM["State Management"]:::frontend
        CH["Chatbot"]:::frontend
        CC["Content Creation"]:::frontend
        AD["Admin Dashboard"]:::frontend
        Auth["Authentication UI"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        API["Django REST API"]:::backend
        AuthService["Authentication Service"]:::backend
        PDF["PDF Generation"]:::backend
        DB[(Database)]:::database
    end

    %% AI Layer
    subgraph AI
        FastAPI["FastAPI Server"]:::ai
        Llama["Llama 3.1 8B Model"]:::ai
        MLflow["MLflow Pipeline"]:::ai
        Training["Model Training"]:::ai
    end

    %% Content Management
    subgraph CMS
        TC["Teacher Content"]:::content
        PDFTemp["PDF Templates"]:::content
        Media["Media Storage"]:::content
    end

    %% User Management
    subgraph Users
        TP["Teacher Portal"]:::backend
        SP["Student Portal"]:::backend
        AdminD["Admin Dashboard"]:::backend
    end

    %% Relationships
    WA --> API
    MA --> API
    API --> AuthService
    API --> DB
    API --> FastAPI
    FastAPI --> Llama
    Llama --> MLflow
    Training --> Llama
    API --> PDF
    PDF --> PDFTemp
    AuthService --> DB
    TC --> API
    TP --> API
    SP --> API
    AdminD --> API

    %% Click Events
    click WA "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend"
    click MA "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/mobile-app"
    click UI "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend/components"
    click SM "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend/lib/redux"
    click API "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend"
    click AuthService "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/administrator"
    click PDF "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/blob/main/backend/backend/templates/pdf_template.html"
    click DB "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/blob/main/backend/backend/db.sqlite3"
    click FastAPI "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/blob/main/ai/server.py"
    click Llama "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/blob/main/ai/Llama-3.1-Banglish-to-Bangla-V1"
    click MLflow "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/ai/mlruns"
    click Training "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/blob/main/ai/retrain_model.py"
    click TC "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/teacher"
    click PDFTemp "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/templates"
    click Media "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/media"
    click TP "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/teacher"
    click SP "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/student"
    click AdminD "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/backend/backend/administrator"
    click CH "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend/app/(pages)/chatbot"
    click CC "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend/app/(pages)/content-craft"
    click AD "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend/app/(pages)/(admin)/admin-dashboard"
    click Auth "https://github.com/mdhasnainali/KUET-CSE-BitFest-2024-Hackathon-Machine_Mindset/tree/main/frontend/app/(auth)/auth"

    %% Legend
    subgraph Legend
        F["Frontend"]:::frontend
        B["Backend"]:::backend
        A["AI Components"]:::ai
        S["Security"]:::security
        D["Database"]:::database
        C["Content"]:::content
    end
```
