# sarthakray26/mployeecheck-assignment architecture

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

- Interactive diagram: https://gitdiagram.com/sarthakray26/mployeecheck-assignment
- Repository: https://github.com/sarthakray26/mployeecheck-assignment

## Overview

MployCheck is an employee background-verification portal. Users sign in, then view dashboard statistics or search and filter verification records; administrators additionally manage user accounts. The Angular SPA calls an Express API, whose controllers handle authentication, record queries, and user CRUD against MongoDB. Dashboard charts, recent activity, role-based access, pagination, and theme/notification services are documented capabilities; where their implementation was not sampled, links reflect documented responsibilities rather than detailed internals.

Main entry points: [`client/src/app/layouts/main-layout/main-layout.component.ts`](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/layouts/main-layout/main-layout.component.ts) (Main layout), [`server/index.js`](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/index.js) (Express server), [`client/src/app/services/auth.service.ts`](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/auth.service.ts) (Auth service), [`server/routes/authRoutes.js`](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/authRoutes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular portal"]
  node_login["Login screen<br/>[login.component.ts]"]
  node_layout["Main layout"]
  node_dashboard["Dashboard"]
  node_records_view["Records table"]
  node_admin_view["Admin panel<br/>[admin.component.ts]"]
end

subgraph group_auth["Authentication and access"]
  node_auth_service["Auth service<br/>[auth.service.ts]"]
  node_user_service["User service<br/>[user.service.ts]"]
  node_guards["Route guards"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
  node_auth_middleware["JWT middleware<br/>[auth.js]"]
end

subgraph group_records["Verification records"]
  node_record_service["Record service<br/>[record.service.ts]"]
  node_record_routes["Record routes<br/>[recordRoutes.js]"]
  node_record_controller["Record controller"]
  node_record_model[("Record collection<br/>[Record.js]")]
end

subgraph group_backend["API and persistence"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
  node_user_controller["User controller<br/>[userController.js]"]
  node_user_model[("User collection<br/>[User.js]")]
  node_server["Express server<br/>[index.js]"]
end

node_user(("Portal user"))
node_mongo[("MongoDB")]

node_user -->|"signs in"| node_login
node_user -->|"uses portal"| node_layout
node_login -->|"submits credentials"| node_auth_service
node_auth_service -->|"sends login/profile requests"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"protects profile"| node_auth_middleware
node_auth_controller -->|"reads and updates"| node_user_model
node_auth_service -->|"provides session"| node_layout
node_layout -->|"routes access"| node_guards
node_layout -->|"navigates to"| node_dashboard
node_layout -->|"navigates to"| node_records_view
node_layout -->|"navigates to"| node_admin_view
node_guards -->|"checks session and role"| node_auth_service
node_dashboard -->|"requests statistics"| node_record_service
node_records_view -->|"requests filtered records"| node_record_service
node_record_service -->|"sends records requests"| node_record_routes
node_record_routes -->|"protects requests"| node_auth_middleware
node_record_routes -->|"dispatches"| node_record_controller
node_record_controller -->|"queries and aggregates"| node_record_model
node_admin_view -->|"manages users"| node_user_service
node_user_service -->|"sends user requests"| node_user_routes
node_user_routes -->|"authenticates"| node_auth_middleware
node_user_routes -->|"dispatches"| node_user_controller
node_user_controller -->|"reads and changes"| node_user_model
node_server -->|"mounts auth API"| node_auth_routes
node_server -->|"mounts user API"| node_user_routes
node_server -->|"mounts records API"| node_record_routes
node_server -->|"connects through config/db.js"| node_mongo
node_user_model -->|"persists users"| node_mongo
node_record_model -->|"persists records"| node_mongo

click node_login "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/auth/login/login.component.ts"
click node_layout "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/layouts/main-layout/main-layout.component.ts"
click node_dashboard "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/dashboard/dashboard.component.ts"
click node_records_view "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/records/records.component.ts"
click node_admin_view "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/admin/admin.component.ts"
click node_auth_service "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/auth.service.ts"
click node_user_service "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/user.service.ts"
click node_record_service "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/record.service.ts"
click node_guards "https://github.com/sarthakray26/mployeecheck-assignment/tree/main/client/src/app/guards"
click node_auth_routes "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/authRoutes.js"
click node_auth_controller "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/controllers/authController.js"
click node_auth_middleware "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/middleware/auth.js"
click node_user_routes "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/userRoutes.js"
click node_user_controller "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/controllers/userController.js"
click node_record_routes "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/recordRoutes.js"
click node_record_controller "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/controllers/recordController.js"
click node_user_model "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/models/User.js"
click node_record_model "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/models/Record.js"
click node_server "https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/index.js"

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_login,node_layout,node_dashboard,node_records_view,node_admin_view,node_user toneBlue
class node_auth_service,node_user_service,node_guards,node_auth_routes,node_auth_controller,node_auth_middleware,node_mongo toneAmber
class node_record_service,node_record_routes,node_record_controller,node_record_model toneMint
class node_user_routes,node_user_controller,node_user_model,node_server toneRose
```

## Components

### Angular portal

- [Login screen](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/auth/login/login.component.ts): `client/src/app/auth/login/login.component.ts`
- [Main layout](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/layouts/main-layout/main-layout.component.ts): `client/src/app/layouts/main-layout/main-layout.component.ts`
- [Dashboard](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/dashboard/dashboard.component.ts): `client/src/app/dashboard/dashboard.component.ts`
- [Records table](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/records/records.component.ts): `client/src/app/records/records.component.ts`
- [Admin panel](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/admin/admin.component.ts): `client/src/app/admin/admin.component.ts`

### Authentication and access

- [Auth service](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/auth.service.ts): `client/src/app/services/auth.service.ts`
- [User service](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/user.service.ts): `client/src/app/services/user.service.ts`
- [Route guards](https://github.com/sarthakray26/mployeecheck-assignment/tree/main/client/src/app/guards): `client/src/app/guards`
- [Auth routes](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Auth controller](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [JWT middleware](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/middleware/auth.js): `server/middleware/auth.js`

### Verification records

- [Record service](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/client/src/app/services/record.service.ts): `client/src/app/services/record.service.ts`
- [Record routes](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/recordRoutes.js): `server/routes/recordRoutes.js`
- [Record controller](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/controllers/recordController.js): `server/controllers/recordController.js`
- [Record collection](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/models/Record.js): `server/models/Record.js`

### API and persistence

- [User routes](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/routes/userRoutes.js): `server/routes/userRoutes.js`
- [User controller](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/controllers/userController.js): `server/controllers/userController.js`
- [User collection](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/models/User.js): `server/models/User.js`
- [Express server](https://github.com/sarthakray26/mployeecheck-assignment/blob/main/server/index.js): `server/index.js`

### Other components

- **Portal user**
- **MongoDB**

## Connections

- Portal user → Login screen: signs in
- Portal user → Main layout: uses portal
- Login screen → Auth service: submits credentials
- Auth service → Auth routes: sends login/profile requests
- Auth routes → Auth controller: dispatches
- Auth routes → JWT middleware: protects profile
- Auth controller → User collection: reads and updates
- Auth service → Main layout: provides session
- Main layout → Route guards: routes access
- Main layout → Dashboard: navigates to
- Main layout → Records table: navigates to
- Main layout → Admin panel: navigates to
- Route guards → Auth service: checks session and role
- Dashboard → Record service: requests statistics
- Records table → Record service: requests filtered records
- Record service → Record routes: sends records requests
- Record routes → JWT middleware: protects requests
- Record routes → Record controller: dispatches
- Record controller → Record collection: queries and aggregates
- Admin panel → User service: manages users
- User service → User routes: sends user requests
- User routes → JWT middleware: authenticates
- User routes → User controller: dispatches
- User controller → User collection: reads and changes
- Express server → Auth routes: mounts auth API
- Express server → User routes: mounts user API
- Express server → Record routes: mounts records API
- Express server → MongoDB: connects through config/db.js
- User collection → MongoDB: persists users
- Record collection → MongoDB: persists records
