NGMI Technical Architecture: Current State & Future Vision
Executive Summary
This document outlines the technical architecture of the NGMI platform across its evolutionary versions. NGMI 1.0 represents our current production environment, while NGMI 2.0 details our strategic technical evolution currently in development. The platform operates at the intersection of social engagement, prediction markets, and decentralized financial systems, requiring a sophisticated technical approach that balances user experience with blockchain reliability.
Our architecture prioritizes three core principles:
- Performance & Reliability: Multi-region deployment with redundancy
- Seamless UX: Blockchain integration without crypto complexity
- Scalable Infrastructure: Design for 10x growth with minimal architectural changes
NGMI 1.0: Current Production Architecture
Core Technology Stack
| Component | Technology | Justification |
|---|---|---|
| Frontend | Next.js (App Router) | Optimized rendering paths and SEO benefits |
| State Management | Zustand + middleware | Minimalist state management with persistence |
| Backend | Node.js microservices | Rapid development and extensive ecosystem |
| Database | PostgreSQL | ACID compliance for critical user data |
| Caching | Redis | High-performance in-memory data store |
| Media Storage | Cloudflare R2 | Cost-effective S3-compatible storage |
| Authentication | JWT + Email verification | Standard secure authentication flow |
| Analytics | Custom telemetry | GDPR-compliant internal metrics system |
Infrastructure Implementation
+---------------------+ +---------------------+
| | | |
| Next.js Frontend |------| API Gateway |
| (Vercel) | | (Kong/Nginx) |
| | | |
+---------------------+ +---------+-----------+
|
v
+---------------------+
| |
| Microservices Layer |
| (Node.js) |
| |
+---------+-----------+
|
+------------------+-+-------------+
| | |
v v v
+---------------------+ +----------------+ +---------------------+
| | | | | |
| PostgreSQL DB | | Redis Cache | | Cloudflare R2 |
| (User data) | | (Performance) | | (Media storage) |
| | | | | |
+---------------------+ +----------------+ +---------------------+
Regional Deployment Strategy
NGMI 1.0 operates across three strategically positioned regions:
- Singapore (APAC): Covers Asia-Pacific users with regional data compliance
- Frankfurt (EU): Serves European users with GDPR-compliant infrastructure
- Virginia (US East): Handles North and South American traffic
Each region maintains redundant infrastructure with the following characteristics:
- N+1 redundancy for all critical components
- Automatic failover capabilities (15-30 second recovery)
- Regional data sovereignty compliance
- Cross-region backup systems
Frontend Deployment (Vercel)
Our Vercel configuration leverages enterprise-grade capabilities to ensure global performance:
Strategic Configuration:
- Fluid Compute: Enabled for automatic concurrency management and optimal resource allocation
- Function Regions: Global coverage across North America, Europe, and Asia Pacific (Singapore)
- Function CPU: Performance tier (1.7 vCPUs/3GB) for mission-critical functions
Technical Advantages:
- Global Performance Optimization: Consistent sub-100ms latency for users worldwide through strategic regional deployment
- Intelligent Scaling: Fluid Compute automatically adjusts resources based on demand patterns
- Enterprise Reliability: Redundant deployments ensure zero single points of failure
Key Optimizations:
- Edge functions for authentication and data validation, reducing latency by 40-60%
- Middleware integration for security and compliance requirements
- Built-in A/B testing infrastructure for continuous experience optimization
Data Flow Architecture
NGMI 1.0 utilizes a streamlined request-response architecture:
-
Read Operations:
- Client requests -> API Gateway -> Microservice -> Cache/Database
- Average latency: 65ms (p95: 150ms)
-
Write Operations:
- Client requests -> API Gateway -> Microservice -> Database -> Response
- Average latency: 120ms (p95: 250ms)
Performance Metrics
Current production performance metrics:
| Metric | Value | Target |
|---|---|---|
| API Response Times | 65ms avg / 150ms p95 | 50ms avg / 120ms p95 |
| Frontend Loading | FCP: 1.2s / LCP: 2.4s | FCP: 0.9s / LCP: 1.8s |
| Uptime | 99.95% (30-day) | 99.99% |
| Error Rate | 0.18% | <0.1% |
| Regional Latency Variation | 35-210ms | <100ms across all regions |
NGMI 2.0: Technical Evolution
NGMI 2.0 represents a fundamental architectural advancement, integrating blockchain technology as a source of truth while maintaining the seamless UX expected by mainstream users.
Key Architectural Advancements
-
Blockchain Integration:
- EVM-compatible nodes in each region
- Blockchain as the single source of truth for consensus data
- Database as performance cache with TTL
-
Performance Optimizations:
- Critical path services rewritten in Rust (10-50x throughput improvement)
- Enhanced caching strategies with Redis Cluster
- Edge function deployment for user-facing APIs
-
Smart Contract Infrastructure:
- Factory pattern implementation with minimal proxies (EIP-1167)
- Optimized gas usage through batched transactions
- Tiered verification system with oracle integration
System Architecture
+---------------------+ +---------------------+ +---------------------+
| | | | | |
| Frontend |------| Backend API |------| Blockchain |
| (Next.js) | | (Node.js/Rust) | | (EVM Node) |
| | | | | |
+---------------------+ +---------+-----------+ +---------------------+
| ^
v |
+---------------------+ |
| | |
| SQL Database | |
| | |
+---------------------+ |
^ |
| |
v |
+---------------------+ |
| | |
| Cache Service |----------+
| (Redis) |
| |
+---------------------+
Data Flow Principles
-
Blockchain as Single Source of Truth:
- All consensus data resides on-chain
- Database serves as performance cache with TTL
- Periodic synchronization ensures consistency
- Blockchain resolution for conflicts
-
Read Operations:
Frontend -> REST API -> Cache -> BSC Node- All data access through REST API layer
- Redis cache with 30-60s TTL for performance
- Background polling updates cache from blockchain
- SWR/React Query for efficient frontend fetching
-
Write Operations:
Frontend -> API -> Smart Contract Transaction -> Blockchain
| |
| +---> Transaction Receipt
|
+---> Optimistic UI Update + Database Cache- All predictions/commitments routed through backend
- Blockchain transactions (immediate for staked, batched for casual)
- Optimistic updates for responsive UI feedback
- Scheduled sync ensures database consistency with blockchain
Smart Contract Architecture
+---------------------+
| |
| Factory Contract |
| |
+----------+----------+
|
| deploys
v
+---------------------+
| |
| Implementation Base |
| |
+----------+----------+
|
| cloned by
v
+---------------------+ +---------------------+
| | | |
| Minimal Proxy #1 | | Minimal Proxy #2 | ...
| | | |
+---------------------+ +---------------------+
Gas Optimization:
- Factory deploys inexpensive EIP-1167 minimal proxies (~45k gas) instead of full contracts
- Each market is a separate minimal proxy pointing to the same implementation
- Implementation contains all logic but no state
- 85-90% gas savings compared to traditional deployment models
Batch Processing System
To minimize blockchain transaction costs for non-staked predictions:
+------------------+ +------------------+ +------------------+
| | | | | |
| Accumulate user |---->| Group by market |---->| Create batch |
| predictions | | & time | | transactions |
| | | | | |
+------------------+ +------------------+ +------------------+
Batch Parameters:
- Frequency: Every 5-10 minutes (configurable)
- Size: Up to 100 predictions per batch
- Trigger: Time-based OR size threshold
- Cost reduction: ~95% compared to individual transactions
Authentication & Wallet Integration
+---------------------+ +---------------------+
| | | |
| User Session |---->| Backend Auth API |
| (JWT Tokens) | | |
+---------------------+ +---------+-----------+
|
| validates
v
+---------------------+ +---------------------+
| | | |
| Smart Wallet |---->| Blockchain Address |
| (Account Abstraction) | (Transaction signing)
+---------------------+ +---------------------+
This architecture enables:
- Standard JWT authentication for casual users
- Web3 wallet signatures for staked predictions
- Smart contract wallets for non-crypto users
- Transparent signing of blockchain transactions
Regional Infrastructure Expansion
NGMI 2.0 will expand our regional footprint:
Phase 1 (Launch):
- Singapore (APAC)
- Frankfurt (EU)
- Virginia (US East)
Phase 2 (3-6 months post-launch):
- São Paulo (LATAM)
- Tokyo (Japan)
Phase 3 (6-12 months post-launch):
- Mumbai (India)
- Sydney (Australia)
- Optional: Middle East region based on regulatory clarity
Each region will include:
- Frontend deployment (Vercel with appropriate regional settings)
- Backend services (Kubernetes cluster)
- Database instances (PostgreSQL with regional replication)
- Blockchain node (EVM-compatible)
- Redis cache cluster
Technical Infrastructure
Enterprise Server Configuration (Per Region):
- Servers: Strategic cluster of high-performance OVHcloud Advance AMD EPYC servers
- Processor: AMD EPYC 4344P - 8 cores / 16 threads with 5.3 GHz max boost frequency
- Memory: 128 GB DDR5 ECC On-Die memory for blockchain operation security
- Storage: 4 x 7.68 TB SSD NVMe in configurable RAID arrangements
- Network: Multi-tiered networking with 5 Gbps public and 25 Gbps guaranteed private bandwidth
- Locations: Strategic global presence across North America, Europe, Asia Pacific
- Cost-Efficiency: Optimized TCO with enterprise-grade performance
Infrastructure Advantages:
-
Purpose-Optimized Processing Power:
- High-frequency AMD EPYC processors (5.3 GHz boost) for optimal EVM node performance
- Strategic thread allocation for blockchain consensus operations
- Dedicated resources for transaction processing and validation
-
Memory Configuration:
- DDR5 ECC On-Die memory provides protection against bit errors in critical blockchain data
- Memory capacity optimized for EVM node requirements and caching operations
- Tiered memory allocation for prioritizing blockchain operations
-
Storage Architecture:
- NVMe SSD storage array for exceptional I/O performance (10x traditional SSD)
- Configurable RAID implementation for flexible data protection strategies
- Dedicated volumes for blockchain data, ensuring isolation and performance
-
Networking Excellence:
- 25 Gbps private network enabling efficient inter-service communication
- Multi-gigabit public connectivity for global user access
- Segregated network planes for security and performance optimization
Scaling Strategy:
- Horizontal scaling through cluster expansion
- Redis cache distribution for read performance
- API server load balancing with automated scaling
- Database read replicas for analytical queries
- Transaction optimization through intelligent batching
Development Roadmap
NGMI 2.0 Implementation Timeline
| Phase | Timeline | Key Deliverables | Technical Focus |
|---|---|---|---|
| Foundation | Months 1-3 | Core infrastructure, base architecture | Kubernetes setup, database schema, smart contracts |
| Core Features | Months 3-5 | Multi-dimensional modes, enhanced UI | Mode system, wallet integration, UI components |
| Blockchain Integration | Months 5-7 | Smart contract deployment, transaction processing | Contract testing, gas optimization, security audits |
| Scaling & Optimization | Months 7-9 | Performance enhancements, regional expansion | Caching strategies, batch processing, monitoring |
| Launch Preparation | Months 9-10 | Final testing, security audits, documentation | Load testing, penetration testing, disaster recovery |
Ongoing Optimization Initiatives
-
Performance Enhancement Program:
- Continuous latency reduction across global regions
- Optimization of blockchain synchronization processes
- Memory usage profiling and optimization
-
Resilience Strengthening:
- Enhanced redundancy implementation across all tiers
- Disaster recovery simulation and validation
- Automated failover testing and validation
-
Technical Debt Prevention:
- Proactive code quality measurement and improvement
- Systematic dependency management and updating
- Regular architecture review and refinement
-
Future-Proofing Strategy:
- Layer 2 scaling solution evaluation and integration planning
- Advanced containerization implementation
- Serverless function expansion for appropriate workloads
Conclusion
The NGMI technical architecture represents a sophisticated approach to combining traditional web technologies with blockchain capabilities. The current production system (NGMI 1.0) provides a solid foundation, while NGMI 2.0 will introduce transformative changes that enhance functionality without sacrificing user experience.
Our deliberate regional deployment strategy ensures global coverage while navigating the complex regulatory landscape of prediction markets. The blockchain integration approach balances decentralization benefits with performance requirements, creating a unique platform positioned at the intersection of web2 and web3 technologies.
Our forward-looking infrastructure planning ensures consistent performance across all regions. The phased implementation approach enables systematic growth while maintaining platform stability and reliability through each evolutionary stage.
This document represents the current technical architecture as of April 2025 and is subject to refinement as development progresses.