Skip to content

HpPpL/go-microservices-course-project

Repository files navigation

Go Microservices Course Project

Coverage Go License: MIT

A learning project built while following the «Микросервисы, как в BigTech 2.0» course by Oleg Kozyrev.

It implements a small "rocket factory" domain as a set of Go microservices that communicate over gRPC, expose HTTP APIs via grpc-gateway, and persist data in PostgreSQL and MongoDB.

Architecture

The repository is a Go workspace (go.work) composed of several modules:

Module Responsibility Storage
order Order lifecycle: create, pay, cancel, get PostgreSQL
inventory Parts catalog and availability MongoDB
payment Payment processing
platform Shared infrastructure (logger, closer, gRPC, middleware)
shared Generated API code and protobuf/OpenAPI contracts

Services follow a layered architecture (apiservicerepositoryclient) with generated mocks for unit testing.

order ──gRPC──> inventory   (check part availability)
order ──gRPC──> payment     (process payment)
client ──HTTP──> order      (via grpc-gateway)

Tech stack

  • Go 1.24 with a multi-module workspace
  • gRPC + grpc-gateway (HTTP/JSON) and protoc-gen-validate
  • buf for protobuf management; ogen for OpenAPI
  • PostgreSQL (order) and MongoDB (inventory)
  • goose for SQL migrations
  • mockery for test mocks
  • Docker Compose for local infrastructure
  • Task (Taskfile) for automation
  • golangci-lint, gofumpt, gci for formatting and linting
  • GitHub Actions for CI and test-coverage reporting

Getting started

Prerequisites

  • Go 1.24+
  • Docker & Docker Compose
  • Task: brew install go-task

The pinned CLI tools (buf, ogen, mockery, goose, linters, …) are installed automatically into ./bin the first time a task that needs them runs.

Configure environment

Environment files are generated from the templates in deploy/env:

task env:generate

The committed *.env.template files contain local development defaults only (localhost hosts and placeholder credentials) — replace them before any real deployment.

Run

# start infrastructure + services via Docker Compose (runs migrations)
task up-all

# ...or run a single service locally
go run ./order/cmd

# stop everything
task down-all

Development

task format         # gofumpt + gci
task lint           # golangci-lint
task test           # run tests
task test-coverage  # run tests with coverage report
task gen            # regenerate protobuf / OpenAPI / mocks

See Taskfile.yml for the full list of available commands.

License

MIT © Matvey Kolodin

About

Go microservices learning project — gRPC + grpc-gateway, PostgreSQL & MongoDB, Docker Compose. Built during the «Микросервисы, как в BigTech 2.0» course.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors