GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - kzxl/API_Gateway: Production-ready API Gateway built with YARP (.NET 8) โ€” JWT auth, failover, rate limiting, circuit breaker, traffic metrics, admin dashboard (React)

BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
APIGateway.NetFramework
APIGateway.NetFramework
 
 
APIGateway
APIGateway
 
 
DummyBackend
DummyBackend
 
 
GatewayControlPanel
GatewayControlPanel
 
 
GatewayNet48
GatewayNet48
 
 
LoadTester
LoadTester
 
 
MockBackend
MockBackend
 
 
gateway-admin
gateway-admin
 
 
gateway-go
gateway-go
 
 
gateway-node
gateway-node
 
 
.gitignore
.gitignore
 
 
.project-rule.md
.project-rule.md
 
 
API_FORWARDING_LIMITS.md
API_FORWARDING_LIMITS.md
 
 
AUTH_IMPLEMENTATION.md
AUTH_IMPLEMENTATION.md
 
 
BACKEND_COMPARISON.md
BACKEND_COMPARISON.md
 
 
BENCHMARK_GUIDE.md
BENCHMARK_GUIDE.md
 
 
CODE_COMPARISON.md
CODE_COMPARISON.md
 
 
DEPLOYMENT_PACKAGE.md
DEPLOYMENT_PACKAGE.md
 
 
DESIGN_UARCH.md
DESIGN_UARCH.md
 
 
FEATURES_COMPLETE.md
FEATURES_COMPLETE.md
 
 
FEATURE_ANALYSIS_AND_PROPOSALS.md
FEATURE_ANALYSIS_AND_PROPOSALS.md
 
 
FINAL_COMPLETE_REPORT.md
FINAL_COMPLETE_REPORT.md
 
 
FINAL_REPORT.md
FINAL_REPORT.md
 
 
GOCACHE_PERFORMANCE_ANALYSIS.md
GOCACHE_PERFORMANCE_ANALYSIS.md
 
 
GO_BACKEND_ANALYSIS.md
GO_BACKEND_ANALYSIS.md
 
 
LICENSE
LICENSE
 
 
LOAD_TESTING_GUIDE.md
LOAD_TESTING_GUIDE.md
 
 
MINIMAL_ROUTING_PERFORMANCE.md
MINIMAL_ROUTING_PERFORMANCE.md
 
 
NET_FRAMEWORK_COMPLETE.md
NET_FRAMEWORK_COMPLETE.md
 
 
NET_FRAMEWORK_PLAN.md
NET_FRAMEWORK_PLAN.md
 
 
PERFORMANCE_12CPU.md
PERFORMANCE_12CPU.md
 
 
PERFORMANCE_ANALYSIS.md
PERFORMANCE_ANALYSIS.md
 
 
PERFORMANCE_OPTIMIZATION_REPORT.md
PERFORMANCE_OPTIMIZATION_REPORT.md
 
 
PROJECT_COMPLETE.md
PROJECT_COMPLETE.md
 
 
PROJECT_COMPLETION_SUMMARY.md
PROJECT_COMPLETION_SUMMARY.md
 
 
README.md
README.md
 
 
README_QUICKSTART.md
README_QUICKSTART.md
 
 
ROUTING_LIMITS_SUMMARY.md
ROUTING_LIMITS_SUMMARY.md
 
 
SUMMARY.md
SUMMARY.md
 
 
TEST_RESULTS.md
TEST_RESULTS.md
 
 
UI_IMPROVEMENTS_COMPLETE.md
UI_IMPROVEMENTS_COMPLETE.md
 
 
WEBSOCKET_SUPPORT.md
WEBSOCKET_SUPPORT.md
 
 
docker-compose.yml
docker-compose.yml
 
 
gateway_load_test.bat
gateway_load_test.bat
 
 
gateway_load_test.sh
gateway_load_test.sh
 
 
load_test.sh
load_test.sh
 
 
patch_metrics_logs.py
patch_metrics_logs.py
 
 
test-backend.js
test-backend.js
 
 
test_auth.bat
test_auth.bat
 
 
test_auth.sh
test_auth.sh
 
 
websocket-test.html
websocket-test.html
 
 

Repository files navigation

๐Ÿ“ฆ [ARCHIVED & DEPRECATED] API Gateway Legacy (.NET / Node.js)

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).

Why Migration to ZGate?

  • 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

๐Ÿ”„ Recent Updates (2026-06-02)

  • 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-final distribution package.

๐Ÿ”„ Recent Updates (2026-05-14)

  • 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.

๐Ÿ“‹ Overview

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

๐ŸŽฏ Quick Start

Node.js Version (Recommended for Windows Server 2012)

# 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

.NET 8 Version (Windows Server 2016+)

# Backend
cd APIGateway/APIGateway
dotnet run -c Release

# Admin UI
cd gateway-admin
npm run dev

# Login: admin / admin123

๐Ÿ“Š Performance

Node.js (PM2 Cluster Mode)

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%

.NET 8 (YARP)

Throughput:     120,000 - 150,000 req/s
Latency (p50):  0.8ms
Memory:         500 MB - 1 GB

See: BACKEND_COMPARISON.md | PERFORMANCE_12CPU.md


