# srikanth-vnts/urban_company_clone architecture

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

- Interactive diagram: https://gitdiagram.com/srikanth-vnts/urban_company_clone
- Repository: https://github.com/srikanth-vnts/urban_company_clone

## Overview

##### Main Components
- Frontend: Represents the client-side application built with React (HTML, CSS, JS). It includes multiple directories such as components (for various UI sections like Homepage, Service Page, Login Modal, etc.), contexts for state management, styles, and additional component libraries.
- Backend: A Node.js/Express server with a clear MVC-like structure. The backend’s main directory contains:
- Configuration files (e.g., backend/src/config/connectionDb.js) used to connect to MongoDB.
- Controllers (inside backend/src/controllers) that handle service-related operations (e.g., professional, service cards, services, user).
- Models (inside backend/src/models) which define the data structure in connection with MongoDB.
- The entry point server.js where the Express server is initialized.
- Database: MongoDB, connected and used through Mongoose as defined in the configuration file and models.

##### Relationships and Interactions
- User Interaction: Users access the website, navigating through pages such as the landing page, signup/signin, service listings, and service details.
- Frontend-Backend Communication: The React frontend communicates with the backend (API endpoints) for functionalities like user authentication (phone number/OTP), fetching service details, and updating cart information.
- Business Logic Layer: The backend controllers process requests, interact with data models, and perform CRUD operations on the MongoDB database.

##### Architectural Patterns & Design Principles
- MVC Pattern in the Backend: The separation of concerns is evident in the division between controllers (logic) and models (data schema). The server (Express) ties these together.
- Component-Based Design in the Frontend: The React project is divided into reusable components and contexts, emphasizing modularity and separation of concerns.
- Layering: Clearly show the presentation layer (frontend), business logic layer (backend controllers), and data layer (models/DB).

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::external

    subgraph "Frontend"
        FE_UI["UI Pages: Homepage, SignUp/Login, Service Page, Service Detail"]:::frontend
        FE_Components["Components"]:::frontend
        FE_Contexts["Contexts"]:::frontend
        FE_Store["Store"]:::frontend
        FE_Styles["Styles"]:::frontend
        FE_Assets["Public Assets"]:::frontend
    end

    subgraph "Backend"
        BE_Server["Express Server (server.js)"]:::backend
        BE_Config["DB Config (connectionDb.js)"]:::backend
        BE_Controllers["Controllers"]:::backend
        BE_Models["Models"]:::backend
    end

    subgraph "Database"
        DB["MongoDB"]:::database
    end

    U -->|"accesses"| FE_UI
    FE_UI -->|"renders"| FE_Components
    FE_UI -->|"manages"| FE_Contexts
    FE_UI -->|"manages"| FE_Store
    FE_UI -->|"applies"| FE_Styles
    FE_UI -->|"loads"| FE_Assets

    FE_UI -->|"APIRequest"| BE_Server
    BE_Server -->|"invokes"| BE_Controllers
    BE_Server -->|"invokes"| BE_Models

    BE_Server -->|"uses"| BE_Config
    BE_Config -->|"connectsTo"| DB
    BE_Controllers -->|"CRUDOps"| DB
    BE_Models -->|"definesSchemaFor"| DB

    FE_Styles -->|"uses"| ER["External Resources: Font Awesome, Material Icons, Google Fonts"]:::external

    click FE_Components "https://github.com/srikanth-vnts/urban_company_clone/tree/master/frontend/src/components"
    click FE_Contexts "https://github.com/srikanth-vnts/urban_company_clone/tree/master/frontend/src/contexts"
    click FE_Store "https://github.com/srikanth-vnts/urban_company_clone/tree/master/frontend/src/store"
    click FE_Styles "https://github.com/srikanth-vnts/urban_company_clone/tree/master/frontend/src/styles"
    click FE_Assets "https://github.com/srikanth-vnts/urban_company_clone/tree/master/frontend/public"
    click BE_Server "https://github.com/srikanth-vnts/urban_company_clone/blob/master/backend/src/server.js"
    click BE_Config "https://github.com/srikanth-vnts/urban_company_clone/blob/master/backend/src/config/connectionDb.js"
    click BE_Controllers "https://github.com/srikanth-vnts/urban_company_clone/tree/master/backend/src/controllers"
    click BE_Models "https://github.com/srikanth-vnts/urban_company_clone/tree/master/backend/src/models"

    classDef frontend fill:#a5d6a7,stroke:#388e3c,stroke-width:2px;
    classDef backend fill:#90caf9,stroke:#1565c0,stroke-width:2px;
    classDef database fill:#ffe082,stroke:#f9a825,stroke-width:2px;
    classDef external fill:#f48fb1,stroke:#ad1457,stroke-width:2px;
```
