Tech Interview Assignment (Golang)
Tech Interview Assignment (Golang)
Assignment (Golang)
Dear Candidate,
We are pleased to tell you that you have been selected for our Technical Interview step. As a
backend engineer, you play a critical role in building the backbone of our application, ensuring
scalability, security, and seamless functionality. We require someone that is able to write high
quality, secure, scalable, and high performance code.
1. Requirements
We want you to design and build a HTTP service that provides 4 endpoints.
1. Registration This endpoint accepts 3 data: 1) Phone number, 2) Full Name, and 3)
Password. The data should follow this validation below:
This endpoint should store the newly created user in the database. The password
should be hashed and salted in the database. Successful request should return the ID of
the user,
3. Login This endpoint accepts 2 fields: 1) phone number and 2) password. This endpoint
will check the database whether the combination exists. Upon success, it will return the
ID of the user and the JWT with algorithm RS256. It will also increment the number of
successful login of that user in the database. Unsuccessful login will return HTTP 400
Bad Requests code.
4. Get My Profile This endpoint will accept JWT as a bearer token in the authorization
header. Upon successful verification, this will return the name of the user and the phone
number. Otherwise return HTTP 403 Forbidden code.
5. Update My Profile Similar to the endpoint above, this endpoint will also accept JWT as
bearer token in authorization header. In addition to that this endpoint will accept 2 fields:
1) Phone Number OR 2) Full Name. If the request is authorised then the endpoint will
update the fields that exist in the requests, i.e. if full name exists then it will update the
full name. However since one phone number can only belong to one user, if a user
wants to change to an already existing phone number returns HTTP 409 Conflict. If the
request is unauthorised, then return HTTP 403 Forbidden code.
2. Submission Guideline
We already provide a template for you to start with. You can download the template in the link
below
https://storage.googleapis.com/648010c1-f244-4641-98f2-73ff6c1b4e99/InterviewBackendSawit
ProGolang-20230607.zip
1. handler
This is the directory where you implement the API handlers for your service
2. repository
3. api.yml
This is the OpenAPI file where you define the API contract for your service. We already
prepare a Makefile task make generate where you can generate OpenAPI stub. We
also add a sample code for you to try.
4. database.sql
This is the SQL file where you put database schema and sample code.
You should be able to finish this assignment under 5 hours of cumulative work. Once you are
done, please submit the code to a public GitHub repository and send us the link to the
repository. If you have any technical questions, please do not hesitate to reach out to our
recruitment person in charge.
3. Technology Stacks
Our technology stacks consist of
1. Echo as HTTP framework that runs on Golang 1.19
2. PostgresSQL as our database.
3. Google Cloud as our cloud platform.
4. Docker to let us automate our development.
5. OpenAPI 3 to enable us to define consistent API contracts between front ends.
4. Runtime Specification
We will run your application against the commands below
5. Evaluation Criteria
We will evaluate your work based on the following criteria:
1. Your proficiency in our tech stacks such as Golang, Echo, Docker, OpenAPI, and
PostgreSQL.
2. Your ability to write a high quality code including readability and modular design.
3. Your ability to write high coverage code testing.
4. Your ability to model data structures and design databases.
5. Your ability to design readable and complete API contracts with appropriate HTTP API
best practices.