Skip to content

Saumya-Ranjan-Mishra/LetsEat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LetsEat

LetsEat is an AI-powered, production-style food ordering platform built with a true microservices backend. It combines consumer-grade product thinking (personalized food discovery, smooth checkout, real-time order flow) with engineering depth (domain-driven service boundaries, async eventing, OAuth2/JWT security, and vector search).

Backend Architecture

The backend is organized into independent Spring Boot services, each aligned to a domain boundary:

  • UserCatalogueService: identity, user profile, and address management.
  • RestaurantCatalogueService: restaurant/menu inventory and catalogue search.
  • OrderService: order lifecycle, persistence, and authenticated order retrieval.
  • PaymentService: payment-link creation and payment webhook processing.
  • NotificationService: asynchronous order event consumption.
  • SearchService: AI semantic search over restaurants and menu items.

Interaction Flow

  1. User signs in through Google OAuth2 in UserCatalogueService and receives JWT.
  2. User discovers restaurants/items via RestaurantCatalogueService and/or SearchService.
  3. User places an order in OrderService.
  4. PaymentService creates Razorpay payment link for the order.
  5. Razorpay webhook hits PaymentService after payment completion.
  6. PaymentService fetches order details from OrderService and publishes event to Kafka.
  7. NotificationService consumes Kafka order-processing event and processes notification payload.

LLD Overview

UserCatalogueService

  • Controllers: user CRUD and address CRUD endpoints.
  • Security layer: Spring Security OAuth2 login + JWT token generation.
  • Persistence: JPA repositories for User and UserAddress.

RestaurantCatalogueService

  • Controllers: restaurant onboarding/status/address updates, menu/item operations, search API.
  • Search LLD: strategy-based search execution (global and radius styles).
  • Persistence: normalized entities for Restaurant, Menu, Item with JPA repositories.

OrderService

  • Controller: order creation, order lookup by id, current-user order history.
  • Service layer: order total calculation and mapping logic.
  • Pricing LLD: strategy/factory pattern for delivery pricing.
  • Security layer: custom JWT authentication filter for stateless APIs.

PaymentService

  • Controller: payment initiation and payment webhook endpoint.
  • Gateway abstraction: PaymentGateway interface with Razorpay implementation.
  • Integration layer: RestTemplate call to OrderService for authoritative order details.
  • Eventing layer: Kafka producer publishes paid order details to order-processing topic.

NotificationService

  • Consumer-only service (no REST controller).
  • Kafka listener consumes order-processing events.
  • Processing logic validates payload totals and logs processing outcomes.

SearchService

  • Controller: AI index bootstrap and AI search endpoints.
  • Embedding layer: Azure OpenAI embedding generation.
  • Vector layer: Azure AI Search index upsert/query for restaurants and items.
  • Ranking layer: score sorting and optional city/diet/price-aware filtering.

Core Backend Features

  • Microservice-based domain decomposition for independent evolution.
  • Google OAuth2 login with JWT-based downstream authorization.
  • Order management with secure user-scoped retrieval.
  • Razorpay payment link flow and webhook-driven payment confirmation.
  • Kafka-based asynchronous payment-to-notification event pipeline.
  • Restaurant and menu catalogue management APIs.
  • AI semantic food search using embeddings + vector search.

API Endpoints

UserCatalogueService

  • /users
  • /users/{userId}
  • /users/{userId}/addresses
  • /users/{userId}/addresses/{addressId}
  • /s/users?userID={userID}
  • /s/users?email={email}

RestaurantCatalogueService

  • /restaurants
  • /restaurants/{restaurantId}/status
  • /restaurants/{restaurantId}/address
  • /menu/restaurants/{restaurantId}/menu
  • /menu/{menuId}/items/{itemId}
  • /menu/{menuId}/items
  • /menu/{restaurantId}
  • /s

OrderService

  • /orders/id/{orderId}
  • /orders/createOrder
  • /orders

PaymentService

  • /payments
  • /payments/webhook

SearchService

  • /ai/restaurant/createIndex
  • /ai/restaurant/search

NotificationService

  • No REST API endpoints (Kafka consumer service)

Key Technologies By Service

UserCatalogueService

  • Java 21
  • Spring Boot
  • Spring Web
  • Spring Data JPA
  • MySQL
  • Spring Security
  • Spring OAuth2 Client (Google)
  • JWT (jjwt)

RestaurantCatalogueService

  • Java 21
  • Spring Boot
  • Spring Web
  • Spring Data JPA
  • MySQL
  • Bean Validation
  • Strategy pattern for search execution

OrderService

  • Java 21
  • Spring Boot
  • Spring Web
  • Spring Data JPA
  • MySQL
  • Spring Security
  • JWT (jjwt)
  • Strategy/factory pattern for pricing

PaymentService

  • Java 21
  • Spring Boot
  • Spring Web
  • Razorpay Java SDK
  • RestTemplate
  • Spring Kafka (producer)

NotificationService

  • Java 21
  • Spring Boot
  • Spring Kafka (consumer)
  • Jackson Databind

SearchService

  • Java 21
  • Spring Boot
  • Spring Web
  • Azure OpenAI Embeddings
  • Azure AI Search (vector search)
  • RestTemplate
  • spring-dotenv

About

This application is an online food ordering microservices app. It has the implementation of all critical services that is typically needed. Including the Razorpay payment gateway integration for payment service. Kafka for notification service and Google OAuth2.0 for authentication.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages