Caution
THIS REPOSITORY IS NOW ARCHIVED AND DEPRECATED.
All ongoing development, high-throughput routing, and production deployments have transitioned to ZGate (Sovereign Industrial API Gateway) located in ZeroUniverse (ZeroUniverse/ZeroApps/ZGate and ZeroUniverse/ZeroRust/crates/zero-gateway).
-
Performance: ZGate delivers 200,000+ req/s with sub-millisecond
$P_{99}$ latency ($< 0.5\text{ms}$ ) compared to 1,300โ15,000 req/s on legacy stacks. -
Resource Footprint: Native Rust binary (~1.0 MB) consumes
$< 10\text{ MB}$ RAM under heavy load vs. 500 MB โ 1.5 GB on Node.js/ASP.NET. - Unified Architecture: Single standalone executable embedding both high-speed data-plane routing, active health probing, token-bucket rate limiting, pure-Rust JWT validator, and an Industrial Dark Mode React 19 Admin Dashboard.
- Zero Dependency: Runs out-of-the-box without Node.js, .NET Runtime, or PM2.
Original Project Info:
- Legacy Version: 2.1.1
- Status: ๐ Archived / Replaced by ZGate
- Successor: kzxl/ZGate & kzxl/ZeroRust
- Go Backend & Admin UI Rebuild: Rebuilt the Go backend (
gateway-go) and React Admin panel (gateway-admin) using the latest source code. - WPF Control Panel Release: Recompiled the WPF Control Panel (
GatewayControlPanel) targeting .NET 8.0-Windows in Release mode, supporting both Lite (framework-dependent, ~885 KB) and Full (self-contained, ~154 MB) deployment variants. - Distribution Package: Synced the newly compiled Go backend, Admin UI static web files, and Control Panel executable into the unified
publish-finaldistribution package.
- Gateway Admin UI: Upgraded Admin dashboard UX/UI with premium glassmorphism dark/light mode, real-time traffic line charts, auto-refresh intervals, and advanced routing filters for System requests.
- IIS Deployment: Fixed React SPA routing on IIS 10 with web.config URL rewrite rules.
- GatewayControlPanel: Upgraded target framework from .NET Framework 4.6.2 to .NET 8.0-Windows.
- GatewayControlPanel: Optimized process execution by disabling standard output/error redirection to avoid UI blocking.
Enterprise-grade API Gateway built with Universe Architecture principles, supporting HTTP/WebSocket forwarding, authentication, rate limiting, and auto-scaling.
Key Features:
- ๐ 150k-180k req/s throughput (12 vCPU cluster mode)
- ๐ WebSocket forwarding support
- ๐ JWT Authentication with refresh tokens
- ๐ Real-time metrics and monitoring
- ๐ฏ Auto-scaling with PM2 cluster mode
- ๐๏ธ Universe Architecture (feature-based)
- ๐พ SQLite database (zero config)
- ๐ฅ๏ธ Windows Server 2012 compatible
# 1. Install dependencies cd gateway-node npm install # 2. Start gateway (single instance) npm start # 3. Or start with PM2 cluster (production) pm2 start ecosystem.config.js # 4. Access # Backend: http://localhost:8887 # Admin UI: http://localhost:8888 # Login: admin / admin123
# Backend cd APIGateway/APIGateway dotnet run -c Release # Admin UI cd gateway-admin npm run dev # Login: admin / admin123
Single Instance:
Throughput: 10,000 - 15,000 req/s
Latency (p50): 5-10ms
Memory: 50-100 MB
Cluster Mode (12 vCPU):
Throughput: 150,000 - 180,000 req/s
Latency (p50): 5-10ms
Memory: 1.2 - 1.5 GB (12 instances)
CPU: 95-100%
Throughput: 120,000 - 150,000 req/s
Latency (p50): 0.8ms
Memory: 500 MB - 1 GB
See: BACKEND_COMPARISON.md | PERFORMANCE_12CPU.md
gateway-node/
โโโ server-uarch.js # Main entry point
โโโ ecosystem.config.js # PM2 cluster config
โโโ src/
โโโ core/ # Core services (singleton)
โ โโโ config.js
โ โโโ database.js
โ โโโ metrics.js
โโโ infrastructure/ # Cross-cutting concerns
โ โโโ dbInit.js
โ โโโ loggingMiddleware.js
โ โโโ authMiddleware.js
โโโ features/ # Feature modules
โโโ auth/ # Authentication
โโโ users/ # User management
โโโ routes/ # Route management
โโโ clusters/ # Cluster management
โโโ logs/ # Log management
โโโ metrics/ # Metrics & stats
โโโ proxy/ # HTTP proxy
โโโ websocket/ # WebSocket proxy
APIGateway/
โโโ Program.cs # Main entry point
โโโ Features/ # Feature modules
โ โโโ Auth/
โ โโโ Routing/
โ โโโ Clustering/
โ โโโ Monitoring/
โโโ Infrastructure/ # Middleware
โโโ Core/ # Interfaces & Constants
- โ JWT access tokens (15 min expiry)
- โ Refresh token rotation (7 days)
- โ Account lockout (5 attempts, 30 min)
- โ Password hashing (bcrypt)
- โ Session management
- โ Dynamic HTTP routing
- โ WebSocket forwarding
- โ Path-based matching
- โ Load balancing (round-robin)
- โ Rate limiting
- โ User management (CRUD)
- โ Route management (CRUD)
- โ Cluster management (CRUD)
- โ Request logging
- โ Real-time metrics
- โ Permission-based access control
- โ Auto-scaling (PM2 cluster)
- โ Auto-restart on crash
- โ Zero-downtime reload
- โ Graceful shutdown
- โ Health checks
- โ Error handling
POST /auth/login - Login
POST /auth/refresh - Refresh token
POST /auth/logout - Logout
GET /admin/users - List users
POST /admin/users - Create user
PUT /admin/users/:id - Update user
DELETE /admin/users/:id - Delete user
GET /admin/routes - List routes
POST /admin/routes - Create route
PUT /admin/routes/:id - Update route
DELETE /admin/routes/:id - Delete route
GET /admin/clusters - List clusters
POST /admin/clusters - Create cluster
PUT /admin/clusters/:id - Update cluster
DELETE /admin/clusters/:id - Delete cluster
GET /admin/logs - Get logs
DELETE /admin/logs - Delete old logs
GET /admin/metrics - Get metrics
GET /admin/stats - Get stats
GET /admin/permissions - Get permissions
GET /health - Health check
# 1. Install PM2 npm install -g pm2 # 2. Start cluster (auto-scale to CPU cores) cd gateway-node pm2 start ecosystem.config.js # 3. Save configuration pm2 save # 4. Auto-start on boot pm2 startup
# Publish cd APIGateway/APIGateway dotnet publish -c Release -o ../../publish/backend # Run cd ../../publish/backend ./APIGateway
cd gateway-admin npm run build # Deploy dist/ to nginx or static hosting
See: DEPLOYMENT.md | DEPLOYMENT_PACKAGE.md
// ecosystem.config.js module.exports = { apps: [{ name: 'gateway-node', script: './server-uarch.js', instances: 'max', // Use all CPU cores exec_mode: 'cluster', // Enable cluster mode max_memory_restart: '500M' }] };
# Scale to 8 instances pm2 scale gateway-node 8 # Scale to max CPU cores pm2 scale gateway-node max # Reload without downtime pm2 reload gateway-node # Monitor pm2 monit
See: AUTO_SCALING.md
PORT=8887 JWT_SECRET=your-secret-key-min-32-chars NODE_ENV=production
{
"ConnectionStrings": {
"GatewayDb": "Data Source=gateway.db"
},
"Jwt": {
"Secret": "your-secret-key",
"Issuer": "APIGateway",
"Audience": "GatewayClients"
}
}# Real-time monitoring pm2 monit # Process list pm2 list # Logs pm2 logs gateway-node # Metrics pm2 describe gateway-node
curl -H "Authorization: Bearer <token>" \
http://localhost:8887/admin/metricsResponse:
{
"totalRequests": 1000000,
"successRequests": 950000,
"failedRequests": 50000,
"successRate": "95.00",
"avgLatency": 8,
"wsConnections": 100,
"wsMessages": 50000,
"uptime": 86400
}curl http://localhost:8887/health
curl -X POST http://localhost:8887/auth/login \ -H "Content-Type: application/json" \ -d '{"username":"admin","password":"admin123"}'
Open websocket-test.html in browser or use wscat:
wscat -c ws://localhost:8887/ws/echo
- DEPLOYMENT.md - Full deployment guide
- AUTO_SCALING.md - PM2 cluster mode
- DEPLOYMENT_PACKAGE.md - Complete package
- BACKEND_COMPARISON.md - .NET 8 vs Go vs Node.js
- PERFORMANCE_12CPU.md - 12 vCPU analysis
- MINIMAL_ROUTING_PERFORMANCE.md - Routing performance
- GO_BACKEND_ANALYSIS.md - Go implementation
- WEBSOCKET_SUPPORT.md - WebSocket capabilities
- FEATURES_COMPLETE.md - Feature list
- AUTH_IMPLEMENTATION.md - Auth guide
- LOAD_TESTING_GUIDE.md - Load testing
- DESIGN_UARCH.md - Architecture design
| Backend | Throughput (12 CPU) | Memory | Latency | Windows 2012 |
|---|---|---|---|---|
| Node.js (Cluster) | 150k-180k req/s | 1.2 GB | 5-10ms | โ |
| Go (fasthttp) | 200k-250k req/s | 100 MB | 0.3ms | โ |
| .NET 8 (YARP) | 150k-200k req/s | 1 GB | 0.8ms | โ |
Recommendation:
- Windows Server 2012: Node.js (best compatibility)
- Windows Server 2016+: .NET 8 (best developer experience)
- Maximum Performance: Go (fastest, lowest memory)
- โ JWT authentication (15 min expiry)
- โ Refresh token rotation (7 days)
- โ Account lockout protection (5 attempts, 30 min)
- โ Password hashing (bcrypt)
- โ CORS configuration
- โ Rate limiting (100 req/s default)
- โ Input validation
- โ SQL injection prevention (parameterized queries)
- โ Token blacklist
- โ Session management
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
- Built with Universe Architecture principles
- Powered by Node.js and Express
- Process management by PM2
- Admin UI built with React and Ant Design
- .NET version powered by YARP
For issues and questions:
- ๐ Check Documentation
- ๐ Report bugs via GitHub Issues
- ๐ฌ Discussions via GitHub Discussions
Made with โค๏ธ using Universe Architecture
Status: โ
Production Ready
Version: 2.1.1
Last Updated: 2026-04-09