Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go API Gateway

Production-grade API Gateway built with Go for secure, scalable, and high-performance microservice communication.

Overview

Go API Gateway acts as a centralized entry point for backend services. It handles authentication, request routing, load balancing, rate limiting, logging, and observability while simplifying communication between clients and microservices.

This project demonstrates production-level backend engineering concepts commonly used in modern cloud-native systems.


Key Features

Traffic Management

  • Request Routing
  • Reverse Proxy
  • Load Balancing
  • Service Discovery

Security

  • JWT Authentication
  • API Key Validation
  • Role-Based Access Control (RBAC)
  • Request Validation

Reliability

  • Rate Limiting
  • Circuit Breaker
  • Retry Mechanism
  • Timeout Handling

Observability

  • Structured Logging
  • Request Tracing
  • Metrics Collection
  • Health Monitoring

Performance

  • Connection Pooling
  • Concurrent Request Handling
  • Response Compression
  • Efficient Routing Engine

Developer Experience

  • Docker Support
  • Environment Configuration
  • CI/CD Pipelines
  • Swagger API Documentation

Architecture

                 Client
                    |
                    v
          +------------------+
          |   API Gateway    |
          +------------------+
             |      |      |
             |      |      |
             v      v      v

        User    Payment   Notification
       Service  Service     Service

Tech Stack

Component Technology
Language Go
HTTP Server net/http
Framework Gin
Authentication JWT
Containerization Docker
CI/CD GitHub Actions
Documentation Swagger/OpenAPI
Monitoring Prometheus
Visualization Grafana

Core Functionalities

Authentication Middleware

  • JWT Validation
  • Token Parsing
  • Access Control

Reverse Proxy

  • Request Forwarding
  • Response Handling
  • Header Management

Rate Limiter

  • IP-based Limiting
  • User-based Limiting
  • Burst Protection

Load Balancer

Supported Strategies:

  • Round Robin
  • Least Connections
  • Random Selection

Service Discovery

  • Dynamic Service Registration
  • Service Health Tracking

Project Structure

go-api-gateway/

├── cmd/
│   └── server/
│
├── internal/
│   ├── config/
│   ├── gateway/
│   ├── middleware/
│   ├── proxy/
│   ├── loadbalancer/
│   ├── discovery/
│   ├── auth/
│   ├── logging/
│   └── metrics/
│
├── docs/
├── tests/
├── docker/
│
├── .github/
│   └── workflows/
│
├── Dockerfile
├── docker-compose.yml
├── go.mod
└── README.md

API Endpoints

Health Check

GET /health

Metrics

GET /metrics

Gateway Route Example

GET /api/users

Forwarded To:

http://user-service/api/users

Planned Enhancements

  • WebSocket Proxy
  • gRPC Gateway Support
  • Distributed Rate Limiting
  • Kubernetes Deployment
  • OpenTelemetry Integration
  • AI-powered Traffic Analytics

Performance Goals

  • Handle 10,000+ concurrent connections
  • Low-latency request forwarding
  • High availability architecture
  • Fault-tolerant service routing

Local Development

Clone Repository

git clone https://github.com/karkra911/go-api-gateway.git
cd go-api-gateway

Run

go run cmd/server/main.go

Docker

docker-compose up --build

Skills Demonstrated

  • Backend Development
  • Distributed Systems
  • Reverse Proxy Engineering
  • Authentication & Authorization
  • Network Programming
  • Microservices Architecture
  • System Design
  • DevOps Fundamentals

Why This Project?

Modern companies such as Netflix, Uber, Amazon, and Spotify rely on API Gateway architectures to manage large-scale distributed systems.

This project showcases the practical backend engineering skills required for software engineering, backend development, cloud engineering, and remote Go developer roles.


License

Licensed under the MIT License.

About

Production-grade API Gateway built with Go, JWT Authentication, Rate Limiting, Reverse Proxy, Load Balancing, Service Discovery, Docker, and Observability.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages