# cfgbengaluru24/team-23 architecture

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

- Interactive diagram: https://gitdiagram.com/cfgbengaluru24/team-23
- Repository: https://github.com/cfgbengaluru24/team-23

## Overview

##### Project type and purpose
- This is a full-stack web application (“Best Practices Foundation”) whose goal is to train and assess volunteer trainers, record and analyze field data, host a knowledge repository, and manage call-center interactions.
- Frontend: React.js SPA for registration, quizzes, dashboards, video modules.
- Backend: Node.js/Express API handling authentication (JWT), data persistence (MongoDB), quiz logic, SMS service (Twilio), and call-center data ingestion.

##### File structure
- Top-level:
- backend/ – Node.js service
– config/db.js: MongoDB connection
– middleware/auth.js: JWT verification
– models/*.js: Mongoose schemas (User, Question, Assessment)
– routes/*.js: Express routers (auth, quiz, exotel/SMS)
– server.js: entry point, middleware wiring
- frontend/ – React client
– public/: index.html, app manifest
– src/: core React files (App.js, index.js), Components/ (Landing, Login/Register, Quiz, Dashboard, Results, VideoPlayer)
- Config files: package.json in each tier, .gitignore at root.
- No microservices—monolithic API, single React app.

##### Key insights from README
- Major modules: Trainer & Volunteer Registration, Modular Courses & Quizzes, Admin Data Management (baseline/endline data, visualization, recommendations), SMS service, Call Center (voice transcription & analysis).
- Tech stack confirmed: React, Node/Express, MongoDB, JWT, Twilio.

##### Detail
- JWT token issuance on login and token verification middleware.
- Data collections: Users, Questions, Assessments, ProgramData.
- SMS scheduling flow (cron or triggered on events).

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        subgraph "Frontend SPA"
            Index["Index"]:::frontend
            App["App"]:::frontend
            Landing["Landing Page"]:::frontend
            LoginReg["Login & Registration"]:::frontend
            QuizContainer["Quiz Interface"]:::frontend
            MCQForm["MCQ Form"]:::frontend
            QuestionComp["Question Display"]:::frontend
            QuizResults["Quiz Results"]:::frontend
            Dashboard["Dashboard"]:::frontend
            VideoPlayer["Video Training"]:::frontend
            Instructions["Instructions Page"]:::frontend
        end
    end

    subgraph "API Layer"
        Server["Express API Server"]:::backend
        AuthMw["JWT Auth Middleware"]:::backend
        AuthRoutes["Authentication Routes"]:::backend
        QuizRoutes["Quiz Routes & Controllers"]:::backend
        ExotelRoutes["Call-Center/SMS Routes"]:::backend
    end

    subgraph "Data Layer"
        DBConfig["MongoDB Config"]:::backend
        Mongo["MongoDB"]:::db
        subgraph "Collections"
            Users["Users"]:::db
            Questions["Questions"]:::db
            Assessments["Assessments"]:::db
        end
    end

    subgraph "External Services"
        Twilio["Twilio SMS Service"]:::external
        Exotel["Exotel Telephony Gateway"]:::external
    end

    %% Presentation to API
    Index --> App
    App --> Landing
    App --> LoginReg
    App --> QuizContainer
    QuizContainer --> MCQForm
    QuizContainer --> QuestionComp
    App --> QuizResults
    App --> Dashboard
    App --> VideoPlayer
    App --> Instructions

    %% API internal
    Server --> AuthRoutes
    Server --> QuizRoutes
    Server --> ExotelRoutes
    AuthRoutes --> AuthMw

    %% API to Data
    Server --> DBConfig
    DBConfig --> Mongo
    QuizRoutes --> Questions
    QuizRoutes --> Assessments
    AuthRoutes --> Users

    %% External integrations
    Server -->|"send SMS"| Twilio
    Exotel -->|"webhook call data"| Server

    %% Data relationships
    Mongo --> Users
    Mongo --> Questions
    Mongo --> Assessments

    %% Click Events
    click Index "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/index.js"
    click App "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/App.js"
    click Landing "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/Landing.js"
    click LoginReg "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/LoginRegisterForm.js"
    click QuizContainer "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/Quiz.js"
    click MCQForm "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/MCQForm.js"
    click QuestionComp "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/Question.js"
    click QuizResults "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/QuizResults.js"
    click Dashboard "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/DashBoard.js"
    click VideoPlayer "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/VideoPlayer.js"
    click Instructions "https://github.com/cfgbengaluru24/team-23/blob/main/frontend/src/Components/Instructions.js"
    click Server "https://github.com/cfgbengaluru24/team-23/blob/main/backend/server.js"
    click DBConfig "https://github.com/cfgbengaluru24/team-23/blob/main/backend/config/db.js"
    click AuthMw "https://github.com/cfgbengaluru24/team-23/blob/main/backend/middleware/auth.js"
    click AuthRoutes "https://github.com/cfgbengaluru24/team-23/blob/main/backend/routes/auth.js"
    click QuizRoutes "https://github.com/cfgbengaluru24/team-23/blob/main/backend/routes/quiz.js"
    click ExotelRoutes "https://github.com/cfgbengaluru24/team-23/blob/main/backend/routes/exotel.js"
    click Users "https://github.com/cfgbengaluru24/team-23/blob/main/backend/models/User.js"
    click Questions "https://github.com/cfgbengaluru24/team-23/blob/main/backend/models/Question.js"
    click Assessments "https://github.com/cfgbengaluru24/team-23/blob/main/backend/models/Assessment.js"

    classDef frontend fill:#D0E8FF,stroke:#3399FF
    classDef backend fill:#E8F3D0,stroke:#99CC33
    classDef db fill:#DFFFE0,stroke:#33CC66
    classDef external fill:#FFE8D0,stroke:#FF9933
```
