Skip to content

La-Fabryck/caddie-backend-nest

Repository files navigation

How to install the project

  1. Create the network
docker network create caddie_network
  1. Pull docker dependencies
docker compose pull
  1. Build the Nest image
docker compose build
  1. Install the dependencies and generate the prisma schemes
docker compose run --rm backend npm ci \
&& docker compose run --rm backend npx prisma generate
  1. Run the migrations
docker compose run --rm backend npx prisma migrate dev --name init
  1. Seed the database
docker compose run --rm backend npx prisma db seed
  1. Start the app
docker compose up
  1. Check the node version
docker compose exec backend node -v

Misceallenous

Clean everything docker related

docker compose stop \
&& docker compose down -v \
&& docker compose down --rmi all \
&& docker compose rm --volumes \
&& docker builder prune -a \
&& docker image prune -a \
&& docker container prune \
&& docker system prune -a --volumes

Update Node alpine

docker compose build --pull --no-cache

NVM use the version's project

nvm install && nvm use

Clean the packages and dist

sudo rm -rf ./node_modules && sudo rm -rf ./dist

Fastify version compatibilty

fastify's installed version must match the one installed in @nestjs/platform-fastify

> npm ls fastify
[email protected] /path/to/project/caddie-backend-nest
├─┬ @nestjs/[email protected]
│ └── [email protected] deduped
└── [email protected]

Install one that's matching

Fastify cookie compatibility

Check in the package-lock.json the version of fastify-plugin in the dependencies of @fastify/cookie. For example here it means it's compatible with fastify v4.

    "node_modules/@fastify/cookie": {
      "version": "9.4.0",
      "resolved": "https://registry.npmjs.org/@fastify/cookie/-/cookie-9.4.0.tgz",
      "integrity": "sha512-Th+pt3kEkh4MQD/Q2q1bMuJIB5NX/D5SwSpOKu3G/tjoGbwfpurIMJsWSPS0SJJ4eyjtmQ8OipDQspf8RbUOlg==",
      "dependencies": {
        "cookie-signature": "^1.1.0",
        "fastify-plugin": "^4.0.0" <------------
      }
    },

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published