# elva-tech/notify-service architecture

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

- Interactive diagram: https://gitdiagram.com/elva-tech/notify-service
- Repository: https://github.com/elva-tech/notify-service

## Overview

ELVA Notify is a multi-tenant OTP and notification platform with a backend API and a Next.js documentation/operations portal. Its main customer workflow authenticates an application, sends or verifies an OTP, or submits a direct SMS/email notification; delivery uses Redis, messaging providers, and operational records. A separate onboarding and approval workflow provisions business access and credentials. The portal also exposes API documentation, playgrounds, business configuration, and delivery/OTP monitoring. Relationships below are limited to README statements and shown source-index references; portal-to-API wiring is not established by the sampled evidence.

Main entry points: [`backend/src/services/notification.service.js`](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/notification.service.js) (Notification dispatch), [`backend/src/app.js`](https://github.com/elva-tech/notify-service/blob/main/backend/src/app.js) (Express application), [`backend/src/controllers/otp.controller.js`](https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/otp.controller.js) (OTP endpoints), [`backend/src/controllers/notify.controller.js`](https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/notify.controller.js) (Notify endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API workflows"]
  node_app["Express application<br/>[app.js]"]
  node_otpctrl["OTP endpoints<br/>[otp.controller.js]"]
  node_notifyctrl["Notify endpoint"]
  node_integrationctrl["Integration requests"]
end

subgraph group_delivery["Delivery and state"]
  node_notification["Notification dispatch"]
  node_otpservice["OTP lifecycle<br/>[otp.service.js]"]
  node_sms["SMS providers<br/>[sms.service.js]"]
  node_email["Email delivery<br/>[email.service.js]"]
  node_redis[("Redis OTP store")]
  node_mongo[("MongoDB")]
  node_persistence["Message records"]
end

subgraph group_business["Business operations"]
  node_businesses["Business registry<br/>[registry.js]"]
  node_brand["Brand registry"]
  node_ops["Operations monitoring"]
  node_alerts["Failure alerts"]
end

subgraph group_portal["Portal experiences"]
  node_onboard["Onboarding form<br/>[onboard-form.tsx]"]
  node_api_docs["API documentation<br/>[page.tsx]"]
  node_playground["API playground<br/>[api-playground.tsx]"]
  node_platform["Platform console<br/>[page.tsx]"]
end

node_client(("API client"))
node_provider{{"SMS and email services"}}

node_client -->|"calls API"| node_app
node_app -.->|"routes requests"| node_otpctrl
node_app -.->|"routes requests"| node_notifyctrl
node_otpctrl -->|"manages OTPs"| node_otpservice
node_otpctrl -->|"requests delivery"| node_notification
node_notifyctrl -->|"dispatches"| node_notification
node_otpservice -->|"stores hashed codes"| node_redis
node_notification -->|"sends SMS"| node_sms
node_notification -->|"sends email"| node_email
node_sms -->|"delivers SMS"| node_provider
node_email -->|"delivers email"| node_provider
node_notification -->|"records delivery"| node_persistence
node_persistence -.->|"writes records"| node_mongo
node_notification -->|"reports failures"| node_alerts
node_integrationctrl -->|"receives requests"| node_onboard
node_businesses -->|"validates registry"| node_brand
node_onboard -->|"submits request"| node_integrationctrl
node_client -->|"consults docs"| node_api_docs
node_client -.->|"tests requests"| node_playground
node_client -.->|"uses console"| node_platform

click node_app "https://github.com/elva-tech/notify-service/blob/main/backend/src/app.js"
click node_otpctrl "https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/otp.controller.js"
click node_notifyctrl "https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/notify.controller.js"
click node_integrationctrl "https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/integration.controller.js"
click node_notification "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/notification.service.js"
click node_otpservice "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/otp.service.js"
click node_sms "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/sms/sms.service.js"
click node_email "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/email/email.service.js"
click node_persistence "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/messagePersistence.service.js"
click node_businesses "https://github.com/elva-tech/notify-service/blob/main/backend/src/businesses/registry.js"
click node_brand "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/brandRegistry.service.js"
click node_ops "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/ops/opsNotify.service.js"
click node_alerts "https://github.com/elva-tech/notify-service/blob/main/backend/src/services/alerts/failureAlert.service.js"
click node_onboard "https://github.com/elva-tech/notify-service/blob/main/frontend/components/onboard/onboard-form.tsx"
click node_api_docs "https://github.com/elva-tech/notify-service/blob/main/frontend/app/api-reference/%5B...slug%5D/page.tsx"
click node_playground "https://github.com/elva-tech/notify-service/blob/main/frontend/components/playground/api-playground.tsx"
click node_platform "https://github.com/elva-tech/notify-service/blob/main/frontend/app/platform/page.tsx"

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_app,node_otpctrl,node_notifyctrl,node_integrationctrl,node_client toneBlue
class node_notification,node_otpservice,node_sms,node_email,node_redis,node_mongo,node_persistence toneAmber
class node_businesses,node_brand,node_ops,node_alerts toneMint
class node_onboard,node_api_docs,node_playground,node_platform toneRose
class node_provider toneIndigo
```

## Components

### API workflows

- [Express application](https://github.com/elva-tech/notify-service/blob/main/backend/src/app.js): `backend/src/app.js`
- [OTP endpoints](https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/otp.controller.js): `backend/src/controllers/otp.controller.js`
- [Notify endpoint](https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/notify.controller.js): `backend/src/controllers/notify.controller.js`
- [Integration requests](https://github.com/elva-tech/notify-service/blob/main/backend/src/controllers/integration.controller.js): `backend/src/controllers/integration.controller.js`

### Delivery and state

- [Notification dispatch](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/notification.service.js): `backend/src/services/notification.service.js`
- [OTP lifecycle](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/otp.service.js): `backend/src/services/otp.service.js`
- [SMS providers](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/sms/sms.service.js): `backend/src/services/sms/sms.service.js`
- [Email delivery](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/email/email.service.js): `backend/src/services/email/email.service.js`
- **Redis OTP store**
- **MongoDB**
- [Message records](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/messagePersistence.service.js): `backend/src/services/messagePersistence.service.js`

### Business operations

- [Business registry](https://github.com/elva-tech/notify-service/blob/main/backend/src/businesses/registry.js): `backend/src/businesses/registry.js`
- [Brand registry](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/brandRegistry.service.js): `backend/src/services/brandRegistry.service.js`
- [Operations monitoring](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/ops/opsNotify.service.js): `backend/src/services/ops/opsNotify.service.js`
- [Failure alerts](https://github.com/elva-tech/notify-service/blob/main/backend/src/services/alerts/failureAlert.service.js): `backend/src/services/alerts/failureAlert.service.js`

### Portal experiences

- [Onboarding form](https://github.com/elva-tech/notify-service/blob/main/frontend/components/onboard/onboard-form.tsx): `frontend/components/onboard/onboard-form.tsx`
- [API documentation](https://github.com/elva-tech/notify-service/blob/main/frontend/app/api-reference/%5B...slug%5D/page.tsx): `frontend/app/api-reference/[...slug]/page.tsx`
- [API playground](https://github.com/elva-tech/notify-service/blob/main/frontend/components/playground/api-playground.tsx): `frontend/components/playground/api-playground.tsx`
- [Platform console](https://github.com/elva-tech/notify-service/blob/main/frontend/app/platform/page.tsx): `frontend/app/platform/page.tsx`

### Other components

- **API client**
- **SMS and email services**

## Connections

- API client → Express application: calls API
- Express application → OTP endpoints: routes requests
- Express application → Notify endpoint: routes requests
- OTP endpoints → OTP lifecycle: manages OTPs (evidence: `backend/src/controllers/otp.controller.js`)
- OTP endpoints → Notification dispatch: requests delivery (evidence: `backend/src/controllers/otp.controller.js`)
- Notify endpoint → Notification dispatch: dispatches (evidence: `backend/src/controllers/notify.controller.js`)
- OTP lifecycle → Redis OTP store: stores hashed codes
- Notification dispatch → SMS providers: sends SMS (evidence: `backend/src/services/notification.service.js`)
- Notification dispatch → Email delivery: sends email (evidence: `backend/src/services/notification.service.js`)
- SMS providers → SMS and email services: delivers SMS
- Email delivery → SMS and email services: delivers email
- Notification dispatch → Message records: records delivery (evidence: `backend/src/services/notification.service.js`)
- Message records → MongoDB: writes records
- Notification dispatch → Failure alerts: reports failures (evidence: `backend/src/services/notification.service.js`)
- Integration requests → Onboarding form: receives requests (evidence: `backend/src/controllers/integration.controller.js`)
- Business registry → Brand registry: validates registry (evidence: `backend/src/businesses/index.js`)
- Onboarding form → Integration requests: submits request
- API client → API documentation: consults docs
- API client → API playground: tests requests
- API client → Platform console: uses console
