Video summary

Golang Microservices Full Course #27 - Splitting Ledger Service

Main summary

Key takeaways

Technology

Summary

This episode walks through extracting the ledger from the wallet monolith into a standalone Ledger Service.

  • Ledger API: The service provides an operation to record debit or credit history and a reconciliation operation that compares the wallet balance with the ledger balance.
  • Service setup: A separate Go service is created with its own command, internal packages, gRPC server, handlers, model, repository, and service logic. A ledger proto is added and generated for gRPC communication.
  • Database and deployment: The walkthrough adds a ledger database migration and table, then updates the API gateway, service configuration, Dockerfiles, Docker Compose setup, and Go workspace so the new service can run alongside the existing services.
  • Testing: After rebuilding and starting the application, the presenter registers and logs in, then tests the ledger mutation and reconciliation requests. Reconciliation succeeds in the demonstrated test.
  • Money precision: Floating-point balance and amount fields are replaced with strings at API and proto boundaries, while the wallet code uses a decimal type. This avoids floating-point precision errors in monetary calculations.

Guide Steps

  1. Create and configure the Ledger Service.
  2. Define and generate its gRPC proto.
  3. Add the ledger database migration and service wiring.
  4. Route ledger requests through the API gateway and Docker Compose.
  5. Test ledger operations and reconcile balances.
  6. Use decimal-safe handling for monetary values instead of floating-point values.

Main Speaker

Ikhda Muhammad Wildani narrates the coding walkthrough.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video