How kemalkochekov/grpc-server works
This Go service exposes student and class-information CRUD over gRPC, with an HTTP/JSON gateway translating REST requests into RPC calls. Those handlers validate and transform requests, persist records in PostgreSQL, and publish operation events to Kafka; a background consumer reads Kafka messages. Startup also configures logging and Jaeger tracing. The excerpts establish these principal paths, but do not show class-info’s proto contract or the detailed SQL implementations, so those relationships are limited to what the handlers and startup wiring demonstrate.
Main entry points: studentHandler.go Student service · classInfoHandler.go Class info service · router.go gRPC server · gatewayRouter.go HTTP gateway
Components 19
API access
- HTTP gateway
internal/server/gatewayRouter.go - gRPC server
internal/server/router.go - Student RPC contract
proto/student.proto - Class RPC contract
proto/classInfo.proto
Domain operations
- Student service
internal/server/studentHandler.go - Class info service
internal/server/classInfoHandler.go - Student model
internal/server/serviceEntities/student.go - Class info model
internal/server/serviceEntities/classInfo.go
Persistence
- Student repository
internal/repository/studentPg.go - Class repository
internal/repository/classInfoPg.go - Database access
pkg/connection/connection.go - PostgreSQL
Kafka messaging
- Kafka producer
internal/kafka/producer.go - Kafka consumer
internal/kafka/consumer.go - Kafka broker
Runtime services
- DB configuration
internal/configs/dbConfig.go - Structured logging
internal/logger/logger.go - Jaeger tracing
Other components
- API client
Connections 25
- API client → HTTP gateway: sends HTTP
README.md - HTTP gateway → gRPC server: proxies RPC
internal/server/gatewayRouter.go - gRPC server → Student service: dispatches calls
- gRPC server → Class info service: dispatches calls
- Student RPC contract → HTTP gateway: defines HTTP routes
proto/student.proto - Class RPC contract → HTTP gateway: defines HTTP routes
- Student service → Student repository: calls CRUD
internal/server/studentHandler.go - Class info service → Class repository: calls CRUD
internal/server/classInfoHandler.go - Student service → Kafka producer: publishes events
internal/server/studentHandler.go - Class info service → Kafka producer: publishes events
internal/server/classInfoHandler.go - Kafka producer → Kafka broker: writes messages
- Kafka broker → Kafka consumer: delivers messages
- Student repository → Database access: uses database
- Class repository → Database access: uses database
- Database access → PostgreSQL: queries
pkg/connection/connection.go - DB configuration → Database access: configures connection
pkg/connection/connection.go - Student service → Student model: maps requests
internal/server/studentHandler.go - Class info service → Class info model: maps requests
internal/server/classInfoHandler.go - Student service → Jaeger tracing: creates spans
internal/server/studentHandler.go - Class info service → Jaeger tracing: creates spans
internal/server/classInfoHandler.go - API client → gRPC server: calls RPC
- gRPC server → Student RPC contract: serves contract
- gRPC server → Class RPC contract: serves contract
- Student service → Structured logging: logs operations
internal/server/studentHandler.go - Class info service → Structured logging: logs operations
internal/server/classInfoHandler.go