Skip to content

Repository files navigation

🚀 MicroRentXPlatform is an extensive boiler plate for peer-to-peer Rental Microservices Platform

NestJS Kafka Docker

Modern, Scalable, and Flexible Microservices Boilerplate

A production-ready, event-driven microservices architecture for peer-to-peer rental platforms, built with NestJS, Kafka, and Docker.


✨ Overview

This project is a robust boilerplate for building scalable, maintainable, and cloud-ready peer-to-peer rental platforms. It leverages:

  • BFF (Backend For Frontend) Layer: Central API gateway for authentication, routing, and orchestration.
  • Domain-Driven Microservices: User, Product, and Feedback services, each with its own database and business logic.
  • Event-Driven Communication: Powered by Kafka for decoupled, resilient messaging.
  • Polyglot Persistence: Each service can use the database best suited for its needs (Postgres, MongoDB, Elasticsearch, etc.).
  • Dockerized Databases: Easy local development and zero-cost infrastructure.

🏗️ Architecture

flowchart TD
  FE[Frontend]
  BFF["BFF Layer - NestJS"]
  USER["User Microservice"]
  PRODUCT["Product Microservice"]
  FEEDBACK["Feedback Microservice"]
  POSTGRES[("Postgres DB")]
  ELASTIC[("Elasticsearch")]
  MONGO[("MongoDB")]

  FE -->|HTTP| BFF
  BFF -->|Kafka| USER
  BFF -->|Kafka| PRODUCT
  BFF -->|Kafka| FEEDBACK
  USER --> POSTGRES
  PRODUCT --> ELASTIC
  FEEDBACK --> MONGO
Loading
  • BFF Layer: Handles all HTTP requests, authentication, and hides microservices from the frontend.
  • Microservices: Each service listens to Kafka topics, processes messages, and manages its own data.
  • Kafka: Central message broker for asynchronous, decoupled communication.
  • Databases: Each service uses the most suitable database for its domain.

🌟 Why Use This Boilerplate?

  • 🔒 Security: BFF pattern ensures microservices are never exposed directly to the frontend.
  • 🧩 Modularity: Each service is independent, making it easy to extend or replace.
  • ⚡ Performance: Kafka enables high-throughput, low-latency communication.
  • 🛠️ Polyglot Persistence: Use the best database for each domain (Postgres, MongoDB, Elasticsearch).
  • 🐳 Zero-Cost Local Dev: All infrastructure (Kafka, DBs) runs locally via Docker—no cloud costs.
  • ☁️ Cloud-Ready: Easily extend to Kubernetes, AWS, GCP, or Azure.
  • 🧹 Clean Architecture: Follows SOLID, separation of concerns, and domain-driven design principles.
  • 📈 Scalable: Add new microservices or swap databases with minimal changes.

🧑‍💻 Technologies Used


💡 Key Features & Benefits

"The best architectures are those that are easy to change and scale."

  • BFF Layer: Centralizes authentication, validation, and API orchestration.
  • Microservices: Each service is responsible for a single domain, following separation of concerns.
  • Event-Driven: Kafka decouples services, enabling async processing and resilience.
  • Polyglot Databases: Each service can use the optimal database for its needs.
  • Dockerized: All databases and Kafka run locally with Docker Compose for easy setup.
  • Extensible: Add new services or swap technologies with minimal friction.
  • Cloud-Ready: Easily migrate to cloud platforms or orchestrate with Kubernetes.

🚀 Getting Started

1. Clone the Repository

# Using HTTPS
git clone https://github.com/usman250994/Nestjs-microservices_peer_2_peer_rental_project.git
cd Nestjs-microservices_peer_2_peer_rental_project

2. Start Kafka and Zookeeper

docker-compose up -d
  • This will start Kafka, Zookeeper, and Kafka UI locally. No cloud costs!
  • For more, see Kafka Docker Docs.

3. Start Databases for Each Microservice

  • Each microservice (user_management, product_management, feedback_management) has its own docker-compose.yml for its database.
  • In each service folder, run:
docker-compose up -d

4. Start the BFF and Microservices

  • In separate terminals, run the following for each service and the BFF:
npm install
npm run start:dev

5. Access Kafka UI


🧭 Extending & Deploying


🧠 Learn More


🎨 Portfolio-Ready

"A clean, scalable, and modern microservices boilerplate for real-world projects and portfolios."

  • Fork and adapt for your own SaaS, marketplace, or event-driven platform.

🌐 Connect with the Author


Made with ❤️ using NestJS, Kafka, and Docker

Medium arcticle peer to peer rental platform

About

A modern, production-ready microservices boilerplate for peer-to-peer rental platforms. Built with NestJS, Kafka, and Docker, it features a secure BFF gateway, event-driven communication, and polyglot persistence—making it scalable, modular, and cloud-ready for real-world applications.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages