# arifuzzaman31/ryserve-node architecture

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

- Interactive diagram: https://gitdiagram.com/arifuzzaman31/ryserve-node
- Repository: https://github.com/arifuzzaman31/ryserve-node

## Overview

##### Detailed Component Breakdown

a) API Routes (3 main routes):
- Admin Routes (/admin)
- Auth Routes (/auth)
- User Routes (/user)

b) Controller Layer (Show two main sections):
- Frontend Controllers
- Auth
- Booking
- SubassetComp
- WishList
- Backend Controllers
- Business
- Asset/Subasset
- Booking
- Dashboard
- Role Management
- Table Management

c) Service Layer:
- Authentication Service
- Owner Service
- User Service

d) Data Layer:
- Prisma ORM
- PostgreSQL Database

##### Interaction Flows

- Client → API Routes
- Routes → Controllers
- Controllers → Services
- Services → Prisma ORM
- Prisma → PostgreSQL

##### Middleware Layer (Horizontal)
- AdminMiddleware as a cross-cutting concern
- Authentication/authorization flow

##### Additional Elements

a) Environment Configuration:
- .env configuration influence
- Deployment workflow (.github/workflows)

b) Helper Utilities:
- Helper functions as a utility layer

Specific Considerations:

##### Database Schema
- A simplified view of the Prisma schema showing key entities:
- Users
- Assets/Subassets
- Bookings
- Amenities
- Tables
- Business

##### Authentication Flow
- Auth flow separately
- Token-based authentication process

##### Booking System
- Booking workflow
- Interaction between frontend and backend controllers

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CL[Client Layer]
    end

    subgraph "API Routes"
        AR["/admin"]:::route
        AUR["/auth"]:::route
        UR["/user"]:::route
    end

    subgraph "Frontend Controllers"
        AC["Auth Controller"]:::controller
        BC["Booking Controller"]:::controller
        SC["SubassetComp Controller"]:::controller
        WC["WishList Controller"]:::controller
    end

    subgraph "Backend Controllers"
        BUC["Business Controller"]:::controller
        ASC["Asset Controller"]:::controller
        SSC["Subasset Controller"]:::controller
        BKC["Booking Controller"]:::controller
        DC["Dashboard Controller"]:::controller
        RC["Role Management"]:::controller
        TC["Table Management"]:::controller
    end

    subgraph "Service Layer"
        AS["Authentication Service"]:::service
        OS["Owner Service"]:::service
        US["User Service"]:::service
    end

    subgraph "Data Layer"
        PR["Prisma ORM"]:::data
        DB[(PostgreSQL)]:::database
    end

    subgraph "Middleware"
        AM["Admin Middleware"]:::middleware
    end

    subgraph "Utilities"
        HF["Helper Functions"]:::utility
    end

    %% Connections
    CL --> AR & AUR & UR
    AR & AUR & UR --> AM
    AM --> AC & BC & SC & WC
    AM --> BUC & ASC & SSC & BKC & DC & RC & TC
    AC & BC & SC & WC --> AS & OS & US
    BUC & ASC & SSC & BKC & DC & RC & TC --> AS & OS & US
    AS & OS & US --> PR
    PR --> DB

    %% Click Events
    click AR "https://github.com/arifuzzaman31/ryserve-node/blob/master/router/admin.js"
    click AUR "https://github.com/arifuzzaman31/ryserve-node/blob/master/router/authRoute.js"
    click UR "https://github.com/arifuzzaman31/ryserve-node/blob/master/router/user.js"
    click AC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/frontend/auth.js"
    click BC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/frontend/booking.js"
    click SC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/frontend/subassetcomp.js"
    click WC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/frontend/wishList.js"
    click BUC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/business.js"
    click ASC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/asset.js"
    click SSC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/subasset.js"
    click BKC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/booking.js"
    click DC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/dashboard.js"
    click RC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/role.js"
    click TC "https://github.com/arifuzzaman31/ryserve-node/blob/master/controller/backend/table.js"
    click AS "https://github.com/arifuzzaman31/ryserve-node/blob/master/services/auth.js"
    click OS "https://github.com/arifuzzaman31/ryserve-node/blob/master/services/ownerService.js"
    click US "https://github.com/arifuzzaman31/ryserve-node/blob/master/services/userService.js"
    click PR "https://github.com/arifuzzaman31/ryserve-node/blob/master/db/prisma.js"
    click DB "https://github.com/arifuzzaman31/ryserve-node/blob/master/prisma/schema.prisma"
    click AM "https://github.com/arifuzzaman31/ryserve-node/blob/master/middleware/adminMiddleware.js"
    click HF "https://github.com/arifuzzaman31/ryserve-node/blob/master/helper/helper.js"

    %% Styles
    classDef route fill:#6495ED,stroke:#333,stroke-width:2px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:2px
    classDef service fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef data fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef database fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef middleware fill:#FFD700,stroke:#333,stroke-width:2px
    classDef utility fill:#F0E68C,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[API Routes]:::route
        L2[Controllers]:::controller
        L3[Services]:::service
        L4[Data Layer]:::data
        L5[Middleware]:::middleware
        L6[Utilities]:::utility
    end
```
