How msardary/user-management-chat works
Project type and purpose
• This is a Go-based user management system with real-time chat, organized as a modular microservices-style API. It provides JWT authentication, role management, chat messaging, and built-in monitoring/logging via Prometheus, Loki, and Grafana.
File structure
• cmd/app: single entrypoint (main.go) that boots the API server
• internal/: core business domains
• auth: handlers, middleware, service, model for JWT and role checks
• user: user CRUD and listing
• chat: real-time messaging service and client integration
• db: Postgres connection, migrations, SQLC queries
• config: application configuration loader
• server: router, middleware, logger, Prometheus instrumentation, HTTP server
• health: liveness/readiness endpoints
• pkg/: reusable utilities (Redis client/cache, token/hash utils, HTTP response helpers, validation)
• docker-compose.yml + Dockerfile: container definitions for API, Postgres, Redis, Prometheus, Loki, Grafana, Promtail
• prometheus/, loki-config.yaml, promtail-config.yaml: observability setup
README for additional insights
• Architecture: monolithic Go API broken into domain modules (auth, user, chat)
• Data stores: PostgreSQL for persistent data, Redis for message caching
• Monitoring: Prometheus client library inside Go service, scraped by Prometheus
• Logging: structured logs shipped via Promtail to Loki, visualized in Grafana
Detail
• Ports and protocols (e.g., “HTTP 8080”, “gRPC/REST”, “Redis TCP 6379”).
• Docker Compose orchestration layer if deployment topology is relevant.