How studenikin-k/bank_proto_microservice works
This is a Go banking microservices application: clients use an HTTP API gateway for authentication, account access, and transactions, while separate gRPC services own those domains. The transaction service is configured with an account-service client and a worker pool; the account service supports Redis caching and background fee sweeping, and transactions support background recovery. The excerpts show service construction and wiring, but not most handler or service internals; dashed edges mark relationships that are plausible from the component roles but not directly evidenced here.
Main entry points: account_service/main.go Account runtime · api-gateway/main.go Gateway runtime · transaction_service/main.go Transaction runtime · auth_service/main.go Auth runtime
Components 25
HTTP Gateway
- Gateway runtime
cmd/api-gateway/main.go - HTTP handlers
internal/gateway/handlers/gateway_handlers.go - JWT middleware
internal/gateway/middleware/auth.go
Authentication
- Auth runtime
cmd/auth_service/main.go - Auth gRPC handler
internal/auth/delivery/grpc/auth_handler.go - Credential and token logic
internal/auth/service/auth_service.go - User repository
internal/auth/repository/user_repository.go - User model
internal/auth/models/user.go - Auth database
Accounts
- Account runtime
cmd/account_service/main.go - Account gRPC handler
internal/account/delivery/grpc/account_handler.go - Account logic
internal/account/service/account_service.go - Account repository
internal/account/repository/account_repository.go - Redis cache
internal/account/cache/redis.go - Account model
internal/account/models/account.go - Account database
- Redis
Transactions
- Transaction runtime
cmd/transaction_service/main.go - Transaction gRPC handler
internal/transaction/delivery/grpc/transaction_handler.go - Transaction logic and recovery
internal/transaction/service/transaction_service.go - Transaction repository
internal/transaction/repository/transaction_repository.go - Worker pool
internal/transaction/worker/pool.go - Transaction model
internal/transaction/models/transaction.go - Transaction database
Other components
- Banking client
Connections 33
- Banking client → Gateway runtime: sends HTTP
- Gateway runtime → HTTP handlers: creates handlers
cmd/api-gateway/main.go - Gateway runtime → JWT middleware: configures middleware
cmd/api-gateway/main.go - Gateway runtime → Auth runtime: dials gRPC
cmd/api-gateway/main.go - Gateway runtime → Account runtime: dials gRPC
cmd/api-gateway/main.go - Gateway runtime → Transaction runtime: dials gRPC
cmd/api-gateway/main.go - HTTP handlers → Auth runtime: calls gRPC
- HTTP handlers → Account runtime: calls gRPC
- HTTP handlers → Transaction runtime: calls gRPC
- Auth runtime → Auth gRPC handler: registers server
cmd/auth_service/main.go - Auth runtime → Credential and token logic: constructs service
cmd/auth_service/main.go - Auth runtime → User repository: constructs repository
cmd/auth_service/main.go - Auth gRPC handler → Credential and token logic: delegates
- Auth gRPC handler → User repository: uses repository
- User repository → Auth database: reads and writes
- Account runtime → Account gRPC handler: registers server
cmd/account_service/main.go - Account runtime → Account logic: constructs service
cmd/account_service/main.go - Account runtime → Account repository: constructs repository
cmd/account_service/main.go - Account runtime → Redis cache: configures cache
cmd/account_service/main.go - Account gRPC handler → Account logic: delegates
- Account logic → Account repository: uses repository
- Account logic → Redis cache: uses cache
- Account repository → Account database: reads and writes
- Redis cache → Redis: caches data
- Transaction runtime → Transaction gRPC handler: registers server
cmd/transaction_service/main.go - Transaction runtime → Transaction logic and recovery: constructs service
cmd/transaction_service/main.go - Transaction runtime → Transaction repository: constructs repository
cmd/transaction_service/main.go - Transaction runtime → Worker pool: starts pool
cmd/transaction_service/main.go - Transaction gRPC handler → Transaction logic and recovery: delegates
- Transaction logic and recovery → Transaction repository: uses repository
- Transaction logic and recovery → Worker pool: dispatches work
- Transaction logic and recovery → Account runtime: calls account gRPC
- Transaction repository → Transaction database: reads and writes