# bhavesh-girase/bidrush architecture

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

- Interactive diagram: https://gitdiagram.com/bhavesh-girase/bidrush
- Repository: https://github.com/bhavesh-girase/bidrush

## Overview

BidRush is a real-time auction platform. Users authenticate, browse listings, submit bids, and see live auction and wallet updates; sellers manage auctions and balances, while administrators oversee users, auctions, and bids. The backend combines Redis-based atomic bidding with PostgreSQL persistence, RabbitMQ workers, scheduled auction lifecycle changes, and Stripe/Cloudinary integrations. The graph reflects documented and excerpted relationships; unsampled routes and subsystems are included only where their existence or capability is supported, without guessing their internal calls.

Main entry points: [`backend/index.js`](https://github.com/bhavesh-girase/bidrush/blob/main/backend/index.js) (HTTP server), [`backend/src/controllers/auctionController.js`](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/auctionController.js) (Auction management), [`backend/src/controllers/bidController.js`](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/bidController.js) (Bid handling), [`backend/src/queues/status/statusconsumer.js`](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/status/statusconsumer.js) (Status worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["Web app routes<br/>[App.jsx]"]
  node_authui["Auth state<br/>[AuthContext.jsx]"]
  node_auctionui["Auction experience<br/>[AuctionDetail.jsx]"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_apiui["HTTP client<br/>[api.js]"]
  node_socketui["Socket client<br/>[useSocket.js]"]
end

subgraph group_api["API and domain"]
  node_server["HTTP server<br/>[index.js]"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_auth["Authentication<br/>[authController.js]"]
  node_auctionroutes["Auction routes<br/>[auction.js]"]
  node_auctions["Auction management"]
  node_bidroutes["Bid routes<br/>[bid.js]"]
  node_bids["Bid handling<br/>[bidController.js]"]
  node_wallet["Wallet and payments"]
  node_stripehook["Stripe webhook<br/>[stripeWebhook.js]"]
  node_uploads["Media uploads<br/>[upload.js]"]
  node_scheduler["Auction scheduler"]
end

subgraph group_realtime["Realtime and async"]
  node_socketserver["Socket events<br/>[socketServer.js]"]
  node_atomic["Atomic bid cache<br/>[functions.js]"]
  node_bidworker["Bid persistence worker<br/>[bidconsumer.js]"]
  node_statusworker["Status worker<br/>[statusconsumer.js]"]
  node_emailworker["Email worker<br/>[emailConsumer.js]"]
end

subgraph group_state["State and integrations"]
  node_pg[("PostgreSQL<br/>[db.js]")]
  node_auctionrepo["Auction repository"]
  node_userrepo["User repository<br/>[userRepository.js]"]
  node_bidrepo["Bid repository<br/>[bidRepository.js]"]
  node_redis[("Redis cache<br/>[redis.js]")]
  node_rabbit["RabbitMQ broker<br/>[rabbitmq.js]"]
end

node_people(("Users and admins"))
node_stripe["Stripe"]
node_cloudinary["Cloudinary"]

node_people -->|"use"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_auctionui
node_app -->|"routes to"| node_adminui
node_authui -->|"requests auth"| node_apiui
node_authui -->|"subscribes via"| node_socketui
node_auctionui -->|"requests data"| node_apiui
node_auctionui -->|"receives events"| node_socketui
node_adminui -->|"requests data"| node_apiui
node_adminui -->|"receives events"| node_socketui
node_apiui -.->|"HTTP requests"| node_server
node_socketui -->|"connects"| node_socketserver
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_auctionroutes
node_server -->|"mounts routes"| node_bidroutes
node_server -->|"initializes"| node_socketserver
node_server -->|"starts worker"| node_bidworker
node_server -->|"starts worker"| node_statusworker
node_server -->|"starts worker"| node_emailworker
node_server -->|"starts scheduler"| node_scheduler
node_server -->|"routes webhook"| node_stripehook
node_server -->|"mounts routes"| node_wallet
node_server -->|"mounts routes"| node_uploads
node_authroutes -->|"dispatches"| node_auth
node_auctionroutes -.->|"dispatches"| node_auctions
node_bidroutes -.->|"dispatches"| node_bids
node_auth -->|"queries users"| node_userrepo
node_auth -->|"reads tokens"| node_pg
node_auth -->|"reads balances"| node_redis
node_auctions -->|"manages records"| node_auctionrepo
node_auctions -->|"reads cache"| node_redis
node_auctions -->|"uses cache functions"| node_atomic
node_auctions -->|"emits updates"| node_socketserver
node_auctions -->|"publishes status"| node_statusworker
node_auctions -->|"queues email"| node_emailworker
node_bids -->|"validates atomically"| node_atomic
node_bids -->|"queries bids"| node_bidrepo
node_bids -->|"updates auctions"| node_auctionrepo
node_bids -->|"updates balances"| node_userrepo
node_bids -.->|"publishes bid"| node_rabbit
node_bids -->|"emits bid events"| node_socketserver
node_atomic -->|"executes scripts"| node_redis
node_bidworker -->|"consumes bids"| node_rabbit
node_bidworker -->|"persists bids"| node_pg
node_statusworker -->|"consumes statuses"| node_rabbit
node_statusworker -->|"updates records"| node_pg
node_statusworker -->|"updates cache"| node_redis
node_statusworker -->|"emits updates"| node_socketserver

click node_app "https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/context/AuthContext.jsx"
click node_auctionui "https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/pages/AuctionDetail.jsx"
click node_adminui "https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/pages/admin/AdminDashboard.jsx"
click node_apiui "https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/services/api.js"
click node_socketui "https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/hooks/useSocket.js"
click node_server "https://github.com/bhavesh-girase/bidrush/blob/main/backend/index.js"
click node_authroutes "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/auth.js"
click node_auth "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/authController.js"
click node_auctionroutes "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/auction.js"
click node_auctions "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/auctionController.js"
click node_bidroutes "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/bid.js"
click node_bids "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/bidController.js"
click node_wallet "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/walletController.js"
click node_stripehook "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/stripeWebhook.js"
click node_uploads "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/upload.js"
click node_scheduler "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/jobs/auctionSchedular.js"
click node_socketserver "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/webSocket/socketServer.js"
click node_atomic "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/cache/Functions/functions.js"
click node_bidworker "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/bids/bidconsumer.js"
click node_statusworker "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/status/statusconsumer.js"
click node_emailworker "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/email/emailConsumer.js"
click node_pg "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/config/db.js"
click node_auctionrepo "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/repositories/auctionRepository.js"
click node_userrepo "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/repositories/userRepository.js"
click node_bidrepo "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/repositories/bidRepository.js"
click node_redis "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/config/redis.js"
click node_rabbit "https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/config/rabbitmq.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_authui,node_auctionui,node_adminui,node_apiui,node_socketui,node_people toneBlue
class node_server,node_authroutes,node_auth,node_auctionroutes,node_auctions,node_bidroutes,node_bids,node_wallet,node_stripehook,node_uploads,node_scheduler toneAmber
class node_socketserver,node_atomic,node_bidworker,node_statusworker,node_emailworker toneMint
class node_pg,node_auctionrepo,node_userrepo,node_bidrepo,node_redis,node_rabbit toneRose
class node_stripe,node_cloudinary toneIndigo
```

## Components

### Client experience

- [Web app routes](https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auction experience](https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/pages/AuctionDetail.jsx): `frontend/src/pages/AuctionDetail.jsx`
- [Admin dashboard](https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/pages/admin/AdminDashboard.jsx): `frontend/src/pages/admin/AdminDashboard.jsx`
- [HTTP client](https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Socket client](https://github.com/bhavesh-girase/bidrush/blob/main/frontend/src/hooks/useSocket.js): `frontend/src/hooks/useSocket.js`

### API and domain

- [HTTP server](https://github.com/bhavesh-girase/bidrush/blob/main/backend/index.js): `backend/index.js`
- [Auth routes](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Authentication](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Auction routes](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/auction.js): `backend/src/routes/auction.js`
- [Auction management](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/auctionController.js): `backend/src/controllers/auctionController.js`
- [Bid routes](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/bid.js): `backend/src/routes/bid.js`
- [Bid handling](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/bidController.js): `backend/src/controllers/bidController.js`
- [Wallet and payments](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/walletController.js): `backend/src/controllers/walletController.js`
- [Stripe webhook](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/controllers/stripeWebhook.js): `backend/src/controllers/stripeWebhook.js`
- [Media uploads](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/routes/upload.js): `backend/src/routes/upload.js`
- [Auction scheduler](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/jobs/auctionSchedular.js): `backend/src/jobs/auctionSchedular.js`

### Realtime and async

- [Socket events](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/webSocket/socketServer.js): `backend/src/webSocket/socketServer.js`
- [Atomic bid cache](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/cache/Functions/functions.js): `backend/src/cache/Functions/functions.js`
- [Bid persistence worker](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/bids/bidconsumer.js): `backend/src/queues/bids/bidconsumer.js`
- [Status worker](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/status/statusconsumer.js): `backend/src/queues/status/statusconsumer.js`
- [Email worker](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/queues/email/emailConsumer.js): `backend/src/queues/email/emailConsumer.js`

### State and integrations

- [PostgreSQL](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Auction repository](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/repositories/auctionRepository.js): `backend/src/repositories/auctionRepository.js`
- [User repository](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/repositories/userRepository.js): `backend/src/repositories/userRepository.js`
- [Bid repository](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/repositories/bidRepository.js): `backend/src/repositories/bidRepository.js`
- [Redis cache](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/config/redis.js): `backend/src/config/redis.js`
- [RabbitMQ broker](https://github.com/bhavesh-girase/bidrush/blob/main/backend/src/config/rabbitmq.js): `backend/src/config/rabbitmq.js`

### Other components

- **Users and admins**
- **Stripe**
- **Cloudinary**

## Connections

- Users and admins → Web app routes: use (evidence: `frontend/src/App.jsx`)
- Web app routes → Auth state: provides auth (evidence: `frontend/src/App.jsx`)
- Web app routes → Auction experience: routes to (evidence: `frontend/src/App.jsx`)
- Web app routes → Admin dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Auth state → HTTP client: requests auth (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth state → Socket client: subscribes via (evidence: `frontend/src/context/AuthContext.jsx`)
- Auction experience → HTTP client: requests data (evidence: `frontend/src/pages/AuctionDetail.jsx`)
- Auction experience → Socket client: receives events (evidence: `frontend/src/pages/AuctionDetail.jsx`)
- Admin dashboard → HTTP client: requests data (evidence: `frontend/src/pages/admin/AdminDashboard.jsx`)
- Admin dashboard → Socket client: receives events (evidence: `frontend/src/pages/admin/AdminDashboard.jsx`)
- HTTP client → HTTP server: HTTP requests
- Socket client → Socket events: connects (evidence: `frontend/src/hooks/useSocket.js`)
- HTTP server → Auth routes: mounts routes (evidence: `backend/index.js`)
- HTTP server → Auction routes: mounts routes (evidence: `backend/index.js`)
- HTTP server → Bid routes: mounts routes (evidence: `backend/index.js`)
- HTTP server → Socket events: initializes (evidence: `backend/index.js`)
- HTTP server → Bid persistence worker: starts worker (evidence: `backend/index.js`)
- HTTP server → Status worker: starts worker (evidence: `backend/index.js`)
- HTTP server → Email worker: starts worker (evidence: `backend/index.js`)
- HTTP server → Auction scheduler: starts scheduler (evidence: `backend/index.js`)
- HTTP server → Stripe webhook: routes webhook (evidence: `backend/index.js`)
- HTTP server → Wallet and payments: mounts routes (evidence: `backend/index.js`)
- HTTP server → Media uploads: mounts routes (evidence: `backend/index.js`)
- Auth routes → Authentication: dispatches (evidence: `backend/src/routes/auth.js`)
- Auction routes → Auction management: dispatches
- Bid routes → Bid handling: dispatches
- Authentication → User repository: queries users (evidence: `backend/src/controllers/authController.js`)
- Authentication → PostgreSQL: reads tokens (evidence: `backend/src/controllers/authController.js`)
- Authentication → Redis cache: reads balances (evidence: `backend/src/controllers/authController.js`)
- Auction management → Auction repository: manages records (evidence: `backend/src/controllers/auctionController.js`)
- Auction management → Redis cache: reads cache (evidence: `backend/src/controllers/auctionController.js`)
- Auction management → Atomic bid cache: uses cache functions (evidence: `backend/src/controllers/auctionController.js`)
- Auction management → Socket events: emits updates (evidence: `backend/src/controllers/auctionController.js`)
- Auction management → Status worker: publishes status (evidence: `backend/src/controllers/auctionController.js`)
- Auction management → Email worker: queues email (evidence: `backend/src/controllers/auctionController.js`)
- Bid handling → Atomic bid cache: validates atomically (evidence: `backend/src/controllers/bidController.js`)
- Bid handling → Bid repository: queries bids (evidence: `backend/src/controllers/bidController.js`)
- Bid handling → Auction repository: updates auctions (evidence: `backend/src/controllers/bidController.js`)
- Bid handling → User repository: updates balances (evidence: `backend/src/controllers/bidController.js`)
- Bid handling → RabbitMQ broker: publishes bid
- Bid handling → Socket events: emits bid events (evidence: `backend/src/controllers/bidController.js`)
- Atomic bid cache → Redis cache: executes scripts (evidence: `backend/src/cache/Functions/functions.js`)
- Bid persistence worker → RabbitMQ broker: consumes bids (evidence: `backend/src/queues/bids/bidconsumer.js`)
- Bid persistence worker → PostgreSQL: persists bids (evidence: `backend/src/queues/bids/bidconsumer.js`)
- Status worker → RabbitMQ broker: consumes statuses (evidence: `backend/src/queues/status/statusconsumer.js`)
- Status worker → PostgreSQL: updates records (evidence: `backend/src/queues/status/statusconsumer.js`)
- Status worker → Redis cache: updates cache (evidence: `backend/src/queues/status/statusconsumer.js`)
- Status worker → Socket events: emits updates (evidence: `backend/src/queues/status/statusconsumer.js`)
