# roh0308/rohit_petpooja architecture

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

- Interactive diagram: https://gitdiagram.com/roh0308/rohit_petpooja
- Repository: https://github.com/roh0308/rohit_petpooja

## Overview

##### Project type and purpose
- From the file tree and README, this is the **backend** portion of a full-stack restaurant management application (“PetPooja”).
- Features: session-based table order tracking, real-time inventory management, sales dashboard, bill generation, menu CRUD.
- There is a separate frontend (started via `npm run dev` on port 3000) that calls this backend (port 3001).

##### File structure
- Top-level:
- app.js – entry point, sets up Express server and middleware
- config/db.js – database connection logic
- routes/ – Express route modules:
– billingRoutes.js
– dashboardRoutes.js
– menuRoutes.js
– tableRoutes.js
- package.json / lock – dependencies (likely Express, database driver, maybe socket.io)
- No controllers/services directory, but routes folder suggests an MVC‐style pattern (routes → controllers → DB).

##### README for additional insights
- We know the backend exposes REST endpoints consumed by a frontend.
- Database (SQL or NoSQL) holds tables for menu, orders, sessions, inventory.

##### Emphasize
- Every logical component (UI, API, DB, real-time layer).
- Data flow direction clearly.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["User Browser"]:::external
    B["Frontend App (port 3000)\n(Menu CRUD, Table Session UI, Dashboard Views)"]:::frontend
    A -->|HTTP| B

    subgraph "Backend"
        direction TB
        API["Express API Server\n(port 3001)"]:::backend
        subgraph "Routes"
            MR["menuRoutes"]:::backend
            TR["tableRoutes"]:::backend
            BR["billingRoutes"]:::backend
            DR["dashboardRoutes"]:::backend
        end
        CS["Controllers/Services"]:::backend
        DBConfig["Database Connection\n(config/db.js)"]:::backend
    end

    B -->|REST calls| API
    API --> MR
    API --> TR
    API --> BR
    API --> DR
    API --> CS
    API --> DBConfig

    C["Database\n(Menus, Orders, Sessions, Inventory, Bills)"]:::db
    API -->|CRUD queries| C
    API -.->|WebSocket events| B

    subgraph "Project Files"
        PJ["package.json"]:::file
        PL["package-lock.json"]:::file
        GI[".gitignore"]:::file
        RD["README.md"]:::file
    end

    click API "https://github.com/roh0308/rohit_petpooja/blob/main/app.js"
    click DBConfig "https://github.com/roh0308/rohit_petpooja/blob/main/config/db.js"
    click MR "https://github.com/roh0308/rohit_petpooja/blob/main/routes/menuRoutes.js"
    click TR "https://github.com/roh0308/rohit_petpooja/blob/main/routes/tableRoutes.js"
    click BR "https://github.com/roh0308/rohit_petpooja/blob/main/routes/billingRoutes.js"
    click DR "https://github.com/roh0308/rohit_petpooja/blob/main/routes/dashboardRoutes.js"
    click PJ "https://github.com/roh0308/rohit_petpooja/blob/main/package.json"
    click PL "https://github.com/roh0308/rohit_petpooja/blob/main/package-lock.json"
    click GI "https://github.com/roh0308/rohit_petpooja/blob/main/.gitignore"
    click RD "https://github.com/roh0308/rohit_petpooja/blob/main/README.md"

    classDef frontend fill:#f9c74f,stroke:#000,stroke-width:1px;
    classDef backend fill:#577590,stroke:#000,stroke-width:1px,color:#fff;
    classDef db fill:#90be6d,stroke:#000,stroke-width:1px;
    classDef external fill:#adb5bd,stroke:#000,stroke-width:1px;
    classDef file fill:#bde0fe,stroke:#000,stroke-width:1px;
```
