Skip to content

Commit b60ed65

Browse files
authored
Update CONTRIBUTING.md
1 parent 7477e12 commit b60ed65

File tree

1 file changed

+75
-39
lines changed

1 file changed

+75
-39
lines changed

CONTRIBUTING.md

Lines changed: 75 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,45 @@ This page is a work in progress and will be updated as the project evolves. If y
66

77
## Stack
88

9-
This is a multipackage monorepo managed by [pnpm](https://pnpm.io/), which houses both the backend and frontend of the website. The backend is built with [NestJS](https://nestjs.com/) and the frontend is built with [Next.js](https://nextjs.org/) using server-side rendering (SSR). We use [MongoDB](https://www.mongodb.com/) as our database and [Backblaze B2](https://www.backblaze.com/cloud-storage) for file storage via its S3-compatible API.
9+
This is a multipackage **monorepo** managed by [Bun](https://bun.sh/). It includes both the backend and frontend of the project:
10+
11+
- **Backend**: [NestJS](https://nestjs.com/)
12+
- **Frontend**: [Next.js](https://nextjs.org/) with Server-Side Rendering (SSR)
13+
- **Database**: [MongoDB](https://www.mongodb.com/)
14+
- **File Storage**: [Backblaze B2](https://www.backblaze.com/cloud-storage) via its S3-compatible API
1015

1116
## Setting up the project for development
1217

13-
To easily install the project, you can use the [docker-compose-dev.yml](docker-compose-dev.yml) file.
18+
You'll need the following installed on your machine:
19+
20+
- [Bun](https://bun.sh/)
21+
- [Docker](https://www.docker.com/)
22+
- [Docker Compose](https://docs.docker.com/compose/)
23+
24+
We provide a `docker-compose-dev.yml` file that sets up:
25+
26+
- A MongoDB instance
27+
- A local mail server (`maildev`)
28+
- An S3-compatible storage (`minio`)
29+
- A MinIO client
30+
31+
To start the services, run the following in the root directory:
1432

1533
```bash
1634
docker-compose -f docker-compose-dev.yml up -d
1735
```
18-
obs: You can remove the `-d` flag to see the containers' logs.
1936

20-
This will start a database container, a maildev container, a minio container, and a minio-client container.
21-
You can check the authentication details in the [docker-compose-dev.yml](docker-compose-dev.yml) file.
37+
> Remove the `-d` flag if you'd like to see container logs in your terminal.
38+
39+
You can find authentication details in the [`docker-compose-dev.yml`](docker-compose-dev.yml) file.
2240

23-
To configure the env variables, create `.env.development` and `.env.local` files in the [backend](server) and [front-end](web) packages, based on the example files provided. Alternatively, set the environment variables directly in your shell like so:
41+
---
2442

25-
### backend:
43+
## Environment Variables
44+
45+
Create `.env.development` and `.env.local` files in the `server` and `web` packages respectively, using the provided example files as a base. Alternatively, export them directly in your shell.
46+
47+
### Backend (`server`):
2648

2749
```bash
2850
export NODE_ENV=development
@@ -70,66 +92,80 @@ export MAIL_TRANSPORT=smtp://user:pass@localhost:1025
7092
export MAIL_FROM="Example <noreply@noteblock.world>"
7193
```
7294

73-
Note that for the OAuth providers, you will need to create an application on their respective developer portals and replace `UNSET` , in development, you can use the magic link login method for easy testing.
95+
> You’ll need to register developer applications with GitHub, Google, and Discord and replace the `UNSET` placeholders.
96+
97+
~~ For development, you can use the magic link login method instead. ~~
7498

75-
### frontend:
99+
### Frontend (`web`):
100+
101+
On the frontend, you can set the environment variables in a `.env.local` file or directly in your shell. The following variables are required:
76102

77103
```bash
78-
export THUMBNAIL_URL=localhost:9000
79-
export NEXT_PUBLIC_RECAPTCHA_SITE_KEY="6Le7JNEpAAAAAN7US0WVtz10Mb-IfnTgw-IvEC6s"
80-
export NEXT_PUBLIC_URL=http://localhost:3000
81-
export NEXT_PUBLIC_API_URL=http://localhost:4000/api/v1
104+
THUMBNAIL_URL=localhost:9000
105+
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
106+
NEXT_PUBLIC_URL=http://localhost:3000
107+
NEXT_PUBLIC_API_URL=http://localhost:4000/api/v1
82108
```
83109

110+
---
84111

85-
In Windows, you can use `set` instead of `export`.
86-
```cmd
87-
set THUMBNAIL_URL=localhost:9000
88-
set NEXT_PUBLIC_RECAPTCHA_SITE_KEY="6Le7JNEpAAAAAN7US0WVtz10Mb-IfnTgw-IvEC6s"
89-
set NEXT_PUBLIC_URL=http://localhost:3000
90-
set NEXT_PUBLIC_API_URL=http://localhost:4000/api/v1
91-
```
112+
## Installing Dependencies
92113

93-
Finally, to run the frontend and backend servers:
114+
To install all dependencies, run in the root of the project:
94115

95116
```bash
96-
pnpm run dev
117+
bun install
97118
```
98119

99-
If you only want to run the backend or frontend, you can use the following commands:
120+
---
100121

101-
```bash
102-
pnpm run dev:server
103-
```
122+
## Running the Project
123+
124+
To start both the backend and frontend:
104125

105126
```bash
106-
pnpm run dev:web
127+
bun run dev
107128
```
108129

109-
The backend server will be available at [http://localhost:3000](http://localhost:3000) and the frontend server will be available at [http://localhost:4000](http://localhost:4000).
130+
To start them individually:
131+
132+
- Backend only:
133+
134+
```bash
135+
bun run dev:server
136+
```
137+
138+
- Frontend only:
139+
140+
```bash
141+
bun run dev:web
142+
```
110143

144+
> The frontend will run at [http://localhost:3000](http://localhost:3000)
145+
> The backend API will be at [http://localhost:4000](http://localhost:4000)
111146
112-
For populating the database with some test data by sending a post request:
147+
---
148+
149+
## Seeding the Database (Development Only)
150+
151+
You can populate the development database with test data using:
113152

114153
```bash
115154
curl -X 'GET' \
116155
'http://localhost:4000/api/v1/seed/seed-dev' \
117156
-H 'accept: */*'
118157
```
119158

120-
Just so you know, the seed route is only available in development mode.
121-
122-
Currently, tests are only available for the [backend](server), and [shared](shared) packages.
159+
> This route is only available in `NODE_ENV=development`. It will create some sample users, songs, and comments.
123160
124-
We use [Jest](https://jestjs.io/) for testing. To run the tests, you can use the following command on the package you want to test:
161+
## Running Tests
125162

126-
```bash
127-
pnpm test
128-
```
163+
Currently, tests are available for the `server` and `shared` packages.
129164

130-
## Code style
165+
We use [Jest](https://jestjs.io/) for testing. To run tests:
131166

132-
We provide a [Prettier](https://prettier.io/) and [ESLint](https://eslint.org/) configuration for the project. You can run the following command to format your code:
133167
```bash
134-
pnpm run lint
168+
bun run test
135169
```
170+
171+
Run this inside the package directory you want to test.

0 commit comments

Comments
 (0)