# nikhil10510/blockbloom architecture

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

- Interactive diagram: https://gitdiagram.com/nikhil10510/blockbloom
- Repository: https://github.com/nikhil10510/blockbloom

## Overview

BlockBloom DAO is a web application for creating and participating in DAOs, proposals, elections, and governance, with AI assistance. Users connect a wallet in the React app; the backend provides REST APIs and real-time updates, while blockchain events are indexed into application data. The README documents local contract deployment and frontend/backend setup. The graph includes the documented governance, AI, and event-processing capabilities; several backend routes and services are represented at their exact directory paths because their implementations were not sampled.

Main entry points: [`frontend/src/App.jsx`](https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/App.jsx) (Web app routes), [`backend/src/server.js`](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/server.js) (Backend startup), [`backend/src/api/controllers/aiController.js`](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/api/controllers/aiController.js) (AI endpoints), [`backend/src/workers/eventWorker.js`](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/workers/eventWorker.js) (Event processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_app["Web app routes<br/>[App.jsx]"]
  node_auth["Wallet authentication<br/>[AuthContext.jsx]"]
  node_dao_ui["DAO dashboard<br/>[DAODashboard.jsx]"]
  node_org_ui["Organizations<br/>[Organizations.jsx]"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["API and governance"]
  node_api_routes["REST routes"]
  node_auth_api["Authentication API<br/>[authController.js]"]
  node_governance_api["Governance API"]
  node_governance_services["Governance services"]
  node_models[("Governance records")]
  node_realtime["Realtime updates<br/>[socketManager.js]"]
end

subgraph group_ai["AI assistance"]
  node_ai_api["AI endpoints<br/>[aiController.js]"]
  node_ai_copilot["AI copilot<br/>[copilotService.js]"]
  node_ai_agents["AI agents<br/>[orchestrator.js]"]
  node_ai_rag["Governance knowledge search<br/>[ragPipeline.js]"]
  node_ai_memory["Chat memory<br/>[memoryManager.js]"]
  node_ai_model["Gemini integration<br/>[geminiService.js]"]
end

subgraph group_infra["Chain and events"]
  node_server["Backend startup<br/>[server.js]"]
  node_db[("MongoDB<br/>[connection.js]")]
  node_indexer["Chain event indexer<br/>[eventIndexer.js]"]
  node_worker["Event processing<br/>[eventWorker.js]"]
  node_contracts["Contract access<br/>[contracts.js]"]
  node_local_chain["Hardhat deployment<br/>[deploy-local.js]"]
end

node_user(("DAO participant"))
node_wallet(("Wallet and blockchain"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dao_ui
node_app -->|"routes to"| node_org_ui
node_app -->|"protects route"| node_admin_ui
node_app -->|"provides context"| node_auth
node_auth -->|"signs in with"| node_wallet
node_auth -.->|"requests authentication"| node_auth_api
node_app -.->|"uses API"| node_api_routes
node_server -->|"mounts"| node_api_routes
node_server -->|"connects"| node_db
node_server -->|"starts"| node_indexer
node_server -->|"starts"| node_worker
node_server -->|"initializes"| node_realtime
node_api_routes -.->|"routes requests"| node_governance_api
node_api_routes -->|"routes requests"| node_ai_api
node_ai_api -->|"calls"| node_ai_copilot
node_ai_api -->|"runs"| node_ai_agents
node_ai_api -->|"queries"| node_ai_rag
node_ai_api -->|"loads history"| node_ai_memory
node_ai_copilot -->|"generates with"| node_ai_model
node_ai_rag -->|"generates with"| node_ai_model
node_ai_memory -->|"persists sessions"| node_models
node_governance_api -.->|"delegates to"| node_governance_services
node_governance_services -->|"uses records"| node_models
node_governance_services -->|"emits updates"| node_realtime
node_indexer -.->|"dispatches events"| node_worker
node_worker -->|"updates records"| node_models
node_worker -->|"emits events"| node_realtime
node_worker -->|"reads contracts"| node_contracts
node_local_chain -->|"deploys contracts"| node_wallet
node_contracts -.->|"accesses chain"| node_wallet

click node_app "https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/context/AuthContext.jsx"
click node_dao_ui "https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/pages/DAODashboard.jsx"
click node_org_ui "https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/pages/Organizations.jsx"
click node_admin_ui "https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_api_routes "https://github.com/nikhil10510/blockbloom/tree/main/backend/src/api/routes"
click node_auth_api "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/api/controllers/authController.js"
click node_governance_api "https://github.com/nikhil10510/blockbloom/tree/main/backend/src/api/controllers"
click node_governance_services "https://github.com/nikhil10510/blockbloom/tree/main/backend/src/services"
click node_models "https://github.com/nikhil10510/blockbloom/tree/main/backend/src/models"
click node_realtime "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/websocket/socketManager.js"
click node_ai_api "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/api/controllers/aiController.js"
click node_ai_copilot "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/services/copilotService.js"
click node_ai_agents "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/agents/orchestrator.js"
click node_ai_rag "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/rag/ragPipeline.js"
click node_ai_memory "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/memory/memoryManager.js"
click node_ai_model "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/services/geminiService.js"
click node_server "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/server.js"
click node_db "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/database/connection.js"
click node_indexer "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/events/eventIndexer.js"
click node_worker "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/workers/eventWorker.js"
click node_contracts "https://github.com/nikhil10510/blockbloom/blob/main/backend/src/blockchain/contracts.js"
click node_local_chain "https://github.com/nikhil10510/blockbloom/blob/main/hardhat/deploy-local.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_auth,node_dao_ui,node_org_ui,node_admin_ui toneBlue
class node_api_routes,node_auth_api,node_governance_api,node_governance_services,node_models,node_realtime toneAmber
class node_ai_api,node_ai_copilot,node_ai_agents,node_ai_rag,node_ai_memory,node_ai_model toneMint
class node_server,node_db,node_indexer,node_worker,node_contracts,node_local_chain toneRose
class node_user,node_wallet toneIndigo
```

## Components

### Web application

- [Web app routes](https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Wallet authentication](https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [DAO dashboard](https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/pages/DAODashboard.jsx): `frontend/src/pages/DAODashboard.jsx`
- [Organizations](https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/pages/Organizations.jsx): `frontend/src/pages/Organizations.jsx`
- [Admin dashboard](https://github.com/nikhil10510/blockbloom/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`

### API and governance

- [REST routes](https://github.com/nikhil10510/blockbloom/tree/main/backend/src/api/routes): `backend/src/api/routes`
- [Authentication API](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/api/controllers/authController.js): `backend/src/api/controllers/authController.js`
- [Governance API](https://github.com/nikhil10510/blockbloom/tree/main/backend/src/api/controllers): `backend/src/api/controllers`
- [Governance services](https://github.com/nikhil10510/blockbloom/tree/main/backend/src/services): `backend/src/services`
- [Governance records](https://github.com/nikhil10510/blockbloom/tree/main/backend/src/models): `backend/src/models`
- [Realtime updates](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/websocket/socketManager.js): `backend/src/websocket/socketManager.js`

### AI assistance

- [AI endpoints](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/api/controllers/aiController.js): `backend/src/api/controllers/aiController.js`
- [AI copilot](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/services/copilotService.js): `backend/src/ai/services/copilotService.js`
- [AI agents](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/agents/orchestrator.js): `backend/src/ai/agents/orchestrator.js`
- [Governance knowledge search](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/rag/ragPipeline.js): `backend/src/ai/rag/ragPipeline.js`
- [Chat memory](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/memory/memoryManager.js): `backend/src/ai/memory/memoryManager.js`
- [Gemini integration](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/ai/services/geminiService.js): `backend/src/ai/services/geminiService.js`

### Chain and events

- [Backend startup](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/server.js): `backend/src/server.js`
- [MongoDB](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/database/connection.js): `backend/src/database/connection.js`
- [Chain event indexer](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/events/eventIndexer.js): `backend/src/events/eventIndexer.js`
- [Event processing](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/workers/eventWorker.js): `backend/src/workers/eventWorker.js`
- [Contract access](https://github.com/nikhil10510/blockbloom/blob/main/backend/src/blockchain/contracts.js): `backend/src/blockchain/contracts.js`
- [Hardhat deployment](https://github.com/nikhil10510/blockbloom/blob/main/hardhat/deploy-local.js): `hardhat/deploy-local.js`

### Other components

- **DAO participant**
- **Wallet and blockchain**

## Connections

- DAO participant → Web app routes: uses (evidence: `frontend/src/App.jsx`)
- Web app routes → DAO dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Web app routes → Organizations: routes to (evidence: `frontend/src/App.jsx`)
- Web app routes → Admin dashboard: protects route (evidence: `frontend/src/App.jsx`)
- Web app routes → Wallet authentication: provides context (evidence: `frontend/src/App.jsx`)
- Wallet authentication → Wallet and blockchain: signs in with (evidence: `frontend/src/context/AuthContext.jsx`)
- Wallet authentication → Authentication API: requests authentication
- Web app routes → REST routes: uses API
- Backend startup → REST routes: mounts (evidence: `backend/src/server.js`)
- Backend startup → MongoDB: connects (evidence: `backend/src/server.js`)
- Backend startup → Chain event indexer: starts (evidence: `backend/src/server.js`)
- Backend startup → Event processing: starts (evidence: `backend/src/server.js`)
- Backend startup → Realtime updates: initializes (evidence: `backend/src/server.js`)
- REST routes → Governance API: routes requests (evidence: `backend/src/api/routes/aiRoutes.js`)
- REST routes → AI endpoints: routes requests (evidence: `backend/src/api/routes/aiRoutes.js`)
- AI endpoints → AI copilot: calls (evidence: `backend/src/api/controllers/aiController.js`)
- AI endpoints → AI agents: runs (evidence: `backend/src/api/controllers/aiController.js`)
- AI endpoints → Governance knowledge search: queries (evidence: `backend/src/api/controllers/aiController.js`)
- AI endpoints → Chat memory: loads history (evidence: `backend/src/api/controllers/aiController.js`)
- AI copilot → Gemini integration: generates with (evidence: `backend/src/ai/services/copilotService.js`)
- Governance knowledge search → Gemini integration: generates with (evidence: `backend/src/ai/rag/ragPipeline.js`)
- Chat memory → Governance records: persists sessions (evidence: `backend/src/ai/memory/memoryManager.js`)
- Governance API → Governance services: delegates to
- Governance services → Governance records: uses records (evidence: `backend/src/services/proposalService.js`)
- Governance services → Realtime updates: emits updates (evidence: `backend/src/services/proposalService.js`)
- Chain event indexer → Event processing: dispatches events
- Event processing → Governance records: updates records (evidence: `backend/src/workers/eventWorker.js`)
- Event processing → Realtime updates: emits events (evidence: `backend/src/workers/eventWorker.js`)
- Event processing → Contract access: reads contracts (evidence: `backend/src/workers/eventWorker.js`)
- Hardhat deployment → Wallet and blockchain: deploys contracts (evidence: `README.md`)
- Contract access → Wallet and blockchain: accesses chain
