stocklet

module
v0.0.0-...-531b5da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: AGPL-3.0

README ΒΆ

Stocklet

An event-driven microservices-based distributed e-commerce example application written in Golang. (mouthful)

πŸ“˜ About

This project was originally built as an experiment with event-driven architecture. But I hope it can future serve as a beneficial demonstration of utilising the architecture and exemplify the implementation of some other miscellaneous microservice patterns.

Any ideas, suggestions or direct contributions to better conform with general and evolving industry practices are welcome and will be greatly appreciated, as I'd like for this project to evolve to the stage of being somewhat a reflection of a production-ready enterprise application.

⚠️ The application should be considered in the experimental prototype stage. Breaking changes can be expected between any future commits to this repo, in order to ease the development process and allow for clean refactoring of the project.

πŸ“ Features

  • Monorepository layout
  • Microservice architecture
  • Event-driven architecture
  • Interfacing with services using gRPC
  • User-facing RESTful HTTP APIs with gRPC-Gateway
  • Distributed tracing with OpenTelemetry
  • Transactional outbox pattern with Debezium
  • API gateway pattern using Envoy
  • Distributed transactions utilising the saga pattern

πŸ—ƒοΈ Architecture

πŸ”Ž Overview

Architecture Overview

🧰 Technical Stack
Libraries, Frameworks and Tools
Infrastructure
🧩 Services
Name gRPC (w/ Gateway) Produces Events Consumes Events
auth βœ”οΈ ❌ βœ”οΈ
order βœ”οΈ βœ”οΈ βœ”οΈ
payment βœ”οΈ βœ”οΈ βœ”οΈ
product βœ”οΈ βœ”οΈ βœ”οΈ
shipping βœ”οΈ βœ”οΈ βœ”οΈ
user βœ”οΈ βœ”οΈ ❌
warehouse βœ”οΈ βœ”οΈ βœ”οΈ

Each service is prepared by a service-init container; a deployment responsible for performing any database migrations and configuring Debezium outbox connectors for that service.

πŸ“‡ Events

The events are schemed and serialised using protocol buffers. They are dispatched using the transactional outbox pattern, with Debezium used as a relay to read and publish events from database outbox tables to the message broker.

Further documentation on the events can be found at /docs/EVENTS.md

πŸ’» Deployment

Using Docker

The application can be deployed using Docker Compose (with the compose files located in /deploy/docker/). Ensure the correct configuration is in place by copying and removing .example from the end of the example environment files located in /deploy/configs/.

Deploy using the following command: docker compose -f deploy/docker/compose.yaml -f deploy/docker/compose.override.yaml up --build

πŸ§ͺ Contributing

If you like this project then please leave a ⭐ to show your support. All forms of feedback and contributions are welcome and greatly appreciated!

Have any ideas for improvements? Please don't hesistate to open an issue to discuss, or a pull request with enhancements.

πŸ““ License

This project is licensed under the GNU Affero General Public License v3.

Directories ΒΆ

Path Synopsis
cmd
internal
pkg/protogen/auth/v1
Package auth_v1 is a reverse proxy.
Package auth_v1 is a reverse proxy.
pkg/protogen/order/v1
Package order_v1 is a reverse proxy.
Package order_v1 is a reverse proxy.
pkg/protogen/payment/v1
Package payment_v1 is a reverse proxy.
Package payment_v1 is a reverse proxy.
pkg/protogen/product/v1
Package product_v1 is a reverse proxy.
Package product_v1 is a reverse proxy.
pkg/protogen/shipping/v1
Package shipping_v1 is a reverse proxy.
Package shipping_v1 is a reverse proxy.
pkg/protogen/user/v1
Package user_v1 is a reverse proxy.
Package user_v1 is a reverse proxy.
pkg/protogen/warehouse/v1
Package warehouse_v1 is a reverse proxy.
Package warehouse_v1 is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL