# shivam0912/campus-connect architecture

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

- Interactive diagram: https://gitdiagram.com/shivam0912/campus-connect
- Repository: https://github.com/shivam0912/campus-connect

## Overview

##### Main Components
- Frontend (Client)
- React application. Highlight that it is built with React JS and is structured into components (Header, Footer, Loader, Product, etc.), screens (LoginScreen, ProductScreen, Landing, etc.), and Redux parts (actions, reducers, store).
- Both the development and production “build” flows (showing the existence of a build process that optimizes the production bundle).
- Backend (Server)
- Node/Express server. Indicate the clear separation into directories for controllers, routes, models, middleware, and utilities.
- That the backend uses a standard MVC (or closely related) pattern where controllers manage business logic, models represent data structures (users, products, orders), and routes define API endpoints (for products, uploads, and users).
- Database
- MongoDB database that the backend connects to via the configuration in backend/config/db.js.
- External/Supporting Services
- A component for external services if, for example, there is any third-party payment, email verification (as one screen suggests “EmailVerificationScreen”), or file hosting for uploaded media.

##### Relationships and Data Flow
- From the backend, illustrate how controllers (productController, userController) interact with models (userModel, productModel, orderModel) to fetch or update data.
- If applicable, indicate any middleware (like authMiddleware) that intercepts API calls for security/authorization.

##### Architectural Patterns and Principles
- The frontend is organized as a component-based architecture (React components) with state management likely handled by Redux (actions, reducers, store) so include a note on the unidirectional data flow.
- Separation of concerns between frontend and backend.

##### Technologies and Frameworks
- Frontend technologies: HTML, CSS, JavaScript, React JS.
- Backend technologies: Node JS, Express JS.
- Database: MongoDB.
- Build tools and package management: npm, including build scripts (npm start, npm build, etc.)
- Deployment related files (Procfile, vercel.json) indicate deployment to platforms like Heroku or Vercel – mark these as deployment infrastructure if needed.

- Under the Frontend block, illustrate the component hierarchy and placement of major screens and Redux flow components.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Client (Frontend)"
        FE_Main["React Application"]:::frontend
        FE_Comps["UI Components"]:::frontend
        FE_Screens["Screens"]:::frontend
        FE_Act["Redux Actions"]:::frontend
        FE_Red["Redux Reducers"]:::frontend
        FE_Store["Redux Store"]:::frontend
        FE_Build["Production Build"]:::frontend
    end

    subgraph "API Server (Backend)"
        BE_Main["Server Entry (server.js)"]:::backend
        BE_Routes["Routes (API Endpoints)"]:::backend
        BE_Middleware["Middleware (Auth/Error)"]:::backend
        BE_Controllers["Controllers (Business Logic)"]:::backend
        BE_Models["Models (Data Structures)"]:::backend
        BE_Utils["Utility Functions"]:::backend
        BE_DBConfig["DB Configuration"]:::backend
    end

    DB["MongoDB Database"]:::database
    DEPLOY["Deployment Configuration"]:::deployment

    %% Data Flow Arrows
    FE_Screens -->|"API_Call"| BE_Routes
    BE_Main -->|"Init_Routes"| BE_Routes
    BE_Routes -->|"AuthCheck"| BE_Middleware
    BE_Routes -->|"HandleRequest"| BE_Controllers
    BE_Middleware -->|"Forward"| BE_Controllers
    BE_Controllers -->|"DataOps"| BE_Models
    BE_Controllers -->|"TokenGen"| BE_Utils
    BE_DBConfig -->|"Connects"| DB
    BE_Controllers -->|"DB_Query"| DB
    FE_Build -->|"Deploy"| DEPLOY
    BE_Main -->|"Deploy"| DEPLOY

    %% Click Events
    click FE_Main "https://github.com/shivam0912/campus-connect/tree/master/Frontend/"
    click FE_Comps "https://github.com/shivam0912/campus-connect/tree/master/Frontend/src/components/"
    click FE_Screens "https://github.com/shivam0912/campus-connect/tree/master/Frontend/src/screens/"
    click FE_Act "https://github.com/shivam0912/campus-connect/tree/master/Frontend/src/actions/"
    click FE_Red "https://github.com/shivam0912/campus-connect/tree/master/Frontend/src/reducers/"
    click FE_Store "https://github.com/shivam0912/campus-connect/blob/master/Frontend/src/store.js"
    click FE_Build "https://github.com/shivam0912/campus-connect/tree/master/Frontend/build/"
    click BE_Main "https://github.com/shivam0912/campus-connect/blob/master/backend/server.js"
    click BE_Routes "https://github.com/shivam0912/campus-connect/tree/master/backend/routes/"
    click BE_Controllers "https://github.com/shivam0912/campus-connect/tree/master/backend/controllers/"
    click BE_Models "https://github.com/shivam0912/campus-connect/tree/master/backend/models/"
    click BE_Middleware "https://github.com/shivam0912/campus-connect/blob/master/backend/middleware/authMiddleware.js"
    click BE_Utils "https://github.com/shivam0912/campus-connect/blob/master/backend/utils/generateToken.js"
    click BE_DBConfig "https://github.com/shivam0912/campus-connect/blob/master/backend/config/db.js"
    click DEPLOY "https://github.com/shivam0912/campus-connect/tree/master/Procfile"
    click DEPLOY "https://github.com/shivam0912/campus-connect/blob/master/backend/vercel.json"

    %% Styles
    classDef frontend fill:#e6f7ff,stroke:#1890ff,stroke-width:2px;
    classDef backend fill:#e6ffe6,stroke:#33cc33,stroke-width:2px;
    classDef database fill:#fff7e6,stroke:#ffa500,stroke-width:2px;
    classDef deployment fill:#f0e6ff,stroke:#9b59b6,stroke-width:2px;
```
