# yash-ranjan-124/electron_notifier architecture

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

- Interactive diagram: https://gitdiagram.com/yash-ranjan-124/electron_notifier
- Repository: https://github.com/yash-ranjan-124/electron_notifier

## Overview

This is an Express/Mongoose event-notifier backend, despite the README’s “Electron Based” title; the shown code exposes HTTP APIs and Socket.IO, not an Electron client. The main workflow accepts an event through the HTTP routes, persists it, then looks up users interested in its category and emits a notification to their email-named socket rooms. Account and category APIs are separate branches. Edges reflect shown calls or SOURCE INDEX references; the event service’s use of the Socket.IO server is visible, but its connection to app-level initialization is not, so that link is dashed.

Main entry points: [`app.js`](https://github.com/yash-ranjan-124/electron_notifier/blob/master/app.js) (Express app), [`routes/index.js`](https://github.com/yash-ranjan-124/electron_notifier/blob/master/routes/index.js) (API routes), [`services/event.js`](https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/event.js) (Event service), [`libs/socketIOHandler.js`](https://github.com/yash-ranjan-124/electron_notifier/blob/master/libs/socketIOHandler.js) (Socket.IO handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP entry"]
  node_app["Express app<br/>[app.js]"]
  node_routes["API routes<br/>[index.js]"]
  node_user_controller["User controller<br/>[user.controller.js]"]
  node_event_controller["Event controller"]
  node_category_controller["Category controller"]
end

subgraph group_domain["Domain services"]
  node_user_service["User service<br/>[user.js]"]
  node_event_service["Event service<br/>[event.js]"]
  node_category_service["Category service<br/>[eventsCategory.js]"]
end

subgraph group_data["Mongo data"]
  node_user_model["User model<br/>[user.js]"]
  node_event_model["Event model<br/>[event.js]"]
  node_category_model["Category model<br/>[eventCategory.js]"]
  node_mongo[("MongoDB")]
  node_mongo_handler["Mongo connector<br/>[mongoHandler.js]"]
end

subgraph group_realtime["Realtime delivery"]
  node_socket_handler["Socket.IO handler<br/>[socketIOHandler.js]"]
end

node_api_user(("API user"))
node_api_client(("API client"))
node_socket_client(("Socket client"))

node_api_client -->|"sends HTTP"| node_app
node_app -->|"mounts routes"| node_routes
node_routes -->|"routes requests"| node_user_controller
node_routes -->|"routes requests"| node_event_controller
node_routes -->|"routes requests"| node_category_controller
node_user_controller -->|"calls"| node_user_service
node_event_controller -->|"calls"| node_event_service
node_category_controller -->|"calls"| node_category_service
node_user_service -->|"queries and saves"| node_user_model
node_event_service -->|"queries and saves"| node_event_model
node_event_service -->|"finds interested users"| node_user_model
node_category_service -->|"uses model"| node_category_model
node_app -->|"connects"| node_mongo_handler
node_mongo_handler -->|"opens connection"| node_mongo
node_app -->|"starts server"| node_socket_handler
node_event_service -.->|"emits notifications"| node_socket_handler
node_socket_client -->|"joins room"| node_socket_handler

click node_app "https://github.com/yash-ranjan-124/electron_notifier/blob/master/app.js"
click node_routes "https://github.com/yash-ranjan-124/electron_notifier/blob/master/routes/index.js"
click node_user_controller "https://github.com/yash-ranjan-124/electron_notifier/blob/master/controllers/user.controller.js"
click node_event_controller "https://github.com/yash-ranjan-124/electron_notifier/blob/master/controllers/event.controller.js"
click node_category_controller "https://github.com/yash-ranjan-124/electron_notifier/blob/master/controllers/eventCategory.controller.js"
click node_user_service "https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/user.js"
click node_event_service "https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/event.js"
click node_category_service "https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/eventsCategory.js"
click node_user_model "https://github.com/yash-ranjan-124/electron_notifier/blob/master/models/user.js"
click node_event_model "https://github.com/yash-ranjan-124/electron_notifier/blob/master/models/event.js"
click node_category_model "https://github.com/yash-ranjan-124/electron_notifier/blob/master/models/eventCategory.js"
click node_mongo_handler "https://github.com/yash-ranjan-124/electron_notifier/blob/master/libs/mongoHandler.js"
click node_socket_handler "https://github.com/yash-ranjan-124/electron_notifier/blob/master/libs/socketIOHandler.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_app,node_routes,node_user_controller,node_event_controller,node_category_controller,node_api_user,node_api_client,node_socket_client toneBlue
class node_user_service,node_event_service,node_category_service toneAmber
class node_user_model,node_event_model,node_category_model,node_mongo,node_mongo_handler toneMint
class node_socket_handler toneRose
```

## Components

### HTTP entry

- [Express app](https://github.com/yash-ranjan-124/electron_notifier/blob/master/app.js): `app.js`
- [API routes](https://github.com/yash-ranjan-124/electron_notifier/blob/master/routes/index.js): `routes/index.js`
- [User controller](https://github.com/yash-ranjan-124/electron_notifier/blob/master/controllers/user.controller.js): `controllers/user.controller.js`
- [Event controller](https://github.com/yash-ranjan-124/electron_notifier/blob/master/controllers/event.controller.js): `controllers/event.controller.js`
- [Category controller](https://github.com/yash-ranjan-124/electron_notifier/blob/master/controllers/eventCategory.controller.js): `controllers/eventCategory.controller.js`

### Domain services

- [User service](https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/user.js): `services/user.js`
- [Event service](https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/event.js): `services/event.js`
- [Category service](https://github.com/yash-ranjan-124/electron_notifier/blob/master/services/eventsCategory.js): `services/eventsCategory.js`

### Mongo data

- [User model](https://github.com/yash-ranjan-124/electron_notifier/blob/master/models/user.js): `models/user.js`
- [Event model](https://github.com/yash-ranjan-124/electron_notifier/blob/master/models/event.js): `models/event.js`
- [Category model](https://github.com/yash-ranjan-124/electron_notifier/blob/master/models/eventCategory.js): `models/eventCategory.js`
- **MongoDB**
- [Mongo connector](https://github.com/yash-ranjan-124/electron_notifier/blob/master/libs/mongoHandler.js): `libs/mongoHandler.js`

### Realtime delivery

- [Socket.IO handler](https://github.com/yash-ranjan-124/electron_notifier/blob/master/libs/socketIOHandler.js): `libs/socketIOHandler.js`

### Other components

- **API user**
- **API client**
- **Socket client**

## Connections

- API client → Express app: sends HTTP (evidence: `app.js`)
- Express app → API routes: mounts routes (evidence: `app.js`)
- API routes → User controller: routes requests (evidence: `routes/index.js`)
- API routes → Event controller: routes requests (evidence: `routes/index.js`)
- API routes → Category controller: routes requests (evidence: `routes/index.js`)
- User controller → User service: calls (evidence: `controllers/user.controller.js`)
- Event controller → Event service: calls (evidence: `controllers/event.controller.js`)
- Category controller → Category service: calls (evidence: `controllers/eventCategory.controller.js`)
- User service → User model: queries and saves (evidence: `services/user.js`)
- Event service → Event model: queries and saves (evidence: `services/event.js`)
- Event service → User model: finds interested users (evidence: `services/event.js`)
- Category service → Category model: uses model (evidence: `services/eventsCategory.js`)
- Express app → Mongo connector: connects (evidence: `app.js`)
- Mongo connector → MongoDB: opens connection (evidence: `libs/mongoHandler.js`)
- Express app → Socket.IO handler: starts server (evidence: `app.js`)
- Event service → Socket.IO handler: emits notifications
- Socket client → Socket.IO handler: joins room (evidence: `libs/socketIOHandler.js`)
