# chauhan-yuvraj/workplace-management-system architecture

> Architecture diagram of the GitHub repository chauhan-yuvraj/workplace-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chauhan-yuvraj/workplace-management-system
- Repository: https://github.com/chauhan-yuvraj/workplace-management-system

## Overview

#### Purpose and topology
Workplace Management System is a pnpm/Turborepo monorepo for workplace operations: visitor/visit handling, employee and department administration, deliveries, records, meetings/availability, and kiosk feedback. It has three deployable applications: an Express API, a Vite admin dashboard, and an Expo kiosk/mobile client. Shared domain contracts reside in `packages/types/src/index.ts` and related type modules; reusable UI is minimal under `packages/ui/src/`.

#### Backend API and persistence
The Node/Express server starts through `apps/backend/src/server.ts`, composes middleware/routes in `apps/backend/src/app.ts`, and connects to MongoDB via Mongoose in `apps/backend/src/config/db.ts`. Route modules define the API boundary and delegate to controllers, e.g. `apps/backend/src/routes/meeting.routes.ts`, `apps/backend/src/routes/visitor.routes.ts`, and `apps/backend/src/routes/visits.routes.ts`. Persistent domain models cover employees, visitors, visits, meetings, availability, departments, deliveries, projects, schedules, organizations, and feedback, e.g. `apps/backend/src/models/meeting.model.ts`, `apps/backend/src/models/visitor.model.ts`, `apps/backend/src/models/visits.model.ts`.

#### Security, uploads, and integrations
Authentication is JWT/bcrypt-based: `apps/backend/src/routes/Auth.routes.ts`, `apps/backend/src/controllers/Auth.controller.ts`, and `apps/backend/src/middleware/auth.middleware.ts`. Multipart/file handling is isolated in `apps/backend/src/middleware/multer.middleware.ts`; Cloudinary integration is encapsulated by `apps/backend/src/utils/cloudinary.ts`. MongoDB and Cloudinary are required external services; API consumers configure its base URL with `VITE_API_URL` or `EXPO_PUBLIC_API_URL`.

#### Web admin dashboard
The browser client enters at `apps/Web/src/main.tsx`, renders the application shell from `apps/Web/src/App.tsx`, and declares navigation in `apps/Web/src/router.tsx`. Authenticated management screens are organized beneath the dashboard layout: `apps/Web/src/components/layout/DashboardLayout.tsx`, `apps/Web/src/pages/Dashbaord/Dashboard.tsx`, and resource pages such as `apps/Web/src/pages/Dashbaord/Meetings/Meetings.tsx`. Meeting creation is a distinct multi-step availability/time-slot workflow in `apps/Web/src/components/Meeting/MeetingModal.tsx`, `apps/Web/src/components/Meeting/steps/`, and `apps/Web/src/hooks/useMeetingWizard.ts`.

#### Web state and API flow
Web views use feature hooks to fetch/mutate backend resources and Redux Toolkit slices to retain shared client state. The transport boundary is `apps/Web/src/services/api.ts`, with domain clients such as `apps/Web/src/services/meeting.service.ts` and `apps/Web/src/services/visitors.service.ts`. State ownership is centralized by `apps/Web/src/store/store.ts` and slices including `apps/Web/src/store/slices/authSlice.ts` and `apps/Web/src/store/slices/visitSlice.ts`. Permission checks are UI-side guarded by `apps/Web/src/components/auth/PermissionGuard.tsx`.

#### Mobile kiosk flow
The Expo Router entry hierarchy begins at `apps/Mobile/app/_layout.tsx` and branches into authentication, guest selection, canvas/feedback, and admin areas: `apps/Mobile/app/(auth)/loginPage.tsx`, `apps/Mobile/app/(guest)/selectVisit.tsx`, and `apps/Mobile/app/(canvas)/Canvas.tsx`. Kiosk feedback can capture drawings/signatures, audio, and images through `apps/Mobile/components/SignatureCanvas.tsx`, `apps/Mobile/components/canvas/AudioRecorderView.tsx`, and `apps/Mobile/components/canvas/ImageAttachment.tsx`; these inputs are submitted through the feedback flow (`apps/Mobile/hooks/useFeedbackSubmit.ts`, `apps/Mobile/services/feedback.service.ts`).

#### Mobile state and synchronization
The mobile client uses Redux Toolkit as its cross-screen state boundary: `apps/Mobile/store/store.ts`, `apps/Mobile/store/slices/auth.slice.ts`, and `apps/Mobile/store/slices/canvas.slice.ts`. Service clients mediate API access (`apps/Mobile/services/api.ts`, `apps/Mobile/services/guest.service.ts`, `apps/Mobile/services/visits.service.ts`), while dashboard hooks coordinate CRUD and refresh behavior for operational entities. React Native/Expo, NativeWind, and React Native Skia are the material mobile runtime/UI stack.

