# keyurvaghani/unitedtutoring architecture

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

- Interactive diagram: https://gitdiagram.com/keyurvaghani/unitedtutoring
- Repository: https://github.com/keyurvaghani/unitedtutoring

## Overview

Based on our analysis of the file structure and README information, United Tutoring is a full-stack online tutoring platform that relies on a modern frontend built in React (under the “client” directory), a number of AWS Lambda functions (in the “lambda” directory) for its business logic and serverless backend operations, and AWS CloudFormation scripts (in the “cloud_formation” directory) to provision and manage its AWS services and infrastructure.

##### Main Components
- Frontend (Client): Represented by the “client” directory. This React-based application manages the user interface for both tutors and students, handling components like authentication (AuthenticatedRoute/UnAuthenticatedRoute), dashboards, profiles, and booking interactions. Include details such as:
- Pages for login, profile management, tutor availability, booking interfaces, etc.
- API calls from the client (e.g., from the “apis” directory) to the backend.
- Backend (Serverless Functions): Represent the Lambda functions that handle operations such as getting or saving profile images, booking details, tutor availability, and email notifications. These functions act as the business logic for data manipulation and interaction.
- Infrastructure & Deployment: Incorporate AWS CloudFormation scripts (e.g., “united_tutoring_backend.yml” and “united_tutoring_beanstalk.yml”) which automate the provisioning of the AWS services used. Include references to:
- AWS Lambda (for Lambda functions)
- AWS API Gateway (for exposing Lambda functions as RESTful endpoints)
- AWS Cognito (for user authentication)
- AWS DynamoDB (data store, although not seen in the file tree, mentioned in the README)
- AWS S3 (could be used for hosting assets or client static files)
- Other AWS services such as Elastic Beanstalk, EventBridge (for cronjobs), and SNS (for notifications)

##### Relationships & Data Flow
- User Interaction: Show the user (student/tutor) accessing the React client running in a browser.
- Authentication: Include a component for AWS Cognito managing user login and leveraging JWT tokens.
- Cronjobs & Scheduling: Illustrate that a scheduled Lambda function (via AWS EventBridge) periodically updates session status.

