Skip to content

This project is my implementation of Nesto (https://www.nesto.ca/) technical assessment

Notifications You must be signed in to change notification settings

omermujtaba18/nesto-technical-assessment

Repository files navigation

This project is my implementation of Nesto technical assessment.
📌 You can find the assessment instructions here.

Nesto Technical Assessment

Local Environment Setup

  1. Install node version manager (nvm) from here (if not already installed)

  2. Run following commands to setup node version

    nvm install v20.18.0
    nvm use
    
  3. Install dependencies

    npm install
    
  4. Start typescript compiler and run service

    In order to watch for changes and run the application locally you have to run the TypeScript compiler in watch mode in addition to any/all the required entry points.

    npm run ts:watch # Terminal 1
    
    npm run app:dev # Terminal 2
    
  5. Your server should be running at http://localhost:5001

Testing

  1. Ensure that the containers are up and running

    docker-compose up -d
    
  2. Move to /service directory

    cd service
    
  3. Migrate the test database schema

    ./test/database/migrate-test.sh
    
  4. Run tests

    npm run test
    

Recommendations

Frontend

  1. .nvmrc .npmrc files missing, its better to have to maintain consistency
  2. package.json missing engines.node, its better to have to maintain consistency
  3. Using really old node version! :(

Backend

  1. Add paging support to all routes
  2. Define max number of authors and genres (I believe pg has a 65535 as default max allowed number of parameters)
  3. Enable auto increment on PKs in database tables
  4. GET /authors should have a search query parameter, I added it in my implementation but it is missing in the api spec
  5. For reliability, I would also enable log_duration on psql, push logs to the log management tool, and analyze query execution times
  6. Create index on author first_name and last_name to help with search

Notes

  1. I am using the npm pg library for communicating with the database, it can be replaced with sequelize or other ORM for ease.
  2. I only wrote e2e tests for my routes. My tests are covering all cases and since there is not much happening inside the services or controllers, I don't see a reason to test them individually
  3. All my data logic is inside services, the reason for that being if in future the database is changed, there would be only changes required in the services.