How kosasih/global-connect works
Project type and purpose
• This is a full-stack, microservice-based platform (“Global Connect”) for Pi Coin, combining:
• A React SPA (“frontend” + “dashboard”) for end users and partners
• Node.js/Express microservices (“backend”) exposing REST/GraphQL/WebSocket APIs
• On-chain logic via JavaScript smart contracts under “smart_contracts”
• A massive catalog of AI modules (JS/Python) under “ai/” for compliance, risk, forecasting, user support, etc.
• Blockchain connectors (Python) under “blockchain/”
• SDKs (Node + Python) and example apps in “apps/”
• CI/CD, local dev scripts, monitoring, and test harnesses
File structure
• Top-level “frontend” and “dashboard” hold React code, static assets, and Dockerfiles
• “backend” is organized into adapters, API routes, controllers, services, models, middleware, tests
• “ai/” contains:
• A central orchestrator (ai_orchestration_engine.js) and “engine/modules” implementing business-domain AI flows (e.g., compliance, liquidity optimizer, macro forecast)
• Standalone micro-apps (e.g., aiamlmonitor, aibankgateway, …) each with its own entry point
• Utilities for logging, data ingestion, monitoring, etc.
• “blockchain/”: Python scripts for connecting to multiple chains, listening to events, and managing wallets
• “smart_contracts/”: dual-value system and PiCoin contracts + migrations + tests
• “api/”: low-level webhook handlers and OpenAPI definition
• “apps/”: example end-to-end applications grouped by domain (AI, DeFi, e-commerce, identity, …)
• “sdk/”: Node.js and Python client libraries
• “scripts/”: deployment, ABI updates, test data generation, fraud simulation
• “config/”, CI configs, Docker compose, Prometheus/Grafana in “backend/monitoring”
README for additional insights
• Core architecture is described as:
• Node.js & Express microservices
• React SPA
• Smart contracts on blockchain (Stellar/Ethereum-style JS contracts)
• AI modules for every domain (fraud, compliance, market forecasting, voice assistants, etc.)
• Monitoring & alerting with Prometheus + Grafana
• Plug-and-play modularity for rapid feature swaps
a. Main components
• Presentation Layer:
– User Web App (frontend React SPA)
– Admin/Partner Dashboard (dashboard React SPA)
• API Layer:
– API Gateway / Express App (“backend/app.js”)
– Versioned API routes (REST + GraphQL + WebSocket)
• Microservice Layer:
– Transaction Service, User Service, Analytics Service, Compliance Service, Price Prediction, etc.
– Redis (caching, pub/sub for WebSocketServer)
– PostgreSQL/MongoDB (models under “backend/models”)
• AI Layer:
– Orchestration Engine invoking AI modules (ai/engine/index.js)
– Domain-specific AI modules (e.g. aml_ctf_checker.py, liquidity_optimizer.js, chatbot.js)
• Blockchain Layer:
– Python chain connectors (cosmos_client, solana_client)
– Universal Wallet services
– Event listener producing chain events → Microservices
– Smart Contracts (DualValueSystem.js, PiCoin.js) deployed on chain
• Data & Storage:
– Relational/NoSQL DB for core entities (Users, Transactions, NFTs, PricePredictions…)
– Redis for sessions, rate-limit, caching
– File store for logs, alerts, reports
• Integration & Extensibility:
– Adapters (Shopify, WooCommerce, etc.) under “backend/adapters”
– SDKs for Node/Python clients
– Webhooks (api/v1/webhooks.js), partner connectors (apps/)
• Observability:
– Health checks & metrics (backend/monitoring) → Prometheus → Grafana
– Advanced logging (ai/utils/advanced_logging.js + backend/loggingMiddleware.js)
– Audit logs (backend/audit)
b. Relationships & interactions
1. User → Browser → React SPA → API Gateway
2. Gateway dispatches to microservices → DB / Redis / Blockchain connector
3. Microservices call AI Orchestrator via internal API or direct module call
4. AI modules process data, store results, push events back to message bus or DB
5. WebSocketServer streams real-time updates to SPA
6. Background “blockchain/event_listener.py” pushes on-chain events to transactionService
7. Smart contracts enforce dual-value stability and issue on-chain events
8. Monitoring agents scrape metrics, trigger alerts
c. Architectural patterns & principles
• Microservices + modular plugin architecture (loose coupling, single responsibility)
• Hexagonal ports-and-adapters for external systems (backend/adapters, blockchain connectors)
• Event-driven communication (WebSockets, message bus, pub/sub)
• Separation of concerns: Presentation / API / Business Logic / Data / AI / Chain
• CI/CD: test suites (unit, integration, e2e) gated via GitHub Actions & CircleCI
d. Key technologies & frameworks
• Node.js, Express, GraphQL, WebSocket
• React, Redux, React Hooks
• Python for blockchain connectors & select AI scripts
• Redis, PostgreSQL or MongoDB
• Truffle/Hardhat-style JS smart contracts
• Prometheus, Grafana for observability
• Docker & Docker Compose