# sam122001/calender_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/sam122001/calender_management_system
- Repository: https://github.com/sam122001/calender_management_system

## Overview

##### Project Type and Purpose
- This is a full-stack web application (“Google Calendar Integration App”) that lets users authenticate via Google OAuth2, view/create/delete calendar events in a React-based UI, and store extended event data in MongoDB.
- Key use-cases: OAuth2 login, syncing with Google Calendar API, event CRUD, participant management, session notes, real-time calendar view.

##### File Structure
A. Frontend (root-level “public” & “src”)
- public/index.html, manifest.json, robots.txt
- src/
- App.js, index.js, routing & bootstrapping
- components/Calendar.js (react-big-calendar view), EventModal.js (event editor)
- styles/ & CSS files
B. Backend (calendar-backend/)
- index.js (Express server & route definitions)
- models/Event.js (Mongoose schema for extended event data)
- credentials.json & .env (Google API OAuth credentials, session secret, MongoDB URI)
- package.json (Express, Mongoose, CORS, express-session, googleapis)
C. Shared
- Root package.json (likely React scripts & dev tools)
- .gitignore
D. Key patterns
- Client-server separation (React vs Express)
- MVC-inspired on the backend (models folder + route handlers)
- External API integration (Google Calendar)

##### Extract Insights from README
- Frontend: React Router, react-big-calendar, Moment.js
- Backend: Node/Express, MongoDB w/ Mongoose, Google Calendar API, express-session for auth, CORS
- Data flow: browser ↔ Express API ↔ Google API & MongoDB

##### Main Components
a. Frontend Application
- React components (CalendarView, EventModal, Auth flow)
- react-big-calendar widget
- HTTP client (fetch/Axios)
b. Backend API Server
- Express routes (auth, /events endpoints)
- Session manager (express-session, cookie store)
- Controllers interacting with Google APIs & MongoDB
c. Database
- MongoDB cluster
- Event collection (Mongoose model)
d. External Services
- Google OAuth2 / Calendar API
- (Optional) Session store if not in-memory
e. End User / Browser

##### Relationships & Interactions
- User’s browser logs in via Google OAuth2 (redirect to Google → callback to Express).
- Authenticated browser calls Express REST endpoints (GET/POST/DELETE /events).
- Express handlers:
- Query/update MongoDB for extended event details.
- Call Google Calendar API to sync event creation/deletion.
- Express returns JSON responses → React updates calendar view in real time.

##### Architectural Patterns & Principles
- Separation of concerns: UI vs API vs persistence vs external service.
- MVC-like backend: Models (Mongoose) ↔ Controllers (Express routes) ↔ Views (JSON responses).
- Component-based UI in React.
- Stateless UI + stateful session handling on server.
- API layer abstracts Google Calendar details from frontend.

##### Essential Elements
- Clear component boundaries (Frontend vs Backend vs External).
- Call out config/credentials as a separate “Secrets Store” if desired.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "User & Browser"
        User["End User Browser"]:::external
    end

    subgraph "Frontend Application"
        HTML["public/index.html"]:::frontend
        Index["src/index.js"]:::frontend
        App["src/App.js"]:::frontend
        subgraph "Components"
            Calendar["Calendar.js"]:::frontend
            EventModal["EventModal.js"]:::frontend
        end
        subgraph "Styles & Tests"
            AppCSS["App.css"]:::frontend
            IndexCSS["index.css"]:::frontend
            EventCSS["EventModel.css"]:::frontend
            AppTest["App.test.js"]:::frontend
            WebVitals["reportWebVitals.js"]:::frontend
            SetupTests["setupTests.js"]:::frontend
        end
    end

    subgraph "Backend API Server"
        Server["index.js"]:::backend
        Env[".env"]:::backend
        Cred["credentials.json"]:::backend
        PackageBE["package.json"]:::backend
        Model["models/Event.js"]:::backend
    end

    Database["MongoDB Cluster"]:::database

    Google["Google Calendar API"]:::external

    User -->|loads HTML| HTML
    HTML -->|bootstrap React| Index
    Index -->|renders App| App
    App -->|uses components| Calendar
    App -->|uses components| EventModal
    Calendar -->|HTTP requests| Server
    EventModal -->|HTTP requests| Server
    Server -->|read/write| Database
    Server -->|OAuth & API calls| Google
    Server -->|serves JSON| App

    click HTML "https://github.com/sam122001/calender_management_system/blob/main/public/index.html"
    click Index "https://github.com/sam122001/calender_management_system/blob/main/src/index.js"
    click App "https://github.com/sam122001/calender_management_system/blob/main/src/App.js"
    click Calendar "https://github.com/sam122001/calender_management_system/blob/main/src/components/Calendar.js"
    click EventModal "https://github.com/sam122001/calender_management_system/blob/main/src/components/EventModal.js"
    click AppCSS "https://github.com/sam122001/calender_management_system/blob/main/src/App.css"
    click IndexCSS "https://github.com/sam122001/calender_management_system/blob/main/src/index.css"
    click EventCSS "https://github.com/sam122001/calender_management_system/blob/main/src/styles/EventModel.css"
    click AppTest "https://github.com/sam122001/calender_management_system/blob/main/src/App.test.js"
    click WebVitals "https://github.com/sam122001/calender_management_system/blob/main/src/reportWebVitals.js"
    click SetupTests "https://github.com/sam122001/calender_management_system/blob/main/src/setupTests.js"
    click Server "https://github.com/sam122001/calender_management_system/blob/main/calendar-backend/index.js"
    click Env "https://github.com/sam122001/calender_management_system/blob/main/calendar-backend/.env"
    click Cred "https://github.com/sam122001/calender_management_system/blob/main/calendar-backend/credentials.json"
    click PackageBE "https://github.com/sam122001/calender_management_system/blob/main/calendar-backend/package.json"
    click Model "https://github.com/sam122001/calender_management_system/blob/main/calendar-backend/models/Event.js"
    click PackageRoot "https://github.com/sam122001/calender_management_system/blob/main/package.json"
    click Gitignore "https://github.com/sam122001/calender_management_system/blob/main/.gitignore"
    click Readme "https://github.com/sam122001/calender_management_system/blob/main/README.md"

    classDef frontend fill:#cce5ff,stroke:#0056b3,color:#0056b3
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef database fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef database stroke-dasharray: 5 5,shape:cylinder
```
