How aryan-r-patel/gfdn works
Project Type and Purpose
• This is a full-stack, real-time fraud detection and prevention platform (Global Fraud Defense Network).
• Backend: Node.js/Express service exposing HTTP endpoints, WebSocket (Socket.io) for live updates, AI-powered workflow engine, and data simulator.
• Frontend: React/Vite single-page application with real-time dashboards, 3D globe mapping, workflow editor, and AI voice chatbot interface.
Main Components
a. Frontend Application
• Modules:
• UI Components (DashboardMetrics, GlobeView, TransactionFeed, WorkflowEditor, AIAssistant, VoiceRecorder, AudioVisualizer)
• State Management (useGfdnStore)
• Socket Layer (useSocket hook)
• Firebase auth/integration (frontend/src/lib/firebase.js)
• MVP sub-layer (AppPresenter, AppView)
• Runtime: served by Vite dev server or static assets in /dist.
b. Backend Service
• HTTP/WebSocket Server (Express + Socket.io in src/server.js)
• Workflow Engine (src/workflow/executor.js + node definitions in nodes/)
• Chatbot Services (service.js, voiceService.js under src/chatbot)
• Data Layer (transaction simulator: fetchTransactions, watchTransactions, seedUserData, transactionGenerator)
• Suggestions Engine (src/suggestions/engine.js)
• Metrics Collector (src/metrics.js)
• Environment & Config (.env, setup-env.sh)
• Tests suite (backend/tests)
c. External Services
• Google Gemini AI (Gemini API calls from chatbot/service.js)
• ElevenLabs Voice API (voiceService.js)
• Firebase (authentication, optional data store)
d. Persistence & Simulation
• In-memory or external data store (could be Firebase real-time DB or placeholder in data scripts)
• Transaction generator simulating incoming events
Component Interactions and Data Flow
• User in Browser → React SPA →
• requests static assets (HTTP)
• opens WebSocket to backend for real-time transaction events and AI chat messages
• invokes REST API endpoints for workflow operations or suggestions
• interacts with UI to edit workflows (React Flow), which calls WebSocket or REST to save/update
• triggers AI assistant via Socket.io or REST → backend calls Gemini API → returns text → optionally passed to ElevenLabs for TTS → audio stream back to client
• Backend Data Simulator → pushes fake transactions over WebSocket → frontend visualizations update
• Workflow Engine processes events → may call anomalyDetection, geminiCheck, geoCheck, velocityCheck nodes → emits fraud alerts
Architectural Patterns & Design Principles
• Frontend: component-based UI, unidirectional data flow (hooks + store), MVP for App container
• Backend: modular service layers (chatbot, workflow, data, suggestions), pluggable workflow nodes, test-driven design
• Real-time communications: WebSocket pub/sub via Socket.io
• API Layer: REST endpoints and WebSocket channels
• Extensibility: separate node definitions under workflow/nodes for new fraud rules