This repository aims to emulate a blog post application. It is imperfect on purpose, we'd like your comments on it !
Please see the exercise as if you joined a team that created this repository, which is now used like this in production. What would you do with it ?
We would advise spending between 60 and 120 minutes on this exercise, and try answering the following questions:
-What good practices do you see that you would reuse on other NestJS projects ?
-What would you refactor in the code to improve its quality ?
-What would you bring to improve the CI/CD (in order to reduce the number of bugs in prod) ?
-What would you do to improve the DevX ?
-What would you do to improve the security of the application ?
-If you had to add a Commenting feature on articles, how would you do it ? (Do not hesitate to write code !)
npm install
To start the database, you can use docker
docker compose up database
Apply migrations to the database with the following command
npm run migrate
You can then populate the database with the seeds we created !
npm run seed
Once you have setup the database and applied the migrations
npm run start
To login on the app in the dev environment you can call the login endpoint with the credentials found in the prisma/seed.ts
file,
and then use the accessToken
provided as a Bearer Token. With swagger you can use this token to login.
# unit tests
npm run test
# e2e tests
npm run test:e2e
When changing the data model you should run the following command to generate and apply the associated migration
npm run migrate -- --name "<NAME>"
The main
branch is protected. A Merge request has to be approved before it is merged into main. It is then automatically deployed with our CI/CD.
We build the image of the application on a registry. From there, a Portainer service receives a notification and deploys the new version of the image.
docker compose up
We use drone for our CI/CD. We have two pipelines, one running at every new commit on a pull_request
, and one whenever there is a push on dev
or main
branch