How asguizar/microservices works
Project type and purpose
• This is a Go‐based Microservices API System (monolithic binary simulating three services) providing User, File and Audit APIs.
• It’s designed to be stateless, JWT‐secured, horizontally scalable (Docker/Compose + Nginx LB), high performance (Go, goroutines) and production ready (graceful shutdown, timeouts, CORS, rate limiting).
File structure
• Top-level files:
• main.go – single entrypoint registering all HTTP routes (User API, File API, Audit API, Security Controller, health and metrics endpoints)
• .env.example – sample environment variables for PORT, JWT_SECRET, STORAGE_PATH
• storage/ – local disk folder for file persistence (could be replaced with S3)
• go.mod/go.sum – Go module definitions
• readme.md/testing.md – documentation and test instructions
• There’s no separate “services” folder— all services live in code under main.go (or imported packages). The architecture is realized via routing groups and handlers rather than separate repos.
README for architectural insights
• ASCII art showing:
Client → Load Balancer (Nginx) → Node Instances → APIs → Database
├ User API
├ File API
└ Audit API → Security Controller
• Detailed feature list: security (JWT + bcrypt), audit logging pipeline (buffered channel), pluggable storage and database abstractions, Docker Compose scaling, Prometheus metrics.
Key callouts
• Security Controller sits in front of all APIs to enforce authentication & authorization.
• Buffered channel in Audit API for non-blocking log ingestion.
• Pluggable database interface with in-memory default and thread-safety.
• Docker Compose file snippet illustrating multiple service instances and Nginx load balancing.