- Introduction
- Your Tasks
- Submitting Your Project
- Setup Instructions
- API Endpoints
- Appendix / Additional Information
This project is a backend service designed to understand how you reason around building an API.
There are two folders: python and typescript (with Node.js). Choose whichever language you prefer coding in, as the project is the same in both.
This service includes a mock service to simulate an external API.
This readme file is written with the typescript project in mind.
Tip
This assignment should take you no more than one or two hours. (We don't want to take up too much of your time!) If you find yourself spending more time than that, feel free to stub out parts you don't have time to complete, and we can discuss them during the interview.
The goal of this project is to help provide context around a problem space of load balancing requests for an API that you are designing. We'll take the solution that you provide and discuss it during our interview.
A few things to keep in mind:
- This project should run standalone, so you don't need to worry about persistence. Please do not add dependencies that require additional configuration!
- We're looking for a solution that is simple, clean, and well-structured.
- We're not looking for a production-ready solution, we're looking for a solution that is well thought out and easy to understand.
- We'll take the solution that you provide and use that as the foundation for our interview.
Thank you for taking the time to complete this assignment. We're excited to see what you come up with!
Please clone this repository to get started.
When your project is ready for review, please export your project into a zip file (excluding the node_modules folder). Use Google Drive, Dropbox, OneDrive, or similar file upload service to host your project, then share a link so we can download this file. Please do not submit a PR to submit your project.
- Implement user creation & fetching logic for the
POST /api/usersandGET /api/usersendpoints.
The Submit endpoint is not protected by authentication. Please add authentication using your choice of method.
- Add authentication to the
POST /api/submitendpoint. You can use theaccessTokenfield from theUsermodel.
We want to limit the number of requests a user can create to our API in a single day and in bursts. Please implement the following rate limits on a per-account basis:
- Add a rate limit of 1 request per second to the
POST /api/submitendpoint. - Add a rate limit of 100 requests per day to the
POST /api/submitendpoint.
We want to keep track of how many quota points a user has used, and when they have used them. Please create a solution around the following:
- Please propose a solution to track usage of the
POST /api/submitendpoint.
- URL:
/api/users - Method:
GET - Description: Returns a list of users.
- URL:
/api/users - Method:
POST - Description: Creates a new user.
- URL:
/api/recipients - Method:
GET - Description: Returns a list of recipients.
- URL:
/api/submit - Method:
POST - Description: Submits a request to process a user.
The mock service is designed to simulate an external API. It includes the following endpoints:
- URL:
/users - Method:
GET - Description: Returns a list of users.
- URL:
/process - Method:
POST - Description: Processes a user and returns a success message with the user id and processed value.
For more details, refer to the Mock Service README.
The project uses nodemon for development. The configuration can be found in nodemon.json.
The initial configuration logic is implemented in the initialConfiguration function in src/utils.ts. This function initializes the recipients and users data.
The project uses TypeScript interfaces to define the data structures. The interfaces can be found in src/types.ts.
Mock data generation is implemented in src/mocks/mocker.ts. This file includes functions to create fake recipients and users.