Setting things up
A tour of how to get the prerequisites done
Setting up the .env file
Make a copy of the .env.example file and rename it to .env
cp .env.example .envFill in the values for the environment variables in the .env file. You can find the values for the variables in the Environment Variables section.
Installing Docker
We tend to use docker for doing the heavy lifting on our behalf. Currently, we use it to set up the integration test environment before you make a commit. To make sure your experience is smooth, consider installing docker from https://docs.docker.com/engine/install/
Node Version
Keyshade works with any active Long-Term Support (LTS) version of Node.js. You can download the current LTS version from the official Node.js website.
Setting up pnpm
pnpmThe project uses pnpm as the package manager. To install pnpm, run the following command:
npm install -g pnpmInstalling the dependencies
To install the dependencies, run the following command:
pnpm installBuilding all the required packages
To make sure all the things work fine, build all these packages by running the following commands:
Build the secret-scan package:
pnpm build:secret-scanBuild the schema:
pnpm build:schemaBuild the api-client:
pnpm build:api-clientOr, want to save your precious time? Run all three commands in one go by running this command:
pnpm build:packagesInstalling Turbo
The final step involves installing our monorepo management tool. We have transitioned to using Turbo to streamline our development process. To install Turbo, run the following command:
npm install turbo --globalFor more information on how to get started with Turbo, refer to the official Turbo documentation.
Installing nest CLI
If you plan to work on the API, you would need the NestJS CLI. To do this, simply run:
npm install -g @nestjs/cliSetting up the development environment
We cluster every dependency that Keyshade will need into our docker compose file. So, in order to start developing, you will first need to fire up these dependencies using one single command:
docker compose up -dThis will start the following things in a dockerized environment and then expose the services to your host machine:
PostgreSQL: This is the database that Keyshade uses to store all the data.
Redis: This is the cache store that Keyshade uses to store the cache data.
Please note that, in order for these steps to work, you will need to ensure that the following ports are free:
5432
6379
9000
9001
Issues regarding PostgreSQL
We have heard quite a few contributors facing a difficult time in getting PSQL to work. If you are facing issues with PostgreSQL, you can try the following:
Ensure that you don't have a local version of PostgreSQL running on your machine.
Make sure that you don't have any other docker containers running on the same port.
Shutting things down
Once you have finished your development, it is recommended to shut down the docker infrastructure using:
docker compose downLast updated
Was this helpful?