Back to Archive

Rahgir: Contextual Recommendation Engine

Full-Stack Product Engineer

The Engineering Challenge

Traditional travel apps rely on static filters that fail to capture the nuance of 'user intent.' I architected Rahgir to solve the 'cold-start' recommendation problem by building a scoring engine that processes multi-dimensional inputs—mood, time constraints, and travel dynamics—to rank destinations dynamically rather than serving static query results.

Core System Interfaces

Architecture & Design Patterns

The system was built with high-autonomy principles, ensuring that the business logic is decoupled from the delivery layer.

  • Strategy Pattern: Implemented an interchangeable scoring logic layer, allowing for different ranking algorithms based on user mood profiles without modifying the core service.
  • Service-Repository Layer: Abstracted database interactions using Prisma and a dedicated Service layer, ensuring the recommendation logic remains testable and DB-agnostic.
  • Relational Integrity: Designed a normalized PostgreSQL schema to handle complex many-to-many relationships between users, moods, and geographical attributes.
  • Stateless Authentication: Engineered a JWT-based auth flow to support horizontal scaling and reduce database overhead for session management.

Optimization & Scalability Decisions

  • Performance: Leveraged Next.js Server Components to move data fetching to the server, reducing the client-side JavaScript bundle and improving Time-to-Interactive (TTI).
  • Data Hygiene: Implemented Zod-driven schema validation at the API boundary to ensure consistent data types across the full-stack boundary.
  • Database Indexing: Applied B-tree indexes on frequently queried fields (location type, mood tags) to maintain sub-100ms query performance as the dataset grows.
  • Singleton Client: Utilized the Singleton pattern for the Prisma client to prevent connection pooling exhaustion during high-concurrency serverless executions.

Technical Outcome

Rahgir demonstrates a mature approach to full-stack engineering. By focusing on design patterns like Strategy and Service-Repository, the codebase remains modular and extensible. The result is a high-performance recommendation engine that bridges the gap between raw data and personalized user intent.