LeetCode API Design Decisions


The LeetCode service involves many components that play a vital role in providing all the functionalities to the users. We will start by analyzing the high-level structure of the LeetCode service. It consists of multiple subservices; we will discuss each service's workflow and inner functionality in this lesson. The appropriate architectural styles, data formats, and protocols are debated later in this lesson.

Design overview

The design of the LeetCode API consists of five major services, as shown in the illustration below. As we can see, each service has a significant role and, therefore, accepts users’ requests directly, because it’s available as an endpoint to its users. Even if each service is elaborated on in detail along with its components, we’ll see how these services are interdependent and coupled to respond to user queries. Below, we explain the role of each service and the workflow to complete various functional requirements.

Requests from clients can ask the LeetCode service to perform operations such as listing coding problems, registering a coding contest, submitting a code, commenting on a topic, and so on. Each subservice is a complete service; we’ll discuss their workflows by analyzing the components involved in each service.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.