# cchillara/crm-application architecture

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

- Interactive diagram: https://gitdiagram.com/cchillara/crm-application
- Repository: https://github.com/cchillara/crm-application

## Overview

SHNOOR is presented as a CRM for customer, lead, deal, and activity management, but the sampled product UI is primarily a landing page and account authentication; it does not show implemented CRM data workflows. The evidenced user journey is landing page → sign-up or sign-in, with sign-in obtaining a Firebase token and calling the protected backend route. Backend startup also references database initialization, but its persistence behavior is not shown in the excerpts.

Main entry points: [`my-react-app/src/auth/Login.jsx`](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/auth/Login.jsx) (Account login), [`my-react-app/src/App.jsx`](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/App.jsx) (Landing and routing), [`my-react-app/src/auth/Signup.jsx`](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/auth/Signup.jsx) (Account signup), [`backend/src/routes/auth.routes.js`](https://github.com/cchillara/crm-application/blob/main/backend/src/routes/auth.routes.js) (Auth route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Landing and routing<br/>[App.jsx]"]
  node_signup["Account signup<br/>[Signup.jsx]"]
  node_login["Account login<br/>[Login.jsx]"]
end

subgraph group_identity["Identity"]
  node_clientconfig["Firebase client<br/>[firebase.js]"]
  node_middleware["Token verification<br/>[authmiddleware.js]"]
  node_adminauth["Firebase Admin auth<br/>[firebase-admin.js]"]
end

subgraph group_api["Backend API"]
  node_app["Express app<br/>[app.js]"]
  node_routes["Auth route<br/>[auth.routes.js]"]
  node_controller["Protected profile<br/>[auth.controller.js]"]
  node_response["API response helper<br/>[apiResponse.js]"]
  node_async["Async handler<br/>[asyncHandler.js]"]
end

subgraph group_runtime["Backend runtime"]
  node_entry["HTTP app entry<br/>[index.js]"]
  node_dbinit["Database initialization<br/>[index.js]"]
end

node_visitor(("CRM visitor"))
node_firebaseauth{{"Firebase Authentication"}}

node_visitor -->|"opens"| node_webapp
node_webapp -->|"routes signup"| node_signup
node_webapp -->|"routes login"| node_login
node_signup -->|"uses auth"| node_clientconfig
node_login -->|"uses auth"| node_clientconfig
node_clientconfig -->|"initializes"| node_firebaseauth
node_signup -->|"creates account"| node_firebaseauth
node_login -->|"signs in"| node_firebaseauth
node_login -->|"requests protected API"| node_entry
node_entry -->|"starts"| node_app
node_entry -->|"initializes"| node_dbinit
node_app -->|"mounts auth routes"| node_routes
node_routes -->|"verifies token"| node_middleware
node_routes -->|"dispatches protected route"| node_controller
node_middleware -->|"verifies ID token"| node_adminauth
node_controller -->|"wraps handler"| node_async
node_controller -->|"returns profile response"| node_response

click node_webapp "https://github.com/cchillara/crm-application/blob/main/my-react-app/src/App.jsx"
click node_signup "https://github.com/cchillara/crm-application/blob/main/my-react-app/src/auth/Signup.jsx"
click node_login "https://github.com/cchillara/crm-application/blob/main/my-react-app/src/auth/Login.jsx"
click node_clientconfig "https://github.com/cchillara/crm-application/blob/main/my-react-app/src/firebase.js"
click node_entry "https://github.com/cchillara/crm-application/blob/main/backend/src/index.js"
click node_app "https://github.com/cchillara/crm-application/blob/main/backend/src/app.js"
click node_routes "https://github.com/cchillara/crm-application/blob/main/backend/src/routes/auth.routes.js"
click node_middleware "https://github.com/cchillara/crm-application/blob/main/backend/src/middleware/authmiddleware.js"
click node_adminauth "https://github.com/cchillara/crm-application/blob/main/backend/src/firebase-admin.js"
click node_controller "https://github.com/cchillara/crm-application/blob/main/backend/src/controllers/auth.controller.js"
click node_response "https://github.com/cchillara/crm-application/blob/main/backend/src/utils/apiResponse.js"
click node_async "https://github.com/cchillara/crm-application/blob/main/backend/src/utils/asyncHandler.js"
click node_dbinit "https://github.com/cchillara/crm-application/blob/main/backend/src/db/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_webapp,node_signup,node_login toneBlue
class node_clientconfig,node_middleware,node_adminauth toneAmber
class node_app,node_routes,node_controller,node_response,node_async toneMint
class node_entry,node_dbinit toneRose
class node_visitor,node_firebaseauth toneIndigo
```

## Components

### Web experience

- [Landing and routing](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/App.jsx): `my-react-app/src/App.jsx`
- [Account signup](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/auth/Signup.jsx): `my-react-app/src/auth/Signup.jsx`
- [Account login](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/auth/Login.jsx): `my-react-app/src/auth/Login.jsx`

### Identity

- [Firebase client](https://github.com/cchillara/crm-application/blob/main/my-react-app/src/firebase.js): `my-react-app/src/firebase.js`
- [Token verification](https://github.com/cchillara/crm-application/blob/main/backend/src/middleware/authmiddleware.js): `backend/src/middleware/authmiddleware.js`
- [Firebase Admin auth](https://github.com/cchillara/crm-application/blob/main/backend/src/firebase-admin.js): `backend/src/firebase-admin.js`

### Backend API

- [Express app](https://github.com/cchillara/crm-application/blob/main/backend/src/app.js): `backend/src/app.js`
- [Auth route](https://github.com/cchillara/crm-application/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Protected profile](https://github.com/cchillara/crm-application/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [API response helper](https://github.com/cchillara/crm-application/blob/main/backend/src/utils/apiResponse.js): `backend/src/utils/apiResponse.js`
- [Async handler](https://github.com/cchillara/crm-application/blob/main/backend/src/utils/asyncHandler.js): `backend/src/utils/asyncHandler.js`

### Backend runtime

- [HTTP app entry](https://github.com/cchillara/crm-application/blob/main/backend/src/index.js): `backend/src/index.js`
- [Database initialization](https://github.com/cchillara/crm-application/blob/main/backend/src/db/index.js): `backend/src/db/index.js`

### Other components

- **CRM visitor**
- **Firebase Authentication**

## Connections

- CRM visitor → Landing and routing: opens
- Landing and routing → Account signup: routes signup (evidence: `my-react-app/src/App.jsx`)
- Landing and routing → Account login: routes login (evidence: `my-react-app/src/App.jsx`)
- Account signup → Firebase client: uses auth (evidence: `my-react-app/src/auth/Signup.jsx`)
- Account login → Firebase client: uses auth (evidence: `my-react-app/src/auth/Login.jsx`)
- Firebase client → Firebase Authentication: initializes (evidence: `my-react-app/src/firebase.js`)
- Account signup → Firebase Authentication: creates account (evidence: `my-react-app/src/auth/Signup.jsx`)
- Account login → Firebase Authentication: signs in (evidence: `my-react-app/src/auth/Login.jsx`)
- Account login → HTTP app entry: requests protected API (evidence: `my-react-app/src/auth/Login.jsx`)
- HTTP app entry → Express app: starts (evidence: `backend/src/index.js`)
- HTTP app entry → Database initialization: initializes (evidence: `backend/src/index.js`)
- Express app → Auth route: mounts auth routes (evidence: `backend/src/app.js`)
- Auth route → Token verification: verifies token (evidence: `backend/src/routes/auth.routes.js`)
- Auth route → Protected profile: dispatches protected route (evidence: `backend/src/routes/auth.routes.js`)
- Token verification → Firebase Admin auth: verifies ID token (evidence: `backend/src/middleware/authmiddleware.js`)
- Protected profile → Async handler: wraps handler (evidence: `backend/src/controllers/auth.controller.js`)
- Protected profile → API response helper: returns profile response (evidence: `backend/src/controllers/auth.controller.js`)
