How zvash/bgmood-api-gateway works
bgmood-api-gateway is a gRPC gateway for authentication, circle management, and mood-sharing operations. Clients call the registered gRPC API; handlers in internal/gapi forward supported operations to downstream auth and circle services, adapting request context and streaming API calls. The tree documents additional session, email-verification, circle-membership, reaction, and file-upload capabilities. Source excerpts show auth forwarding and server registration; detailed wiring for other handlers and the file client was not sampled, so those links are omitted where uncertain.
Main entry points: main.go gRPC server · gapi API handlers · rpc_auth_service_methods.go Auth handlers · auth_service_client.go Auth client
Components 18
Gateway API
- gRPC server
main.go - API handlers
internal/gapi - App API contract
internal/pb/api_service_grpc.pb.go
Identity
- Auth handlers
internal/gapi/rpc_auth_service_methods.go - Request context
internal/gapi/client_context.go - Auth client
internal/client/auth_service_client.go - Auth RPC contract
internal/authpb/service_auth_grpc.pb.go
Circles and mood
- Circle and mood handlers
internal/gapi - Circle client
internal/client/circle_service_client.go - Circles RPC contract
internal/cpb/service_circles_grpc.pb.go - File client
internal/client/file_service_client.go - File RPC contract
internal/filepb/service_file_grpc.pb.go
Runtime and telemetry
- Server metrics
internal/prom/server_metrics.go - Metrics endpoint
main.go - Runtime config
internal/util/config.go
Other components
- gRPC client
- Auth service
- Circles service
Connections 16
- gRPC client → gRPC server: calls gRPC
- gRPC server → App API contract: registers API
- gRPC server → API handlers: serves requests
- gRPC server → Server metrics: instruments RPCs
- gRPC server → Metrics endpoint: starts endpoint
- gRPC server → Runtime config: loads config
- API handlers → Auth handlers: dispatches auth
- Auth handlers → Request context: builds context
- Auth handlers → Auth client: forwards auth RPCs
- Auth client → Auth RPC contract: invokes RPCs
- Auth RPC contract → Auth service: sends RPCs
- API handlers → Circle and mood handlers: dispatches app RPCs
- Circle and mood handlers → Circle client: forwards circle RPCs
- Circle client → Circles RPC contract: invokes RPCs
- Circles RPC contract → Circles service: sends RPCs
- Metrics endpoint → gRPC client: exposes metrics