How chauhan-yuvraj/workplace-management-system works
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: DashboardLayout.tsx Dashboard screens · meeting.routes.ts Domain routes · services/api.ts API service clients · services/api.ts API service clients
Components 21
Admin Web
- Vite entry
apps/Web/src/main.tsx - App shell & router
apps/Web/src/App.tsx - Dashboard screens
apps/Web/src/components/layout/DashboardLayout.tsx - Meeting wizard
apps/Web/src/components/Meeting/MeetingModal.tsx - Redux state
apps/Web/src/store/store.ts - API service clients
apps/Web/src/services/api.ts - Permission guard
apps/Web/src/components/auth/PermissionGuard.tsx
Expo Kiosk
- Expo Router hierarchy
apps/Mobile/app/_layout.tsx - Guest & feedback flow
apps/Mobile/app/(guest)/selectVisit.tsx - Feedback media capture
apps/Mobile/components/SignatureCanvas.tsx - Redux state
apps/Mobile/store/store.ts - API service clients
apps/Mobile/services/api.ts
Backend API
- Express server
apps/backend/src/server.ts - Express app
apps/backend/src/app.ts - Domain routes · Auth, meetings, visitors, visits, and other operations.
apps/backend/src/routes/meeting.routes.ts - JWT auth
apps/backend/src/middleware/auth.middleware.ts - Mongoose domain models · Employees, visitors, visits, meetings, availability, deliveries, and feedback.
apps/backend/src/models/meeting.model.ts - Upload pipeline
apps/backend/src/middleware/multer.middleware.ts
Shared & External
- Shared domain contracts
packages/types/src/index.ts - MongoDB
- Cloudinary
Connections 23
- 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