Skip to content

a PoC Sneaker Marketplace API built on event-driven architecture

Notifications You must be signed in to change notification settings

Eddie4k-code/SneakerStop

Repository files navigation

Sneaker Marketplace PoC

P.S (This has been by far my favorite side project so far xD)

Overview

This project is a proof of concept for a sneaker marketplace built on a microservices architecture, utilizing Kafka for event-driven communication between services. Docker and Kubernetes are employed for containerization and orchestration, with Terraform used for provisioning Kubernetes manifests.

Architecture

The architecture of the system is based on microservices, each serving a specific function within the sneaker marketplace ecosystem. Kafka acts as the central event bus for communication between these services, enabling decoupling and scalability.

Swagger API Documentation

This project uses Swagger for API documentation. You can access the Swagger UI for different services to explore and test the API endpoints.

What About Order of Events/Messages?

Kafka provides the ability to associate keys with messages. When a message in Kafka is sent with a key, all messages sharing the same key will always go to the same parition in a topic. This helps maintain proper ordering of messages. Without a key, messages are distributed in a round-robin fashion across paritions in a topic.

What About Duplicate Events?

Idempotent

Within the Kafka Producers we have set idempotent to true. This configuration will help ensure that duplicate messages are not introduced due to events such as unexpected retries. When a producer sends a message, it will be assigned a Producer Id. The Kafka Broker will keep track of the largest PID-Sequence number combination sucessfully written, discarding lower sequence numbers.

CI/CD Workflow

TODO ADD

Runbook

Provision Infrastructure

Terraform Environment Variables

Generate a .tfvars file in the appropriate environment directory (dev, stage, prod) including the following variables -

jwt_secret stripe_secret

Command

Within the root directory make apply will provision all needed infrastructure.

Tear-Down Infrastructure

Within the root directory make destroy will destroy all provisioned infrastructure.

Main Technologies Used

  • Typescript
  • Express
  • Node.Js
  • Kafka
  • Docker
  • Kubernetes (k8s)
  • Terraform