This project was intended to participate in the take home test for Thinkific
Sunday, 03/22/2020
Tech stacks
- Backend: ExpressJS
- Database: MongoDB
- Frontend: React (using CRA)
- State management & Side effects: Redux & Saga
At first, I considering between Lumen and ExpressJS for backend, but as I want to keep the code base consistent with the frontend part, I decide to give ExpressJS a go.
In comparision, NodeJS is good at I/O operations (asynchronous & Non-Blocking I/O) so it is a perfect candidate for this exercise.
Frontend: https://thinkific-hoang-frontend.herokuapp.com
Backend: https://thinkific-hoang-backend.herokuapp.com
I spent total amount of 7 hours on this exercise and 1 hour to deploy.
I assume that the application only need to display a few important data such as temperature, weather forecast.
In a real-world application, it would be better to cache the getWeather endpoint (ex: 24h) using Redis or other caching techniques as the data most likely to change everyday. By doing that we can prevent hitting our database for every request.
I attempted all the stretch goals as they are straight forward.
I feel like the authentication could be done better by improve the generate token part, also the frontend is not yet handle refresh token when the access token is expired.
There are lots of thing that could be done better in frontend part as well (integrate CSS framework, write webpack config, minimize CSS...), at this moment I only use pure css files which is not ideal.
To run backend
cd thinkific-backend
cp .env.example .env
cp .env.test.example .env.test
yarn && yarn start
To run frontend
cd thinkific-frontend
yarn && yarn start
To run both services with Docker
docker-compose up
Access frontend via http://localhost:3000
Access backend via http://localhost:5000/api/v1
I would love to add test coverage to the frontend if I have more time because writing tests always important.
I also want to convert the backend to Typescript. It will help the code easier to read and understand.
In addition, create API documentation (ex: Swagger) is mandatory for backend part.
The challenge is well-documented with clear instructions. I think this is a good challenge to test applicants multiple aspects such as problem solving, design API and deployment.