How mcaqnn1/gochat works
This Go chat backend exposes HTTP authentication/user endpoints and a gRPC room-creation endpoint. The visible registration/login flow validates users, hashes passwords through the user service, persists records, and issues JWTs; room creation is handled through gRPC. The source excerpts show startup wiring and selected request paths, but the README is empty and substantial service, room-storage, Redis, and HTTP-server details were not sampled, so uncertain connections are omitted.
Main entry points: main.go Application startup · auth.go Auth endpoints · server.go gRPC server · user.go User operations
Components 24
API transports
- Application startup
cmd/app/main.go - HTTP server
internal/transport/http/server.go - HTTP routes
internal/transport/http/router.go - Auth endpoints
internal/handler/auth.go - User endpoints
internal/handler/user.go - gRPC server
internal/transport/grpcserver/server.go - Room endpoint
internal/handler/room.go - Room gRPC contract
proto/room.proto
Domain services
- User operations
internal/service/user.go - Room operations
internal/service/room.go - Email delivery
internal/service/email_service.go - Domain models
internal/model/models.go
Identity security
- Token service
internal/service/auth_service.go - JWT manager
internal/pkg/jwt/manager.go - Password hashing
internal/pkg/hash/password.go - Auth middleware
internal/transport/middleware.go
Persistence
- User repository
internal/storage/user.go - Room repository
internal/storage/room.go - PostgreSQL pool
internal/utils/database/pg/postgres.go - Redis cache
internal/utils/database/redis/cache.go - Configuration
internal/utils/configs/config.go
Other components
- API client
- gRPC client
- SMTP service
Connections 26
- API client → HTTP server: sends requests
- HTTP server → HTTP routes: serves routes
- HTTP routes → Auth endpoints: routes auth
internal/transport/http/router.go - API client → Auth endpoints: registers or logs in
internal/handler/auth.go - Auth endpoints → User operations: looks up and creates
internal/handler/auth.go - Auth endpoints → Password hashing: checks password
internal/handler/auth.go - Auth endpoints → Token service: generates or validates
internal/handler/auth.go - Auth endpoints → Email delivery: requests welcome email
internal/handler/auth.go - Email delivery → SMTP service: sends mail
internal/service/email_service.go - User operations → User repository: uses repository
internal/service/user.go - User repository → PostgreSQL pool: queries users
internal/storage/user.go - Token service → JWT manager: delegates tokens
internal/service/auth_service.go - Auth middleware → JWT manager: validates tokens
internal/transport/middleware.go - gRPC client → gRPC server: calls room API
internal/transport/grpcserver/server.go - gRPC server → Room endpoint: registers service
internal/transport/grpcserver/server.go - Room gRPC contract → gRPC server: defines service
- Room endpoint → Room operations: creates room
internal/handler/room.go - Room operations → Room repository: uses repository
internal/service/room.go - Application startup → Configuration: loads settings
cmd/app/main.go - Application startup → PostgreSQL pool: opens pool
cmd/app/main.go - Application startup → Redis cache: opens cache
cmd/app/main.go - Application startup → HTTP server: starts server
cmd/app/main.go - Application startup → gRPC server: starts server
cmd/app/main.go - Application startup → Room endpoint: constructs handler
cmd/app/main.go - User operations → Domain models: uses models
internal/service/user.go - Room operations → Domain models: uses models
internal/service/room.go