# sakshi-rathi-work/shiftsync-mern architecture

> Architecture diagram of the GitHub repository sakshi-rathi-work/shiftsync-mern, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sakshi-rathi-work/shiftsync-mern
- Repository: https://github.com/sakshi-rathi-work/shiftsync-mern

## Overview

ShiftSync is a multi-tenant workforce scheduling platform. Managers build and publish weekly rosters, while employees view shifts and submit leave or swap requests; managers review those requests. The backend also supports labor-rule compliance, conflict checks, audit history, notifications, team and user administration, and dashboard views. The frontend calls the Express API through a shared client, and the backend uses Prisma-backed MySQL plus optional Redis. Some feature wiring is documented in the README but its implementation was not sampled, so those links are intentionally omitted.

Main entry points: [`backend/src/index.ts`](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/index.ts) (Express application), [`frontend/app/(app)/layout.tsx`](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/layout.tsx) (ShiftSync UI), [`frontend/lib/api-client.ts`](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/lib/api-client.ts) (API client), [`backend/src/routes/authRoutes.ts`](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/routes/authRoutes.ts) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web["ShiftSync UI<br/>[layout.tsx]"]
  node_roster_ui["Roster builder<br/>[page.tsx]"]
  node_leave_ui["Leave requests<br/>[page.tsx]"]
  node_swaps_ui["Swap requests<br/>[page.tsx]"]
  node_api_client["API client<br/>[api-client.ts]"]
end

subgraph group_api["API and identity"]
  node_server["Express application<br/>[index.ts]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.ts]"]
  node_auth_service["Authentication service<br/>[authService.ts]"]
  node_auth_middleware["Authentication middleware<br/>[authenticate.ts]"]
end

subgraph group_scheduling["Scheduling and compliance"]
  node_roster_routes["Roster routes<br/>[rosterRoutes.ts]"]
  node_roster_controller["Roster controller"]
  node_roster_service["Roster service<br/>[rosterService.ts]"]
  node_rule_engine["Conflict rule engine"]
  node_rule_strategies["Detection strategies"]
  node_labor_api["Labor rules"]
end

subgraph group_workforce["Workforce workflows"]
  node_leave_api["Leave workflow<br/>[leaveController.ts]"]
  node_swap_api["Swap workflow<br/>[swapController.ts]"]
  node_teams_api["Teams and users<br/>[teamsController.ts]"]
end

subgraph group_platform["Persistence and operations"]
  node_audit_api["Audit history"]
  node_notifications_api["Notifications"]
  node_dashboard_api["Dashboard"]
  node_roster_store["Roster and shifts"]
  node_users_store["User records<br/>[userRepository.ts]"]
  node_prisma["Prisma database access<br/>[prisma.ts]"]
  node_mysql[("MySQL")]
  node_redis[("Redis<br/>[redis.ts]")]
end

node_employee(("Employee"))
node_manager(("Operations manager"))

node_employee -->|"uses"| node_web
node_manager -->|"uses"| node_web
node_web -->|"opens"| node_roster_ui
node_web -->|"opens"| node_leave_ui
node_web -->|"opens"| node_swaps_ui
node_roster_ui -->|"requests data"| node_api_client
node_leave_ui -->|"requests data"| node_api_client
node_swaps_ui -->|"requests data"| node_api_client
node_api_client -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_roster_routes
node_server -->|"mounts"| node_leave_api
node_server -->|"mounts"| node_swap_api
node_server -->|"mounts"| node_teams_api
node_server -->|"mounts"| node_labor_api
node_server -->|"mounts"| node_audit_api
node_server -->|"mounts"| node_notifications_api
node_server -->|"mounts"| node_dashboard_api
node_auth_routes -->|"delegates"| node_auth_service
node_auth_routes -->|"protects routes"| node_auth_middleware
node_auth_service -->|"reads and updates"| node_users_store
node_roster_routes -->|"dispatches"| node_roster_controller
node_roster_controller -->|"delegates"| node_roster_service
node_roster_service -->|"accesses roster data"| node_roster_store
node_rule_engine -->|"runs checks"| node_rule_strategies
node_roster_store -->|"queries"| node_prisma
node_users_store -->|"queries"| node_prisma
node_prisma -->|"reads and writes"| node_mysql
node_server -.->|"rate limits"| node_redis