#### End-to-end control flow
Admin web and kiosk/mobile clients authenticate against the API, then invoke domain-specific service modules. Express authentication middleware protects applicable routes; controllers/services perform business operations against Mongoose models; uploads pass through Multer to Cloudinary; responses update client Redux state and feature UI. The architecture is API-mediated synchronization rather than direct client database access.

Main entry points: [`apps/Web/src/components/layout/DashboardLayout.tsx`](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/layout/DashboardLayout.tsx) (Dashboard screens), [`apps/backend/src/routes/meeting.routes.ts`](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/routes/meeting.routes.ts) (Domain routes), [`apps/Web/src/services/api.ts`](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/services/api.ts) (API service clients), [`apps/Mobile/services/api.ts`](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/services/api.ts) (API service clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Admin Web"]
  node_web_entry["Vite entry<br/>web bootstrap<br/>[main.tsx]"]
  node_web_shell["App shell &amp; router<br/>navigation<br/>[App.tsx]"]
  node_web_dashboard["Dashboard screens<br/>management UI"]
  node_meeting_wizard["Meeting wizard<br/>availability workflow<br/>[MeetingModal.tsx]"]
  node_web_state["Redux state<br/>client state<br/>[store.ts]"]
  node_web_services["API service clients<br/>HTTP boundary<br/>[api.ts]"]
  node_permission_guard["Permission guard<br/>UI authorization"]
end

subgraph group_mobile["Expo Kiosk"]
  node_mobile_router["Expo Router hierarchy<br/>mobile navigation<br/>[_layout.tsx]"]
  node_kiosk_flow["Guest &amp; feedback flow<br/>kiosk UI<br/>[selectVisit.tsx]"]
  node_feedback_capture["Feedback media capture<br/>signature, audio, image"]
  node_mobile_state["Redux state<br/>cross-screen state<br/>[store.ts]"]
  node_mobile_services["API service clients<br/>HTTP boundary<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_server["Express server<br/>API runtime<br/>[server.ts]"]
  node_app["Express app<br/>middleware and route composition<br/>[app.ts]"]
  node_routes["Domain routes<br/>API boundary<br/>[meeting.routes.ts]"]
  node_auth["JWT auth<br/>route, controller, middleware<br/>[auth.middleware.ts]"]
  node_domain_models[("Mongoose domain models<br/>persistence model layer<br/>[meeting.model.ts]")]
  node_uploads["Upload pipeline<br/>Multer and Cloudinary"]
end

subgraph group_shared["Shared &amp; External"]
  node_contracts["Shared domain contracts<br/>TypeScript types<br/>[index.ts]"]
  node_mongodb[("MongoDB<br/>external database")]
  node_cloudinary["Cloudinary<br/>external media service"]
end

node_web_entry -->|"renders"| node_web_shell
node_web_shell -->|"navigates"| node_web_dashboard
node_web_dashboard -->|"guards views"| node_permission_guard
node_web_dashboard -->|"opens"| node_meeting_wizard
node_web_dashboard -->|"reads and updates"| node_web_state
node_meeting_wizard -->|"submits availability"| node_web_services
node_web_state -->|"drives mutations"| node_web_services
node_mobile_router -->|"routes to"| node_kiosk_flow
node_kiosk_flow -->|"captures feedback"| node_feedback_capture
node_kiosk_flow -->|"reads and updates"| node_mobile_state
node_feedback_capture -->|"submits media"| node_mobile_services
node_mobile_state -->|"drives API actions"| node_mobile_services
node_web_services -->|"VITE_API_URL"| node_server
node_mobile_services -->|"EXPO_PUBLIC_API_URL"| node_server
node_server -->|"starts"| node_app
node_app -->|"mounts"| node_routes
node_routes -->|"protects applicable routes"| node_auth
node_routes -->|"delegates operations"| node_domain_models
node_routes -->|"handles multipart"| node_uploads
node_uploads -->|"stores media"| node_cloudinary
node_domain_models -->|"persists via Mongoose"| node_mongodb
node_web_services -.->|"uses contracts"| node_contracts
node_mobile_services -.->|"uses contracts"| node_contracts

click node_web_entry "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/main.tsx"
click node_web_shell "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/App.tsx"
click node_web_dashboard "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/layout/DashboardLayout.tsx"
click node_meeting_wizard "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/Meeting/MeetingModal.tsx"
click node_web_state "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/store/store.ts"
click node_web_services "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/services/api.ts"
click node_permission_guard "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/auth/PermissionGuard.tsx"
click node_mobile_router "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/app/_layout.tsx"
click node_kiosk_flow "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/app/(guest)/selectVisit.tsx"
click node_feedback_capture "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/components/SignatureCanvas.tsx"
click node_mobile_state "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/store/store.ts"
click node_mobile_services "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/services/api.ts"
click node_server "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/server.ts"
click node_app "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/app.ts"
click node_routes "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/routes/meeting.routes.ts"
click node_auth "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/middleware/auth.middleware.ts"
click node_domain_models "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/models/meeting.model.ts"
click node_uploads "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/middleware/multer.middleware.ts"
click node_contracts "https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/packages/types/src/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_entry,node_web_shell,node_web_dashboard,node_meeting_wizard,node_web_state,node_web_services,node_permission_guard toneBlue
class node_mobile_router,node_kiosk_flow,node_feedback_capture,node_mobile_state,node_mobile_services toneAmber
class node_server,node_app,node_routes,node_auth,node_domain_models,node_uploads toneMint
class node_contracts,node_mongodb,node_cloudinary toneRose
```

## Components

### Admin Web

- [Vite entry](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/main.tsx): web bootstrap · `apps/Web/src/main.tsx`
- [App shell & router](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/App.tsx): navigation · `apps/Web/src/App.tsx`
- [Dashboard screens](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/layout/DashboardLayout.tsx): management UI · `apps/Web/src/components/layout/DashboardLayout.tsx`
- [Meeting wizard](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/Meeting/MeetingModal.tsx): availability workflow · `apps/Web/src/components/Meeting/MeetingModal.tsx`
- [Redux state](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/store/store.ts): client state · `apps/Web/src/store/store.ts`
- [API service clients](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/services/api.ts): HTTP boundary · `apps/Web/src/services/api.ts`
- [Permission guard](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Web/src/components/auth/PermissionGuard.tsx): UI authorization · `apps/Web/src/components/auth/PermissionGuard.tsx`

### Expo Kiosk

- [Expo Router hierarchy](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/app/_layout.tsx): mobile navigation · `apps/Mobile/app/_layout.tsx`
- [Guest & feedback flow](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/app/(guest)/selectVisit.tsx): kiosk UI · `apps/Mobile/app/(guest)/selectVisit.tsx`
- [Feedback media capture](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/components/SignatureCanvas.tsx): signature, audio, image · `apps/Mobile/components/SignatureCanvas.tsx`
- [Redux state](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/store/store.ts): cross-screen state · `apps/Mobile/store/store.ts`
- [API service clients](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/Mobile/services/api.ts): HTTP boundary · `apps/Mobile/services/api.ts`

### Backend API

- [Express server](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/server.ts): API runtime · `apps/backend/src/server.ts`
- [Express app](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/app.ts): middleware and route composition · `apps/backend/src/app.ts`
- [Domain routes](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/routes/meeting.routes.ts): API boundary · Auth, meetings, visitors, visits, and other operations. · `apps/backend/src/routes/meeting.routes.ts`
- [JWT auth](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/middleware/auth.middleware.ts): route, controller, middleware · `apps/backend/src/middleware/auth.middleware.ts`
- [Mongoose domain models](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/models/meeting.model.ts): persistence model layer · Employees, visitors, visits, meetings, availability, deliveries, and feedback. · `apps/backend/src/models/meeting.model.ts`
- [Upload pipeline](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/apps/backend/src/middleware/multer.middleware.ts): Multer and Cloudinary · `apps/backend/src/middleware/multer.middleware.ts`

### Shared & External

- [Shared domain contracts](https://github.com/chauhan-yuvraj/workplace-management-system/blob/main/packages/types/src/index.ts): TypeScript types · `packages/types/src/index.ts`
- **MongoDB**: external database
- **Cloudinary**: external media service

## Connections

- Vite entry → App shell & router: renders
- App shell & router → Dashboard screens: navigates
- Dashboard screens → Permission guard: guards views
- Dashboard screens → Meeting wizard: opens
- Dashboard screens → Redux state: reads and updates
- Meeting wizard → API service clients: submits availability
- Redux state → API service clients: drives mutations
- Expo Router hierarchy → Guest & feedback flow: routes to
- Guest & feedback flow → Feedback media capture: captures feedback
- Guest & feedback flow → Redux state: reads and updates
- Feedback media capture → API service clients: submits media
- Redux state → API service clients: drives API actions
- API service clients → Express server: VITE_API_URL
- API service clients → Express server: EXPO_PUBLIC_API_URL
- Express server → Express app: starts
- Express app → Domain routes: mounts
- Domain routes → JWT auth: protects applicable routes
- Domain routes → Mongoose domain models: delegates operations
- Domain routes → Upload pipeline: handles multipart
- Upload pipeline → Cloudinary: stores media
- Mongoose domain models → MongoDB: persists via Mongoose
- API service clients → Shared domain contracts: uses contracts
- API service clients → Shared domain contracts: uses contracts
