Challenge Overview
Challenge Objectives
Build an API starter pack using the tech stack described in the section below. The goal of creating this starter pack is to make it very easy and quick for a developer to begin working on a challenge/project for the given tech stack without spending a lot of time setting up their environment. We want them to be able to quickly focus in on solving the problem and eliminate the time spent outside of that.
Tech Stack
-
Java 8
-
Spring 5
-
Spring Boot 2
-
MongoDB
-
PostgreSQL
-
MySQL
-
Docker
-
Docker compose
Project Background
In this series of challenges, we will be building starter packs for different combinations of language + DB so our community members can use those on challenges as a starting point.
Detailed Requirements
As part of this challenge, we need your help to create a starter pack for an API using the technologies from the `Tech Stack` section above.
This will be available for all community members to use this starter pack on challenges and start developing APIs faster. It will also help members who are not familiar with the tech stack to get started.
1. Create the base structure of the project.
2. Create CRUD (GET/POST/PUT/DELETE /users) endpoints as an example that will allow creating/reading/updating and deleting objects from the configured database with the following structure:
{
“handle”: “thomaskranitsas” // Required string
}
The above needs to be defined as a model.
Just that. A simple model with just one property (and of course the auto-generated ID).
3. We are targeting 3 different databases.
-
MongoDB
-
PostgreSQL
-
MySQL
Most of the core code should be the same but the code related to DB interactions will have some differences.
You need to provide 3 solutions, one for each database.
4. Make sure the business logic is separated into controllers and services. Do not write everything on a single file.
5. Follow the best practices to create an API using this tech stack mentioned above.
6. Make sure the API is handling errors gracefully and does not crash.
7. The GET endpoint is a simple “getAll”. No need to create an endpoint to get by ID.
8. For PUT/DELETE, endpoints will require the entity ID to be part of the path (eg /users/:id).
9. All request/response bodies should be in JSON format.
10. All methods should have proper documentation explaining the purpose of the method, the parameters and the type of the expected response.
11. Make sure all configurations are properly placed on a configuration file and are also be able to be overwritten by environment variables.
12. Create a docker-compose file (and Dockerfile(s) as needed) so a developer can spin up the API as well as the database on docker and run it from there.
13. Create a thorough README.md file explaining how to set up, configure, run and test the API.
14. Include instructions on how to run and test the API on docker using the docker-compose CLI.
An existing starter pack that was previously created using NodeJs will be shared on the challenge forum for reference.You can use it as an example to create the structure of this project.
Submission Deliverables
Upload a zip file that contains all of your 3 solutions (one per database). Each solution should be in a different folder.