# danyalbabar/myhousekeeper architecture

> Architecture diagram of the GitHub repository danyalbabar/myhousekeeper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danyalbabar/myhousekeeper
- Repository: https://github.com/danyalbabar/myhousekeeper

## Overview

##### Main Components

A. Frontend Layer (React Application)
- User Interface Components
- Authentication Context
- Service Layer
- Page Routes

B. Backend Layer (Express/Node.js)
- API Routes
- Controllers
- Data Access Objects (DAO)

C. Database Layer (MongoDB)

D. Authentication System (implied by the auth-related components)

##### Component Relationships

- Frontend Services → Backend API Routes
- API Routes → Controllers
- Controllers → DAO Layer
- DAO Layer → MongoDB

##### Special Features to Highlight

Authentication Flow:
- AuthContext provider at the top level
- Protected routes
- Authentication service connections

Feature Modules:
- House Management
- Chore Management
- Expense Management
- User Management

##### Specific Implementation Details

Frontend Structure:
**React App**
- Components
- House Management
- Modal System
- Authentication
- Services
- House Service
- User Service
- Context
- Auth Context

Backend Structure:
**Express Server**
- API Routes
- Houses
- Users
- Controllers
- DAO Layer

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        App["React App"]:::frontend
        AuthContext["Auth Context"]:::auth
        ServiceLayer["Service Layer"]:::frontend
        UI["UI Components"]:::frontend
        PrivRoute["Private Route"]:::auth
        
        subgraph UIComponents
            House["House Management"]:::frontend
            Chores["Chore Management"]:::frontend
            Expenses["Expense Management"]:::frontend
            Modals["Modal System"]:::frontend
        end
        
        subgraph Services
            HouseService["House Service"]:::frontend
            UserService["User Service"]:::frontend
        end
    end
    
    subgraph Backend
        Server["Express Server"]:::backend
        
        subgraph APIRoutes
            HouseRoutes["Houses Routes"]:::api
            UserRoutes["Users Routes"]:::api
        end
        
        subgraph Controllers
            HouseController["Houses Controller"]:::controller
            UserController["Users Controller"]:::controller
        end
        
        subgraph DAOLayer
            HouseDAO["Houses DAO"]:::dao
            UserDAO["Users DAO"]:::dao
        end
    end
    
    Database[(MongoDB)]:::database
    
    %% Frontend Relationships
    App --> AuthContext
    App --> UI
    App --> ServiceLayer
    App --> PrivRoute
    UI --> House
    UI --> Chores
    UI --> Expenses
    UI --> Modals
    ServiceLayer --> HouseService
    ServiceLayer --> UserService
    
    %% Backend Relationships
    Server --> APIRoutes
    HouseRoutes --> HouseController
    UserRoutes --> UserController
    HouseController --> HouseDAO
    UserController --> UserDAO
    HouseDAO --> Database
    UserDAO --> Database
    
    %% Cross-layer Communication
    HouseService --> HouseRoutes
    UserService --> UserRoutes
    
    %% Click Events
    click App "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/App.js"
    click AuthContext "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/contexts/AuthContext.js"
    click ServiceLayer "https://github.com/DanyalBabar/myHouseKeeper/tree/main/frontend/src/services/"
    click PrivRoute "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/components/PrivateRoute.js"
    click House "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/components/House/House.js"
    click Chores "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/components/House/Chore.js"
    click Expenses "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/components/House/Expense.js"
    click Modals "https://github.com/DanyalBabar/myHouseKeeper/tree/main/frontend/src/components/House/HouseModals/"
    click HouseRoutes "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/api/houses/houses.route.js"
    click UserRoutes "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/api/users/users.route.js"
    click HouseController "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/api/houses/houses.controller.js"
    click UserController "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/api/users/users.controller.js"
    click HouseDAO "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/dao/housesDAO.js"
    click UserDAO "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/dao/usersDAO.js"
    click Server "https://github.com/DanyalBabar/myHouseKeeper/blob/main/backend/server.js"
    click HouseService "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/services/houses.js"
    click UserService "https://github.com/DanyalBabar/myHouseKeeper/blob/main/frontend/src/services/user.js"
    
    %% Styling
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef auth fill:#FF5722,color:white
    classDef api fill:#FFC107,color:black
    classDef controller fill:#9C27B0,color:white
    classDef dao fill:#FF9800,color:black
    classDef database fill:#607D8B,color:white
```
