How devbobby/gurdianshild-main works
GuardianShield records financial transactions in an authenticated, tamper-evident ledger, then audits them asynchronously into a hash chain and S3 backups. Verification compares the chain, live transactions, and backup state; detected tampering creates incidents and locks the ledger, while authorized repair restores history from S3. Users and administrators operate these flows through the React client and Express APIs, with optional real-time event updates. Several controller and frontend details are unsampled, so the graph keeps those links only where documented or indexed evidence supports them.
Main entry points: App.jsx React application · verifyHashchain.js Chain verification · app.js Express app · auditWorker.js Audit worker
Components 32
Web client
- React application
frontend/src/App.jsx - Authentication state
frontend/src/context/AuthContext.jsx - Socket state
frontend/src/context/SocketContext.jsx - Ledger views
frontend/src/pages/DashboardPage.jsx - Security view
frontend/src/pages/SecurityPage.jsx - Incident view
frontend/src/pages/IncidentsPage.jsx - Repair view
frontend/src/pages/RepairPage.jsx - Admin view
frontend/src/pages/AdminPage.jsx
API and access
- Express app
backend/app.js - Auth handlers
backend/controllers/authController.js - Transaction handlers
backend/controllers/transactionController.js - Security handlers
backend/controllers/securityController.js - Incident handlers
backend/controllers/incidentController.js - Repair handlers
backend/controllers/repairController.js - Admin handlers
backend/controllers/adminController.js
Ledger audit
- PostgreSQL
backend/config/prisma.js - Transaction service
backend/services/transactionService.js - Outbox scheduler
backend/crone-jobs/outboxSchedule.js - Audit worker
backend/workers/auditWorker.js - Hash generation
backend/algorithams/generateHash.js - S3 backups
backend/repositories/s3BackupRepository.js - Backup service
backend/services/s3BackupService.js
Verification and incidents
- Chain verification
backend/algorithams/verifyHashchain.js - Verification worker
backend/workers/verificationWorker.js - Incident repository
backend/repositories/incidentRepository.js
Repair and events
- Repair queue
backend/queues/repairQueue.js - Repair worker
backend/workers/repairWorker.js - Repair service
backend/services/repairService.js - Ledger event bus
backend/events/ledgerEventBus.js - Socket server
backend/realtime/socketServer.js
Other components
- User or admin
- Redis
backend/config/redis.js
Connections 44
- User or admin → React application: uses
- React application → Authentication state: provides auth
frontend/src/App.jsx - React application → Ledger views: routes to
frontend/src/App.jsx - React application → Security view: routes to
frontend/src/App.jsx - React application → Incident view: routes to
frontend/src/App.jsx - React application → Repair view: routes to
frontend/src/App.jsx - React application → Admin view: routes to
frontend/src/App.jsx - React application → Socket state: provides sockets
frontend/src/App.jsx - React application → Express app: calls API
- Express app → Auth handlers: routes to
backend/app.js - Express app → Transaction handlers: routes to
backend/app.js - Express app → Security handlers: routes to
backend/app.js - Express app → Incident handlers: routes to
backend/app.js - Express app → Repair handlers: routes to
backend/app.js - Express app → Admin handlers: routes to
backend/app.js - Transaction handlers → Transaction service: delegates
backend/controllers/transactionController.js - Transaction service → PostgreSQL: writes transaction
backend/services/transactionService.js - Transaction service → Outbox scheduler: queues audit event
- Outbox scheduler → Audit worker: dispatches event
- Audit worker → Hash generation: hashes records
backend/workers/auditWorker.js - Audit worker → PostgreSQL: writes audit chain
backend/workers/auditWorker.js - Audit worker → Backup service: stores backup
backend/workers/auditWorker.js - Backup service → S3 backups: writes backup
backend/services/s3BackupService.js - Security handlers → Chain verification: verifies ledger
- Verification worker → Chain verification: runs verification
backend/workers/verificationWorker.js - Chain verification → Hash generation: recomputes hashes
backend/algorithams/verifyHashchain.js - Chain verification → PostgreSQL: reads chain
backend/algorithams/verifyHashchain.js - Chain verification → S3 backups: checks backup
backend/algorithams/verifyHashchain.js - Chain verification → Incident repository: creates incidents
- Incident handlers → Incident repository: delegates
backend/controllers/incidentController.js - Admin handlers → Chain verification: verifies user chain
backend/controllers/adminController.js - Repair handlers → Repair queue: enqueues repair
backend/controllers/repairController.js - Admin handlers → Repair queue: enqueues repair
backend/controllers/adminController.js - Repair queue → Repair worker: dispatches job
- Repair worker → Repair service: runs repair
backend/workers/repairWorker.js - Repair service → S3 backups: reads backups
backend/services/repairService.js - Repair service → PostgreSQL: restores ledger
backend/services/repairService.js - Repair service → Incident repository: validates incident
backend/services/repairService.js - Chain verification → Ledger event bus: emits events
backend/algorithams/verifyHashchain.js - Audit worker → Ledger event bus: emits events
backend/workers/auditWorker.js - Ledger event bus → Socket server: broadcasts events
backend/realtime/socketServer.js - Ledger event bus → PostgreSQL: persists events
backend/events/ledgerEventBus.js - Repair service → Ledger event bus: emits events
backend/services/repairService.js - Socket server → Socket state: streams updates