You are on page 1of 3

Zip Candidate User API

Challenge: NodeJS
We have a fictitious scenario where we'd like to build an API to manage Zip Pay
users. We require the ability to create, get, and list users. Once we create users, we
need the ability for the user to create an account.

This should be implemented with an API and database.

Business Requirements
• Should not allow more than one user with the same email address
• Zip Pay allows credit for up to $1000, so if monthly salary - monthly expenses is less
than $1000 we should not create an account for the user and return an error

Tech Requirements
• Use TypeScript
• Database: Users and Accounts should persist to database of your
choice See Supporting Services below
• Documentation: Update Developers.md with information you'd give to other
members of your team about how to start and run the solution, and anything else
you'd like us to know

Supporting Services
To assist with your submission and to save you time in downloading and installing
software, we've included a docker-compose.yml with boilerplate configuration for a few
popular database options (MSSQL, PostgresQL, and MySQL). Choose one and
remove the other two (or substitute) based on your preference. Note that you only
need to have one database, you don't need to use all of them.

If your submission calls for other supporting services, feel free to add as necessary
to your docker-compose config.
API Requirements
1. The following Endpoints are required:
• Create user
• Fields to be provided and persist
• Name
• Email Address (Must be unique)
• Monthly Salary (Must be a positive number - for simplicity,
pretend there is no such thing as income tax)
• Monthly Expenses (Must be a positive number)
• List users
• Get user
• Create an account
• Given a user, create an account
• Should take into account the business requirements above
• Up to you to decide the appropriate fields to persist here
• List Accounts
2. Should be robust and include relevant response codes for different scenarios
3. No need to implement any kind of auth for this test

Definition of Done
This solution should be what you consider to be production ready, so think carefully
about what you want to include.

1. Code should be self-documented, use comments liberally. We want to see


how well you communicate thru your code.
2. Proper exception handling for REST endpoints with correct standard error /
status codes being returned from the API layer.
3. We would like to see how well you separate code and entities at different
layers, like, API, Biz Logic and Repository layers. Use a clean folder structure
to reflect various layers.
4. We would like to see what design patterns and/or libraries you want to use, if
applicable.
5. Should have unit test cases as well as some integration test. Use mocked DB
objects for unit tests.
6. Developers.md should provide instructions to run and test your code. Also
document your APIs for other developers who are going to use your APIs. We
would like to see how well you communicate thru your documents.
7. Boiler plate code contains docker-compose.yml file. Update and use it to spin
up database and the service you develop.
8. Follow best practices, like, logging, error handling.

NOTE: You may share your code using Github (preferred - mail us the link to your
code) or as a zip file (mail us the zip file).

Points to take care for REST endpoints

1. Use Nouns for Resource Identification. Bad Practice: Do not use verbs
2. Use Plural Nouns to Name a Resource
3. Use Proper HTTP Headers for Serialization Formats
4. Use Sub-Resources for Relations
5. Use Proper HTTP Methods
6. HTTP Response Status Codes
7. Field Name Casing Convention
8. Restful API Versioning
9. Refer : https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-
design/

You might also like