fardin.dev
← Back to work

backend

StayMate

Hotel booking API with AI-powered recommendations

Problem

Hotel search platforms rarely personalize results. StayMate needed a backend that could manage bookings and serve recommendations from a separate ML service.

What I built

Modular NestJS API with MongoDB, JWT guards per role, and a Flask AI service using sentence-transformer embeddings for cosine-similarity matching.

Architecture

NestJS API handles auth, hotels, bookings, and S3 uploads. Recommendation requests go to a Flask service that returns ranked hotels based on user history.

API highlights

  • POST /auth/register, POST /auth/login
  • GET /hotels, POST /hotels/create (Manager/Admin)
  • POST /bookings/create, GET /bookings/user/:id
  • GET /recommendations/:userId

Challenges

  • Keeping the AI service stateless while precomputing hotel embeddings
  • GeoJSON queries for nearby hotel search
NestJSMongoDBJWTFlaskPyTorchAWS S3