How prajyotdev530/rate-limiter works
RLaaS accepts API-keyed rate checks, loads each key's policy, evaluates it against Redis state, returns a decision, and records it for analytics. Its dashboard manages keys and presents live statistics and request logs, with a request tester for exercising limits. The graph includes the documented analytics and management branches; unsampled handler details and frontend pages are represented using documented routes, with those links cited to the README.
Main entry points: handlers.go API Handlers · page.tsx Dashboard · api.ts Typed API Client · postgres.go PostgreSQL
Components 20
Rate Limit API
- HTTP Server
backend/cmd/server/main.go - API Handlers
backend/internal/api/handlers.go - Gin Middleware
backend/internal/api/middleware.go - API Models
backend/internal/models/types.go
Limit Algorithms
- Algorithm Factory
backend/internal/db/redis.go - Limiter Interface
backend/internal/algorithms/interface.go - Token Bucket
backend/internal/algorithms/token_bucket.go - Sliding Window
backend/internal/algorithms/sliding_window.go
State And Analytics
- PostgreSQL
backend/internal/db/postgres.go - Redis
backend/internal/db/redis.go
Dashboard
- Dashboard
frontend/app/page.tsx - Key Management
frontend/app/keys/page.tsx - Request Logs
frontend/app/logs/page.tsx - Typed API Client
frontend/lib/api.ts - Request Tester
frontend/components/RequestTester.tsx - Live Stats Chart
frontend/components/StatsChart.tsx - Key Table
frontend/components/KeyTable.tsx - Log Table
frontend/components/LogTable.tsx
Other components
- Client Backend
- Dashboard User
Connections 29
- HTTP Server → API Handlers: routes to
backend/cmd/server/main.go - HTTP Server → PostgreSQL: initializes
backend/cmd/server/main.go - HTTP Server → Redis: initializes
backend/cmd/server/main.go - API Handlers → PostgreSQL: reads and writes
backend/internal/api/handlers.go - API Handlers → Algorithm Factory: selects limiter
backend/internal/api/handlers.go - Algorithm Factory → Token Bucket: creates
README.md - Algorithm Factory → Sliding Window: creates
README.md - Token Bucket → Limiter Interface: implements
backend/internal/algorithms/token_bucket.go - Sliding Window → Limiter Interface: implements
backend/internal/algorithms/sliding_window.go - Token Bucket → Redis: updates state
backend/internal/algorithms/token_bucket.go - Sliding Window → Redis: updates state
README.md - API Handlers → PostgreSQL: logs asynchronously
backend/internal/api/handlers.go - API Handlers → PostgreSQL: queries analytics
README.md - Client Backend → API Handlers: checks limit
README.md - API Handlers → Client Backend: returns decision
README.md - Gin Middleware → API Handlers: uses handler
README.md - Dashboard User → Dashboard: views
frontend/app/page.tsx - Dashboard → Typed API Client: loads keys
frontend/app/page.tsx - Dashboard → Live Stats Chart: renders
frontend/app/page.tsx - Dashboard → Request Tester: renders
frontend/app/page.tsx - Dashboard → Key Table: renders
frontend/app/page.tsx - Key Management → Typed API Client: manages keys
frontend/app/keys/page.tsx - Key Management → Key Table: renders
README.md - Key Management → Live Stats Chart: renders
frontend/app/keys/page.tsx - Request Logs → Typed API Client: loads logs
frontend/app/logs/page.tsx - Request Logs → Log Table: renders
frontend/app/logs/page.tsx - Request Tester → API Handlers: sends checks
frontend/components/RequestTester.tsx - Typed API Client → API Handlers: calls API
README.md - Live Stats Chart → Typed API Client: loads stats
README.md