diff --git a/docs/contributing-to-keyshade/design-of-our-code/api.md b/docs/contributing-to-keyshade/design-of-our-code/api.md index cbe058e9..308f7a02 100644 --- a/docs/contributing-to-keyshade/design-of-our-code/api.md +++ b/docs/contributing-to-keyshade/design-of-our-code/api.md @@ -25,6 +25,10 @@ As per the NestJS convention, our API base is totally modularized, with each mod * **dto**: Contains class objects for data intake from the clients * **types:** Optionally, some modules have a \`\.types.ts\` file that holds the custom types it uses in the module. +## The common module + +Just so that we can employ code reusability without much OOP hassle, we have clustered all of our usable components of the backend under the `common` module. + ### The `prisma` module This module deserves special attention since it deals with the data layer. Apart from the usual files, we have two other: diff --git a/docs/contributing-to-keyshade/environment-variables.md b/docs/contributing-to-keyshade/environment-variables.md index 7ab0bc66..251930f0 100644 --- a/docs/contributing-to-keyshade/environment-variables.md +++ b/docs/contributing-to-keyshade/environment-variables.md @@ -15,6 +15,7 @@ Here's the description of the environment variables used in the project. You can * **SMTP\_PORT:** The SMPT port as specified by your SMPT provider. * **SMTP\_EMAIL\_ADDRESS:** The email address you want to be sending out the emails from. * **SMTP\_PASSWORD:** The app password for your email account. +* **GITHUB\_CLIENT\_ID, GITHUB\_CLIENT\_SECRET, GITHUB\_CALLBACK\_URL:** These settings can be configured by adding an OAuth app in your GitHub account's developer section. Please note that it's not mandatory, until and unless you want to support GitHub OAuth. * **FROM\_EMAIL**: The display of the email sender title. * **JWT\_SECRET**: The secret used to sign the JWT tokens. It is insignificant in the development environment. * **WEB\_FRONTEND\_URL, WORKSPACE\_FRONTEND\_URL**: The URLs of the web and workspace frontend respectively. These are used in the emails sometimes and in other spaces of the application too. diff --git a/docs/contributing-to-keyshade/prerequisites.md b/docs/contributing-to-keyshade/prerequisites.md index 147609d4..9c61eeff 100644 --- a/docs/contributing-to-keyshade/prerequisites.md +++ b/docs/contributing-to-keyshade/prerequisites.md @@ -4,4 +4,4 @@ Of course, to get started, you will need to have the required components in plac * Make sure you have Git installed and have an account in GitHub * Have an account in Supabase along with a project -* Have your SMTP credentials ready (only for backend development) +* Have your SMTP credentials ready diff --git a/docs/contributing-to-keyshade/running-things-locally/running-the-api.md b/docs/contributing-to-keyshade/running-things-locally/running-the-api.md index 612fe77e..2a472974 100644 --- a/docs/contributing-to-keyshade/running-things-locally/running-the-api.md +++ b/docs/contributing-to-keyshade/running-things-locally/running-the-api.md @@ -24,20 +24,20 @@ pnpm run db:deploy-migrations pnpm run dev:api ``` -* Once you have made the changes and added tests (if any), make sure to test the code: +## Testing your code -```bash -pnpm run test:api -``` +We currently perform two kinds of tests: **unit tests** and **integration tests.** -* Lint the code: +After you make sure that you have added your unit tests, or you have made some changes to the existing functionality, you can run them using: ```bash -pnpm run lint:api +pnpm run test:api ``` -* Run prettier: +After this is complete, you can run the integration tests. But for that, you would first need your test DB to be up and running. These commands will do of that for you. ```bash -pnpm run prettier:fix:api +docker compose up -d +pnpm run e2e:api +docker compose down ``` diff --git a/docs/contributing-to-keyshade/setting-things-up.md b/docs/contributing-to-keyshade/setting-things-up.md index afe23c4b..3c14b9ee 100644 --- a/docs/contributing-to-keyshade/setting-things-up.md +++ b/docs/contributing-to-keyshade/setting-things-up.md @@ -1,3 +1,7 @@ +--- +description: A tour of how to get the prerequisites done +--- + # Setting things up ## Setting up the .env file @@ -10,6 +14,10 @@ cp .env.example .env Fill in the values for the environment variables in the `.env` file. You can find the values for the variables in the [Environment Variables](environment-variables.md) 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/](https://docs.docker.com/engine/install/) + ## Setting up `pnpm` keyshade works with any version of **node (>=18)** and takes the liberty that you have it installed. The project uses `pnpm` as the package manager. To install `pnpm`, run the following command: @@ -39,6 +47,13 @@ pnpm install The last step is to install NX. It is the monorepo management tool that we are using. Read more about it in [https://nx.dev](https://nx.dev). To install nx, you need to run the following command: ```bash -pnpm i -g nx +npm i -g nx ``` +## Installing nest CLI + +If you plan to work on the API, you would need the **NestJS CLI.** To do this, simply run: + +```bash +npm install -g @nestjs/cli +```