๐Ÿ—๏ธ Architecture

Node.js - Universe Architecture (Feature-Based)

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

.NET 8 - Universe Architecture

APIGateway/
โ”œโ”€โ”€ Program.cs                   # Main entry point
โ”œโ”€โ”€ Features/                    # Feature modules
โ”‚   โ”œโ”€โ”€ Auth/
โ”‚   โ”œโ”€โ”€ Routing/
โ”‚   โ”œโ”€โ”€ Clustering/
โ”‚   โ””โ”€โ”€ Monitoring/
โ”œโ”€โ”€ Infrastructure/              # Middleware
โ””โ”€โ”€ Core/                        # Interfaces & Constants

โœจ Features

Authentication

  • โœ… JWT access tokens (15 min expiry)
  • โœ… Refresh token rotation (7 days)
  • โœ… Account lockout (5 attempts, 30 min)
  • โœ… Password hashing (bcrypt)
  • โœ… Session management

Routing

  • โœ… Dynamic HTTP routing
  • โœ… WebSocket forwarding
  • โœ… Path-based matching
  • โœ… Load balancing (round-robin)
  • โœ… Rate limiting

Management

  • โœ… User management (CRUD)
  • โœ… Route management (CRUD)
  • โœ… Cluster management (CRUD)
  • โœ… Request logging
  • โœ… Real-time metrics
  • โœ… Permission-based access control

Operations

  • โœ… Auto-scaling (PM2 cluster)
  • โœ… Auto-restart on crash
  • โœ… Zero-downtime reload
  • โœ… Graceful shutdown
  • โœ… Health checks
  • โœ… Error handling

๐Ÿ”Œ API Endpoints

Authentication

POST   /auth/login          - Login
POST   /auth/refresh        - Refresh token
POST   /auth/logout         - Logout

Management (requires auth)

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

Health Check

GET    /health              - Health check

๐Ÿš€ Deployment

Node.js - Production Deployment

# 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

.NET 8 - Production Deployment

# Publish
cd APIGateway/APIGateway
dotnet publish -c Release -o ../../publish/backend

# Run
cd ../../publish/backend
./APIGateway

Admin UI - Production Build

cd gateway-admin
npm run build

# Deploy dist/ to nginx or static hosting

See: DEPLOYMENT.md | DEPLOYMENT_PACKAGE.md


๐Ÿ“ˆ Auto-Scaling (Node.js)

PM2 Cluster Mode

// 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'
  }]
};

Scaling Commands

# 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


๐Ÿ”ง Configuration

Node.js (.env)

PORT=8887
JWT_SECRET=your-secret-key-min-32-chars
NODE_ENV=production

.NET 8 (appsettings.json)

{
  "ConnectionStrings": {
    "GatewayDb": "Data Source=gateway.db"
  },
  "Jwt": {
    "Secret": "your-secret-key",
    "Issuer": "APIGateway",
    "Audience": "GatewayClients"
  }
}

๐Ÿ“Š Monitoring

PM2 Monitoring (Node.js)

# Real-time monitoring
pm2 monit

# Process list
pm2 list

# Logs
pm2 logs gateway-node

# Metrics
pm2 describe gateway-node

Application Metrics

curl -H "Authorization: Bearer <token>" \
  http://localhost:8887/admin/metrics

Response:

{
  "totalRequests": 1000000,
  "successRequests": 950000,
  "failedRequests": 50000,
  "successRate": "95.00",
  "avgLatency": 8,
  "wsConnections": 100,
  "wsMessages": 50000,
  "uptime": 86400
}

๐Ÿงช Testing

Health Check

curl http://localhost:8887/health

Login

curl -X POST http://localhost:8887/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"admin123"}'

WebSocket Test

Open websocket-test.html in browser or use wscat:

wscat -c ws://localhost:8887/ws/echo

๐Ÿ“š Documentation

Deployment & Operations

  • DEPLOYMENT.md - Full deployment guide
  • AUTO_SCALING.md - PM2 cluster mode
  • DEPLOYMENT_PACKAGE.md - Complete package

Performance & Analysis

  • 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

Features & Capabilities

  • WEBSOCKET_SUPPORT.md - WebSocket capabilities
  • FEATURES_COMPLETE.md - Feature list
  • AUTH_IMPLEMENTATION.md - Auth guide

.NET 8 Specific

  • LOAD_TESTING_GUIDE.md - Load testing
  • DESIGN_UARCH.md - Architecture design

๐Ÿ† Performance Comparison

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)

See: BACKEND_COMPARISON.md


๐Ÿ›ก๏ธ Security

  • โœ… 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

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


๐Ÿ“„ License

MIT License - see LICENSE file for details


๐Ÿ™ Acknowledgments

  • 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

๐Ÿ“ž Support

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

About

Production-ready API Gateway built with YARP (.NET 8) โ€” JWT auth, failover, rate limiting, circuit breaker, traffic metrics, admin dashboard (React)

Topics

admin-dashboardapi-gatewaycircuit-breakercsharpdotnetfailoverhealth-checkjwt-authenticationrate-limitingreactreverse-proxytraffic-metricsyarp

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.