Skip to content

ParthHalwane/TurboGate

Repository files navigation

TurboGate πŸš€ - High Performance Reverse Proxy with Rate Limiting

TurboGate Banner

A blazing-fast, production-grade Reverse Proxy built with Golang, featuring dynamic route configuration, rate limiting, hot-reloadable YAML-based routing, and performance benchmarking up to 2 million requests per minute.


πŸ”— What is a Reverse Proxy?

A Reverse Proxy is a server that sits between the client and one or more backend servers, forwarding client requests to those backend services and returning their responses. It is used for:

  • Load balancing
  • Caching
  • SSL termination
  • Web acceleration
  • Rate limiting and security

Unlike a forward proxy (which sits in front of the client), a reverse proxy operates on behalf of the server.


πŸš€ About TurboGate

TurboGate is designed to be a plug-and-play, scalable reverse proxy solution that supports:

  • Dynamic route additions at runtime
  • YAML-based routing configuration
  • IP-based token bucket rate limiting
  • Prometheus-compatible metrics
  • High concurrency with Go's net/http and goroutines

This project was created to demonstrate not just how reverse proxies work under the hood, but also how to build a production-ready reverse proxy from scratch, while emphasizing performance and extensibility.


πŸ“Š Key Features

  • βœ… Dynamic Routing: Add/remove proxy routes in real-time via hot-reloadable YAML.
  • βœ… Token Bucket Rate Limiting: Per-IP request throttling to prevent abuse.
  • βœ… Prometheus Metrics: Integrated monitoring with /metrics endpoint.
  • βœ… High Throughput: Benchmarked at up to 2 million requests/min.
  • βœ… Fully Dockerized: Easy deployment and local testing.
  • βœ… Simple Frontend: Enter a domain and get a working proxy route.
  • βœ… API for Route Management: Seamlessly integrate dynamic route control.

πŸ“Ή Project Demo & Walkthrough

πŸ” Project Walkthrough

TurboGate.WallThrough.mp4

πŸ”’ JMeter Load Test

4.1.mp4

πŸ–ΌοΈ Performance Snapshot

2 Million RPM

Achieved almost 2,000,000 requests per minute during JMeter benchmarking on a multi-core instance


πŸ“š Tech Stack

  • Language: Go (Golang)
  • Concurrency: Native goroutines & channels
  • Routing Configuration: YAML
  • Rate Limiting: Token bucket algorithm
  • Metrics: Prometheus-compatible
  • Deployment: Docker & Render
  • Frontend: React + Tailwind (Vercel hosted)

⚠️ Why Some Websites Can’t Be Proxied?

Due to modern web security protocols like CORS (Cross-Origin Resource Sharing) and X-Frame-Options, not all websites allow themselves to be reverse proxied, especially through browsers. This is a deliberate protection mechanism against:

  • Clickjacking
  • Cross-site forgery
  • Content manipulation

So, even if TurboGate fetches the content server-side, some websites may still block rendering in the client browser.


πŸ§ͺ Getting Started

Follow these steps to get the project running locally:


πŸ” Backend Setup (Go)

# 1. Clone the repo
git clone https://github.com/yourusername/turbogate.git
cd turbogate

# 2. Build and run
go run cmd/main.go

Alternatively, using docker:

# Docker Build & Run
docker build -t turbogate .
docker run -p 8080:8080 turbogate

Frontend setup:

# 1. Navigate to frontend directory
cd frontend

# 2. Install dependencies
npm install

# 3. Run development server
npm run dev

πŸ§ͺ API Usage βž• Add New Route (POST)

POST /api/add-route
Content-Type: application/json

{
  "path": "/youtube",
  "target": "https://youtube.com"
}

πŸ“„ YAML Configuration Format

routes:
  - path: /github
    target: https://github.com
  - path: /openai
    target: https://openai.com

🌍 Some Publicly Proxyable Sites

These URLs typically allow reverse proxying:

https://github.com

https://openai.com

https://example.com

https://golang.org

https://jsonplaceholder.typicode.com

https://pokeapi.co

⚠️ Websites with strict CORS/X-Frame-Options may fail to load in browser.


πŸ’‘ Future Enhancements

βœ… TLS termination with custom domain support

βœ… Basic Auth or API keys for route creation

βœ… Caching layer (Redis or in-memory)

βœ… WebSocket support

βœ… Admin dashboard with metrics visualizations

βœ… PostgreSQL or Redis-based persistent route store

βœ… Vercel button for one-click deploy


πŸ“ License

This project is licensed under the MIT License. Feel free to use, modify, or extend it with proper attribution.


πŸ™ Acknowledgments

Inspired by tools like NGINX, Traefik, and Caddy

Special thanks to the Go community

Load testing powered by Apache JMeter

About

High Performance Reverse Proxy with Rate Limiting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published