##### Architectural Patterns & Design Principles
- Serverless Architecture: Emphasize that the backend logic is implemented in distinct Lambda functions which are triggered through API Gateway endpoints.
- Infrastructure as Code: Note the use of AWS CloudFormation templates which manage the deployment and configuration of AWS resources, promoting repeatability and scalability.
- API-driven Communication: Highlight the clear API boundaries between the client and the serverless backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User (Student/Tutor)"]:::external

    subgraph "Frontend"
        F_client["React Client"]:::frontend
        subgraph "Components"
            F_auth["Authentication: AuthenticatedRoute"]:::frontend
            F_unauth["Authentication: UnAuthenticatedRoute"]:::frontend
            F_dashboard["Dashboard"]:::frontend
            subgraph "Profile Management"
                F_profile["Profile"]:::frontend
                F_profile_student["ProfileStudent"]:::frontend
                F_profile_ta["ProfileTA"]:::frontend
                F_select_creatable["SelectCreatable"]:::frontend
            end
            subgraph "Tutor & Booking"
                F_tutor["Tutor"]:::frontend
                F_availability["Availability"]:::frontend
                F_booking["BookingDetails"]:::frontend
            end
            F_student["Student Interface"]:::frontend
            subgraph "User Management"
                F_signup["Signup"]:::frontend
                F_signin["Signin"]:::frontend
                F_forget["Forgetpassword"]:::frontend
                F_reset["Resetpassword"]:::frontend
                F_verify["Verifyaccount"]:::frontend
            end
            subgraph "API Calls"
                F_api_avail["API: Availability"]:::frontend
                F_api_tutor["API: Tutor"]:::frontend
            end
        end
    end

    subgraph "Backend"
        B_lambda["AWS Lambda Functions"]:::backend
    end

    subgraph "AWS Cloud Infrastructure"
        AWS_api_gateway["API Gateway"]:::aws
        AWS_cognito["AWS Cognito"]:::aws
        AWS_eventbridge["AWS EventBridge"]:::aws
        AWS_s3["AWS S3"]:::aws
        AWS_cf_backend["CloudFormation: united_tutoring_backend.yml"]:::aws
        AWS_cf_beanstalk["CloudFormation: united_tutoring_beanstalk.yml"]:::aws
    end

    subgraph "External Services"
        EX_zoom["Zoom API"]:::external
        EX_moment["Moment.js"]:::external
        EX_dynamodb["AWS DynamoDB"]:::aws
    end

    %% Connections
    U --> F_client
    F_client --> F_api_avail
    F_client --> F_api_tutor
    F_api_avail -->|"calls"| AWS_api_gateway
    F_api_tutor -->|"calls"| AWS_api_gateway
    AWS_api_gateway -->|"triggers"| B_lambda
    AWS_eventbridge -->|"triggers(cronjob)"| B_lambda
    F_auth -->|"auth_request"| AWS_cognito
    B_lambda -->|"process_booking"| EX_zoom
    B_lambda -->|"stores_assets"| AWS_s3
    B_lambda -->|"stores_data"| EX_dynamodb
    F_client -->|"time_support"| EX_moment
    AWS_cf_backend -- "provisions" --> AWS_api_gateway
    AWS_cf_backend -- "provisions" --> AWS_cognito
    AWS_cf_backend -- "provisions" --> AWS_eventbridge
    AWS_cf_backend -- "provisions" --> AWS_s3
    AWS_cf_beanstalk -- "deploys" --> AWS_api_gateway

    %% Click Events
    click F_client "https://github.com/keyurvaghani/unitedtutoring/tree/main/client/"
    click F_auth "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Authenticator/AuthenticatedRoute.js"
    click F_unauth "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Authenticator/UnAuthenticatedRoute.js"
    click F_dashboard "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Dashboard/Dashboard.js"
    click F_profile "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Profile/Profile.js"
    click F_profile_student "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Profile/ProfileStudent.js"
    click F_profile_ta "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Profile/ProfileTA.js"
    click F_select_creatable "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Profile/SelectCreatable.js"
    click F_tutor "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Tutor/Tutor.js"
    click F_availability "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Tutor/Availability.js"
    click F_booking "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Tutor/BookingDetails.js"
    click F_student "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/Student/Student.js"
    click F_signup "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/usermanagement/Signup/Signup.js"
    click F_signin "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/usermanagement/Signin/Signin.js"
    click F_forget "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/usermanagement/Forgetpassword/Forgetpassword.js"
    click F_reset "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/usermanagement/Resetpassword/Resetpassword.js"
    click F_verify "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/components/usermanagement/Verifyaccount/Verifyaccount.js"
    click F_api_avail "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/apis/Availability.js"
    click F_api_tutor "https://github.com/keyurvaghani/unitedtutoring/blob/main/client/src/apis/Tutor.js"
    click B_lambda "https://github.com/keyurvaghani/unitedtutoring/tree/main/lambda/"
    click AWS_cf_backend "https://github.com/keyurvaghani/unitedtutoring/blob/main/cloud_formation/united_tutoring_backend.yml"
    click AWS_cf_beanstalk "https://github.com/keyurvaghani/unitedtutoring/blob/main/cloud_formation/united_tutoring_beanstalk.yml"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef aws fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;

    class F_client,F_auth,F_unauth,F_dashboard,F_profile,F_profile_student,F_profile_ta,F_select_creatable,F_tutor,F_availability,F_booking,F_student,F_signup,F_signin,F_forget,F_reset,F_verify,F_api_avail,F_api_tutor frontend;
    class B_lambda backend;
    class AWS_api_gateway,AWS_cognito,AWS_eventbridge,AWS_s3,AWS_cf_backend,AWS_cf_beanstalk,EX_dynamodb aws;
    class U,EX_zoom,EX_moment external;
```
