# santhoshkumar-52/zervo architecture

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

- Interactive diagram: https://gitdiagram.com/santhoshkumar-52/zervo
- Repository: https://github.com/santhoshkumar-52/zervo

## Overview

Zervo is a branch-scoped business-management application, with client pages for members, staff, plans, discounts, taxes, attendance, subscriptions, payments, reporting, settings, and login. The supported server workflow is an HTTP request entering the Express app, passing through route registration and role checks where configured, then reaching domain controllers that validate, query or update the database, and format a response. The excerpts establish several controller-to-database and controller-to-schema relationships. Client-to-server page/API wiring and several server integrations are not shown, so those links are omitted.

Main entry points: [`server/src/routes/index.js`](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/index.js) (Route registry), [`server/src/config/knexfile.js`](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/config/knexfile.js) (Knex database), [`server/src/utils/response.js`](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/utils/response.js) (HTTP responses), [`server/src/middleware/auth/authorizeRoles.js`](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/middleware/auth/authorizeRoles.js) (Role authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_client_app["Client entry<br/>[App.jsx]"]
  node_member_ui["Member management"]
  node_staff_ui["Staff management"]
  node_plans_ui["Plans management"]
  node_discount_ui["Discount management"]
  node_tax_ui["Tax management"]
  node_other_ui["Operations pages"]
end

subgraph group_routing["Server routing and access"]
  node_express_app["Express app<br/>[app.js]"]
  node_route_registry["Route registry<br/>[index.js]"]
  node_auth_routes["Authentication routes<br/>[authRoute.js]"]
  node_token_check["Token verification<br/>[tokenverify.js]"]
  node_role_check["Role authorization<br/>[authorizeRoles.js]"]
  node_member_routes["Member routes<br/>[memberRoutes.js]"]
  node_staff_routes["Staff routes<br/>[staffRoutes.js]"]
  node_plan_routes["Plan routes<br/>[planRoutes.js]"]
  node_discount_routes["Discount routes<br/>[discountRoutes.js]"]
  node_tax_routes["Tax routes<br/>[taxRoutes.js]"]
end

subgraph group_domains["Management domains"]
  node_auth_controller["Authentication<br/>[controller.js]"]
  node_member_controller["Member records<br/>[controller.js]"]
  node_member_schema["Member validation<br/>[schema.js]"]
  node_staff_controller["Staff records<br/>[controller.js]"]
  node_staff_schema["Staff validation<br/>[schema.js]"]
  node_plan_controller["Plan records<br/>[controller.js]"]
  node_plan_schema["Plan validation<br/>[schema.js]"]
  node_discount_controller["Discount records<br/>[controller.js]"]
  node_discount_schema["Discount validation<br/>[schema.js]"]
  node_tax_controller["Tax records<br/>[controller.js]"]
  node_tax_schema["Tax validation<br/>[schema.js]"]
end

subgraph group_data["Persistence and responses"]
  node_database[("Knex database<br/>[knexfile.js]")]
  node_connection_config["DB configuration<br/>[connection.js]"]
  node_response["HTTP responses<br/>[response.js]"]
  node_password_hash["Password hashing<br/>[hashhelper.js]"]
end

node_user(("Business user"))

node_express_app -->|"mounts routes"| node_route_registry
node_route_registry -->|"mounts routes"| node_auth_routes
node_route_registry -->|"mounts routes"| node_member_routes
node_route_registry -->|"mounts routes"| node_staff_routes
node_route_registry -->|"mounts routes"| node_plan_routes
node_route_registry -->|"mounts routes"| node_discount_routes
node_route_registry -->|"mounts routes"| node_tax_routes
node_route_registry -->|"uses middleware"| node_token_check
node_member_routes -->|"dispatches"| node_member_controller
node_member_routes -->|"guards writes"| node_role_check
node_staff_routes -->|"dispatches"| node_staff_controller
node_staff_routes -->|"guards writes"| node_role_check
node_plan_routes -->|"dispatches"| node_plan_controller
node_plan_routes -->|"guards writes"| node_role_check
node_discount_routes -->|"dispatches"| node_discount_controller
node_discount_routes -->|"guards writes"| node_role_check
node_tax_routes -->|"dispatches"| node_tax_controller
node_tax_routes -->|"guards writes"| node_role_check
node_member_controller -->|"queries and writes"| node_database
node_member_controller -->|"validates with"| node_member_schema
node_member_controller -->|"formats responses"| node_response
node_staff_controller -->|"queries and writes"| node_database
node_staff_controller -->|"validates with"| node_staff_schema
node_staff_controller -->|"formats responses"| node_response
node_staff_controller -->|"hashes passwords"| node_password_hash
node_plan_controller -->|"queries and writes"| node_database
node_plan_controller -->|"validates with"| node_plan_schema
node_plan_controller -->|"formats responses"| node_response
node_discount_controller -->|"queries and writes"| node_database
node_discount_controller -->|"validates with"| node_discount_schema
node_discount_controller -->|"formats responses"| node_response
node_tax_controller -->|"queries and writes"| node_database
node_tax_controller -->|"validates with"| node_tax_schema
node_tax_controller -->|"formats responses"| node_response
node_auth_controller -->|"queries and writes"| node_database
node_auth_controller -->|"uses hashing"| node_password_hash
node_auth_controller -->|"formats responses"| node_response
node_database -->|"loads config"| node_connection_config
node_role_check -->|"returns errors"| node_response

click node_client_app "https://github.com/santhoshkumar-52/zervo/blob/main/client/src/App.jsx"
click node_member_ui "https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/members"
click node_staff_ui "https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/staff"
click node_plans_ui "https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/plans"
click node_discount_ui "https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/discount"
click node_tax_ui "https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/tax"
click node_other_ui "https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages"
click node_express_app "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/app.js"
click node_route_registry "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/index.js"
click node_auth_routes "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/auth/authRoute.js"
click node_token_check "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/middleware/auth/tokenverify.js"
click node_role_check "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/middleware/auth/authorizeRoles.js"
click node_member_routes "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/member/memberRoutes.js"
click node_staff_routes "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/staff/staffRoutes.js"
click node_plan_routes "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/plan/planRoutes.js"
click node_discount_routes "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/discount/discountRoutes.js"
click node_tax_routes "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/tax/taxRoutes.js"
click node_auth_controller "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/authController/controller.js"
click node_member_controller "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/memberController/controller.js"
click node_member_schema "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/memberController/schema.js"
click node_staff_controller "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/staffController/controller.js"
click node_staff_schema "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/staffController/schema.js"
click node_plan_controller "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/planController/controller.js"
click node_plan_schema "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/planController/schema.js"
click node_discount_controller "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/discountController/controller.js"
click node_discount_schema "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/discountController/schema.js"
click node_tax_controller "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/taxController/controller.js"
click node_tax_schema "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/taxController/schema.js"
click node_database "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/config/knexfile.js"
click node_connection_config "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/config/connection.js"
click node_response "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/utils/response.js"
click node_password_hash "https://github.com/santhoshkumar-52/zervo/blob/main/server/src/utils/hashhelper.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_client_app,node_member_ui,node_staff_ui,node_plans_ui,node_discount_ui,node_tax_ui,node_other_ui,node_user toneBlue
class node_express_app,node_route_registry,node_auth_routes,node_token_check,node_role_check,node_member_routes,node_staff_routes,node_plan_routes,node_discount_routes,node_tax_routes toneAmber
class node_auth_controller,node_member_controller,node_member_schema,node_staff_controller,node_staff_schema,node_plan_controller,node_plan_schema,node_discount_controller,node_discount_schema,node_tax_controller,node_tax_schema toneMint
class node_database,node_connection_config,node_response,node_password_hash toneRose
```

## Components

### Client application

- [Client entry](https://github.com/santhoshkumar-52/zervo/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Member management](https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/members): `client/src/pages/members`
- [Staff management](https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/staff): `client/src/pages/staff`
- [Plans management](https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/plans): `client/src/pages/plans`
- [Discount management](https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/discount): `client/src/pages/discount`
- [Tax management](https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages/tax): `client/src/pages/tax`
- [Operations pages](https://github.com/santhoshkumar-52/zervo/tree/main/client/src/pages): `client/src/pages`

### Server routing and access

- [Express app](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/app.js): `server/src/app.js`
- [Route registry](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/index.js): `server/src/routes/index.js`
- [Authentication routes](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/auth/authRoute.js): `server/src/routes/auth/authRoute.js`
- [Token verification](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/middleware/auth/tokenverify.js): `server/src/middleware/auth/tokenverify.js`
- [Role authorization](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/middleware/auth/authorizeRoles.js): `server/src/middleware/auth/authorizeRoles.js`
- [Member routes](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/member/memberRoutes.js): `server/src/routes/member/memberRoutes.js`
- [Staff routes](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/staff/staffRoutes.js): `server/src/routes/staff/staffRoutes.js`
- [Plan routes](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/plan/planRoutes.js): `server/src/routes/plan/planRoutes.js`
- [Discount routes](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/discount/discountRoutes.js): `server/src/routes/discount/discountRoutes.js`
- [Tax routes](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/routes/tax/taxRoutes.js): `server/src/routes/tax/taxRoutes.js`

### Management domains

- [Authentication](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/authController/controller.js): `server/src/controller/authController/controller.js`
- [Member records](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/memberController/controller.js): `server/src/controller/memberController/controller.js`
- [Member validation](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/memberController/schema.js): `server/src/controller/memberController/schema.js`
- [Staff records](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/staffController/controller.js): `server/src/controller/staffController/controller.js`
- [Staff validation](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/staffController/schema.js): `server/src/controller/staffController/schema.js`
- [Plan records](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/planController/controller.js): `server/src/controller/planController/controller.js`
- [Plan validation](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/planController/schema.js): `server/src/controller/planController/schema.js`
- [Discount records](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/discountController/controller.js): `server/src/controller/discountController/controller.js`
- [Discount validation](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/discountController/schema.js): `server/src/controller/discountController/schema.js`
- [Tax records](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/taxController/controller.js): `server/src/controller/taxController/controller.js`
- [Tax validation](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/controller/taxController/schema.js): `server/src/controller/taxController/schema.js`

### Persistence and responses

- [Knex database](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/config/knexfile.js): `server/src/config/knexfile.js`
- [DB configuration](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/config/connection.js): `server/src/config/connection.js`
- [HTTP responses](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/utils/response.js): `server/src/utils/response.js`
- [Password hashing](https://github.com/santhoshkumar-52/zervo/blob/main/server/src/utils/hashhelper.js): `server/src/utils/hashhelper.js`

### Other components

- **Business user**

## Connections

- Express app → Route registry: mounts routes (evidence: `server/src/app.js`)
- Route registry → Authentication routes: mounts routes (evidence: `server/src/routes/index.js`)
- Route registry → Member routes: mounts routes (evidence: `server/src/routes/index.js`)
- Route registry → Staff routes: mounts routes (evidence: `server/src/routes/index.js`)
- Route registry → Plan routes: mounts routes (evidence: `server/src/routes/index.js`)
- Route registry → Discount routes: mounts routes (evidence: `server/src/routes/index.js`)
- Route registry → Tax routes: mounts routes (evidence: `server/src/routes/index.js`)
- Route registry → Token verification: uses middleware (evidence: `server/src/routes/index.js`)
- Member routes → Member records: dispatches (evidence: `server/src/routes/member/memberRoutes.js`)
- Member routes → Role authorization: guards writes (evidence: `server/src/routes/member/memberRoutes.js`)
- Staff routes → Staff records: dispatches (evidence: `server/src/routes/staff/staffRoutes.js`)
- Staff routes → Role authorization: guards writes (evidence: `server/src/routes/staff/staffRoutes.js`)
- Plan routes → Plan records: dispatches (evidence: `server/src/routes/plan/planRoutes.js`)
- Plan routes → Role authorization: guards writes (evidence: `server/src/routes/plan/planRoutes.js`)
- Discount routes → Discount records: dispatches (evidence: `server/src/routes/discount/discountRoutes.js`)
- Discount routes → Role authorization: guards writes (evidence: `server/src/routes/discount/discountRoutes.js`)
- Tax routes → Tax records: dispatches (evidence: `server/src/routes/tax/taxRoutes.js`)
- Tax routes → Role authorization: guards writes (evidence: `server/src/routes/tax/taxRoutes.js`)
- Member records → Knex database: queries and writes (evidence: `server/src/controller/memberController/controller.js`)
- Member records → Member validation: validates with (evidence: `server/src/controller/memberController/controller.js`)
- Member records → HTTP responses: formats responses (evidence: `server/src/controller/memberController/controller.js`)
- Staff records → Knex database: queries and writes (evidence: `server/src/controller/staffController/controller.js`)
- Staff records → Staff validation: validates with (evidence: `server/src/controller/staffController/controller.js`)
- Staff records → HTTP responses: formats responses (evidence: `server/src/controller/staffController/controller.js`)
- Staff records → Password hashing: hashes passwords (evidence: `server/src/controller/staffController/controller.js`)
- Plan records → Knex database: queries and writes (evidence: `server/src/controller/planController/controller.js`)
- Plan records → Plan validation: validates with (evidence: `server/src/controller/planController/controller.js`)
- Plan records → HTTP responses: formats responses (evidence: `server/src/controller/planController/controller.js`)
- Discount records → Knex database: queries and writes (evidence: `server/src/controller/discountController/controller.js`)
- Discount records → Discount validation: validates with (evidence: `server/src/controller/discountController/controller.js`)
- Discount records → HTTP responses: formats responses (evidence: `server/src/controller/discountController/controller.js`)
- Tax records → Knex database: queries and writes (evidence: `server/src/controller/taxController/controller.js`)
- Tax records → Tax validation: validates with (evidence: `server/src/controller/taxController/controller.js`)
- Tax records → HTTP responses: formats responses (evidence: `server/src/controller/taxController/controller.js`)
- Authentication → Knex database: queries and writes (evidence: `server/src/controller/authController/controller.js`)
- Authentication → Password hashing: uses hashing (evidence: `server/src/controller/authController/controller.js`)
- Authentication → HTTP responses: formats responses (evidence: `server/src/controller/authController/controller.js`)
- Knex database → DB configuration: loads config (evidence: `server/src/config/knexfile.js`)
- Role authorization → HTTP responses: returns errors (evidence: `server/src/middleware/auth/authorizeRoles.js`)
