BelkaDev / joule

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Joule interview

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 !)

Installation & setup

npm install

Prisma & DB

databse

To start the database, you can use docker

docker compose up database

migrations

Apply migrations to the database with the following command

npm run migrate

seed

You can then populate the database with the seeds we created !

npm run seed

Running the app

Once you have setup the database and applied the migrations

npm run start

Login

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.

Test

# unit tests
npm run test

# e2e tests
npm run test:e2e

Prisma

Generate new migrations

When changing the data model you should run the following command to generate and apply the associated migration

npm run migrate -- --name "<NAME>"

GitFlow

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

docker compose up

Drone

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

About


Languages

Language:TypeScript 96.5%Language:JavaScript 2.3%Language:Dockerfile 1.2%