Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍕 Pizza Delivery App

A production-grade, multi-tenant pizza ordering platform built with a microservices architecture. Customers can browse menus, customize pizzas with toppings, place orders via COD or Stripe card payments, and track delivery in real-time. Admins and managers get a live dashboard with instant order notifications.

Live:

  • 🛒 Customer UI → [mern-pizza-app.cyou]
  • 🧑‍💼 Admin Dashboard → [admin.mern-pizza-app.cyou]

Architecture Overview

                        ┌───────────────────────────────────────────────────┐
                        │           KUBERNETES CLUSTER (AWS EKS)            │
                        │         NGINX Ingress · api.mern-pizza-app.cyou   │
  ┌─────────────┐       │  ┌────────────┐  ┌─────────────┐                  │
  │  Client UI  │──────>│  │Auth Service│  │Catalog Svc  │──> MongoDB       │
  │ (Next.js)   │       │  │ PostgreSQL │  │+ Kafka Prod │──> AWS S3        │
  │   Vercel    │       │  └────────────┘  └──────┬──────┘                  │
  └─────────────┘       │                         │ Kafka Events            │
  ┌───────────────┐     │  ┌─────────────┐  ┌─────▼──────────┐              │
  │Admin Dashboard|────>│  │  WS Service │  │ Order Service  │──> MongoDB   │
  │ (React+Vite)  │<────│  │  Socket.io  │<─│ + Stripe       │              │
  │   Vercel      │     │  └─────────────┘  └──────┬─────────┘              │
  └───────────────┘     │  ┌─────────────┐         │ Kafka Events           │
                        │  │Notif Service│<────────┘                        │
                        │  │  Nodemailer │                                  │
                        │  └─────────────┘                                  │
                        └───────────────────────────────────────────────────┘

Repositories (Git Submodules)

Service Repo Tech DB
Auth Service pizza-delivery-app-auth-service Node.js + Express PostgreSQL
Catalog Service pizza-delivery-catalog-service Node.js + Express MongoDB
Order Service pizza-delivery-order-service Node.js + Express MongoDB
WebSocket Service pizza-delivery-websocket-service Node.js + Socket.io
Notification Service pizza-app-notification-service Node.js + Nodemailer
Client UI pizza-delivery-client-UI Next.js 14 Vercel
Admin Dashboard pizza-app-admin-dashboard React + Vite Vercel

Key Features

Multi-tenancy — Admins create tenants and assign managers. Every product, topping, and order is scoped by tenantId extracted from the JWT.

Event-driven cache — Catalog Service publishes a Kafka event on every product/topping create, update, or delete. Order Service consumes these events and maintains a local price cache in MongoDB — so prices at checkout are always validated locally without cross-service HTTP calls.

Stripe payments — Card orders create a Stripe PaymentIntent and return a checkout URL to the client. A webhook endpoint (POST /api/payments/webhook) verifies the Stripe signature and confirms payment before publishing the order event.

Real-time updates — WebSocket Service consumes Kafka order events and pushes them to Socket.io rooms. Managers see new orders appear in the Admin Dashboard instantly. Customers see live delivery status on the Client UI.

Notification emails — Notification Service consumes Kafka events and sends HTML order confirmation and status update emails via Nodemailer + SMTP.


Tech Stack

Layer Technology
Backend Node.js 18 + Express
Auth DB PostgreSQL (users, tenants, roles)
Catalog & Order DB MongoDB
Event Bus Apache Kafka
Payments Stripe (PaymentIntent + Webhooks)
Image Storage AWS S3
Real-time Socket.io
Email Nodemailer + SMTP
Containers Docker (multi-stage builds)
Orchestration Kubernetes — AWS EKS
Ingress NGINX Ingress Controller
CI/CD GitHub Actions + ArgoCD v3.3.2
Frontend Hosting Vercel
Customer UI Next.js 14 (App Router)
Admin UI React + Vite

User Roles

Role Scope Can Do
ADMIN Global Create tenants, assign managers, manage all products
MANAGER Tenant-scoped Manage products/toppings, update order statuses
CUSTOMER Self Browse menu, place orders, track delivery

CI/CD Pipeline

Push to GitHub
    → GitHub Actions builds Docker image
    → Pushes to DockerHub (roshan798/<service>:<sha>)
    → Updates K8s deployment manifest (image tag)
    → ArgoCD detects manifest change
    → Auto-syncs to Kubernetes cluster (rolling update)

Frontend (Vercel)
    → Push to main → Vercel auto-builds and deploys

Getting Started (Local Development)

Prerequisites

  • Docker + Docker Compose
  • Node.js 18+
  • A running Kafka broker (see /brokers)
  • PostgreSQL instance (for auth-service)
  • MongoDB instance (for catalog + order services)

Clone with submodules

git clone --recurse-submodules https://github.com/roshan798/pizza-delivery-app
cd pizza-delivery-app

Run Kafka locally

cd brokers
docker-compose up -d

Configure environment variables

Each service has its own .env. Copy the example and fill in your values:

# Auth Service
cd auth-service
cp .env.example .env
# Fill in: DB_HOST, DB_USER, DB_PASS, DB_NAME, JWT_SECRET, REFRESH_TOKEN_SECRET

# Catalog Service
cd catalog\ service
cp .env.example .env
# Fill in: MONGO_URI, KAFKA_BROKER, AWS_ACCESS_KEY, S3_BUCKET

# Order Service
cd order-service
cp .env.example .env
# Fill in: MONGO_URI, KAFKA_BROKER, JWT_SECRET, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET

Run services

# In each service directory
npm install
npm run dev

Postman Collection

A full Postman collection is included at the root:

mernspace-pizza-delivery.postman_collection.json

Import it into Postman to test all API endpoints.


Kafka Event Flow

Topic Event Producer Consumers
catalog PRODUCT_CREATED Catalog Order (cache)
catalog PRODUCT_UPDATED Catalog Order (cache)
catalog PRODUCT_DELETED Catalog Order (cache)
catalog TOPPING_CREATED Catalog Order (cache)
catalog TOPPING_UPDATED Catalog Order (cache)
catalog TOPPING_DELETED Catalog Order (cache)
orders ORDER_PLACED Order WS, Notification
orders ORDER_STATUS_CHANGED Order WS, Notification
payments PAYMENT_COMPLETED Order WS

Deployment

Backend is deployed on AWS EKS managed by ArgoCD. See pizza-app-deployment for Kubernetes manifests.

Frontends are deployed on Vercel with the following environment variables:

# Client UI
NEXT_PUBLIC_API_URL=https://api.mern-pizza-app.cyou

# Admin Dashboard
VITE_API_URL=https://api.mern-pizza-app.cyou
VITE_WS_URL=wss://api.mern-pizza-app.cyou

Related Repositories

Repo Purpose
pizza-app-deployment Kubernetes manifests, ArgoCD apps, NGINX Ingress config

Author

Roshan KumarGitHub

About

Multi-tenant pizza ordering platform - 5 Node.js microservices, Kafka event bus, Stripe payments, real-time Socket.io tracking. Deployed on AWS EKS with ArgoCD GitOps.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors