Skip to content

RitikaSonawane09/api-security-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Security Gateway (Go)

A lightweight, production-style API Security Gateway built in Go that enforces security controls, detects anomalies, and provides observability using Prometheus.


Overview

This project implements a reverse proxy-based API gateway that sits in front of backend services and enforces:

  • Authentication (JWT)
  • Rate Limiting (Redis-backed, distributed)
  • Anomaly Detection (risk scoring engine)
  • Observability (Prometheus metrics)
  • Config-driven policies (YAML)

Architecture

Client → API Gateway → Backend Service
           │
           ├── JWT Authentication
           ├── Rate Limiting (Redis)
           ├── Anomaly Detection
           ├── Metrics Collection
           └── Logging (JSON)

Features

Security Controls

  • JWT validation with signing method verification
  • Configurable enable/disable via YAML
  • Protection against unauthorized access

Distributed Rate Limiting

  • Redis-backed limiter
  • Per-IP request tracking
  • Configurable RPS and window
  • Works across multiple instances (scalable)

Anomaly Detection Engine

  • Detects:

    • Missing headers
    • Suspicious User-Agents
    • Large payloads
  • Risk scoring system

  • Structured logging (JSON)

Observability

  • Prometheus metrics endpoint (/metrics)

  • Tracks:

    • Total requests
    • Request paths
  • Includes Go runtime metrics (memory, CPU, goroutines)

Health Monitoring

  • /health endpoint for uptime checks

Project Structure

api-security-gateway/
│
├── cmd/
│   └── main.go
│
├── internal/
│   ├── config/
│   ├── middleware/
│   ├── proxy/
│   ├── metrics/
│   └── store/ (Redis)
│
├── configs/
│   └── config.yaml
│
├── Dockerfile
├── docker-compose.yml
└── go.mod

Key Highlights

  • Built using Go standard library + minimal dependencies
  • Demonstrates security engineering mindset
  • Implements distributed rate limiting with Redis
  • Production-style observability (Prometheus)
  • Config-driven architecture (Security as Code)

Why This Project Matters

This project demonstrates real-world skills in:

  • API Security
  • Distributed Systems
  • Backend Engineering (Go)
  • Observability & Monitoring
  • Secure System Design

Built as part of hands-on learning in security engineering and backend systems.

Give it a star and feel free to contribute!

About

Lightweight Go-based API Security Gateway implementing JWT authentication, Redis-backed rate limiting, anomaly detection, and Prometheus observability.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors