Panda Guru LogoPanda
Guru

PhonePe LLD

Round 1

Questions: Design and implement a user journey service for monitoring users as they navigate through various use cases. This will be a rule-based journey framework where a user will onboard a journey and move along various stages on the basis of specific conditions.

Requirements:

Example:

Users:

Mandatory Implementations:

  1. createJourney(Journey journey)
  2. updateState(String JourneyId, boolean active)
  3. getJourney(String journeyId)
  4. evaluate(String userId, Payload payload)
  5. getCurrentStage(String userId, String journeyId)
  6. isOnboarded(String userId, String journeyId)

Optional:

  1. Send SMS to a user on stage transition.
  2. Support for recurring journeys.

System Architecture:

Points to note:

Evaluation Criteria:

The round was of 1.5 hours, and you had to write the code and submit it via email as a zip file.

Candidate's Approach

The candidate designed a service that utilizes a Directed Acyclic Graph (DAG) to represent user journeys. They implemented the mandatory functions to create journeys, update their states, and evaluate user transitions based on payload conditions. The approach included in-memory storage for journeys and user transitions, ensuring efficient tracking and state management.

Interviewer's Feedback

The interviewer appreciated the candidate's understanding of the requirements and the clean structure of the code. They suggested improvements in error handling and emphasized the importance of adhering to SOLID principles for better maintainability.