click node_web "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/layout.tsx"
click node_roster_ui "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/roster/page.tsx"
click node_leave_ui "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/leave-requests/page.tsx"
click node_swaps_ui "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/swap-requests/page.tsx"
click node_api_client "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/lib/api-client.ts"
click node_server "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/index.ts"
click node_auth_routes "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/routes/authRoutes.ts"
click node_auth_service "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/services/authService.ts"
click node_auth_middleware "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/middleware/authenticate.ts"
click node_roster_routes "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/routes/rosterRoutes.ts"
click node_roster_controller "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/rosterController.ts"
click node_roster_service "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/services/rosterService.ts"
click node_rule_engine "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/services/ruleEngineService.ts"
click node_rule_strategies "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/rules/ConflictDetectionStrategy.ts"
click node_leave_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/leaveController.ts"
click node_swap_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/swapController.ts"
click node_teams_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/teamsController.ts"
click node_labor_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/laborRuleController.ts"
click node_audit_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/auditLogController.ts"
click node_notifications_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/notificationController.ts"
click node_dashboard_api "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/dashboardController.ts"
click node_roster_store "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/db/rosterRepository.ts"
click node_users_store "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/db/userRepository.ts"
click node_prisma "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/config/prisma.ts"
click node_redis "https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/config/redis.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,node_roster_ui,node_leave_ui,node_swaps_ui,node_api_client toneBlue
class node_server,node_auth_routes,node_auth_service,node_auth_middleware toneAmber
class node_roster_routes,node_roster_controller,node_roster_service,node_rule_engine,node_rule_strategies,node_labor_api toneMint
class node_leave_api,node_swap_api,node_teams_api toneRose
class node_audit_api,node_notifications_api,node_dashboard_api,node_roster_store,node_users_store,node_prisma,node_mysql,node_redis,node_employee,node_manager toneIndigo
```

## Components

### Web application

- [ShiftSync UI](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/layout.tsx): `frontend/app/(app)/layout.tsx`
- [Roster builder](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/roster/page.tsx): `frontend/app/(app)/roster/page.tsx`
- [Leave requests](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/leave-requests/page.tsx): `frontend/app/(app)/leave-requests/page.tsx`
- [Swap requests](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/app/(app)/swap-requests/page.tsx): `frontend/app/(app)/swap-requests/page.tsx`
- [API client](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/frontend/lib/api-client.ts): `frontend/lib/api-client.ts`

### API and identity

- [Express application](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Authentication routes](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Authentication service](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/services/authService.ts): `backend/src/services/authService.ts`
- [Authentication middleware](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/middleware/authenticate.ts): `backend/src/middleware/authenticate.ts`

### Scheduling and compliance

- [Roster routes](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/routes/rosterRoutes.ts): `backend/src/routes/rosterRoutes.ts`
- [Roster controller](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/rosterController.ts): `backend/src/controllers/rosterController.ts`
- [Roster service](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/services/rosterService.ts): `backend/src/services/rosterService.ts`
- [Conflict rule engine](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/services/ruleEngineService.ts): `backend/src/services/ruleEngineService.ts`
- [Detection strategies](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/rules/ConflictDetectionStrategy.ts): `backend/src/rules/ConflictDetectionStrategy.ts`
- [Labor rules](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/laborRuleController.ts): `backend/src/controllers/laborRuleController.ts`

### Workforce workflows

- [Leave workflow](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/leaveController.ts): `backend/src/controllers/leaveController.ts`
- [Swap workflow](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/swapController.ts): `backend/src/controllers/swapController.ts`
- [Teams and users](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/teamsController.ts): `backend/src/controllers/teamsController.ts`

### Persistence and operations

- [Audit history](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/auditLogController.ts): `backend/src/controllers/auditLogController.ts`
- [Notifications](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/notificationController.ts): `backend/src/controllers/notificationController.ts`
- [Dashboard](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/controllers/dashboardController.ts): `backend/src/controllers/dashboardController.ts`
- [Roster and shifts](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/db/rosterRepository.ts): `backend/src/db/rosterRepository.ts`
- [User records](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/db/userRepository.ts): `backend/src/db/userRepository.ts`
- [Prisma database access](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/config/prisma.ts): `backend/src/config/prisma.ts`
- **MySQL**
- [Redis](https://github.com/sakshi-rathi-work/shiftsync-mern/blob/main/backend/src/config/redis.ts): `backend/src/config/redis.ts`

### Other components

- **Employee**
- **Operations manager**

## Connections

- Employee → ShiftSync UI: uses
- Operations manager → ShiftSync UI: uses
- ShiftSync UI → Roster builder: opens
- ShiftSync UI → Leave requests: opens
- ShiftSync UI → Swap requests: opens
- Roster builder → API client: requests data
- Leave requests → API client: requests data
- Swap requests → API client: requests data
- API client → Express application: HTTP requests
- Express application → Authentication routes: mounts
- Express application → Roster routes: mounts
- Express application → Leave workflow: mounts
- Express application → Swap workflow: mounts
- Express application → Teams and users: mounts
- Express application → Labor rules: mounts
- Express application → Audit history: mounts
- Express application → Notifications: mounts
- Express application → Dashboard: mounts
- Authentication routes → Authentication service: delegates
- Authentication routes → Authentication middleware: protects routes
- Authentication service → User records: reads and updates
- Roster routes → Roster controller: dispatches
- Roster controller → Roster service: delegates
- Roster service → Roster and shifts: accesses roster data
- Conflict rule engine → Detection strategies: runs checks
- Roster and shifts → Prisma database access: queries
- User records → Prisma database access: queries
- Prisma database access → MySQL: reads and writes
- Express application → Redis: rate limits
