How aanorlondo/go-auth-middleware works
Project Type & Purpose
• This is a Dockerized, Go-based authentication microservice (“go-auth-middleware”) that exposes a RESTful HTTP API for signing up, logging in, user management and role-based access control (RBAC).
• It uses MySQL for persistent user data, Redis for caching and RBAC storage, JWT for stateless authentication, and Swagger for API documentation.
Core File Structure & Architectural Patterns
• Top-Level Directories:
• app/ : the Go application (config, models, server, middleware, utils, main entry point)
• db/ : Dockerfiles and init templates for MySQL and Redis
• scripts/ : Bash scripts to prepare env, spin up containers, initialize databases
• Layered Organization (akin to MVC + middleware + utils):
• config – environment & connection settings
• models – data access layer for MySQL
• server/api – Swagger/OpenAPI spec
• server/handlers – HTTP controllers (auth, user, rbac)
• server/middleware – JWT validation
• utils – logging & JWT helper functions