You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+99-28
Original file line number
Diff line number
Diff line change
@@ -2,57 +2,92 @@
2
2
3
3
Hello! We're glad to have you interested in contributing to Note Block World. This document will guide you through the process of setting up the project and submitting your contributions.
4
4
5
-
This page is a work-in-progress and will be updated as the project evolves. If you have any questions or need help, feel free to reach out to us on our [Discord server](https://discord.gg/note-block-world-608692895179997252).
5
+
This page is a work in progress and will be updated as the project evolves. If you have any questions or need help, feel free to reach out to us on our [Discord server](https://discord.gg/note-block-world-608692895179997252).
6
6
7
7
## Stack
8
8
9
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.
10
10
11
-
## Setting up
11
+
## Setting up the project for development
12
12
13
-
To easily install the project, you can use the [docker-compose.yml](docker-compose.yml) file.
13
+
To easily install the project, you can use the [docker-compose-dev.yml](docker-compose-dev.yml) file.
14
14
15
15
```bash
16
-
docker-compose up -d
16
+
docker-compose -f docker-compose-dev.yml up -d
17
17
```
18
+
obs: You can remove the `-d` flag to see the containers' logs.
18
19
19
-
This will start the backend and frontend servers, as well as a MongoDB instance.
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.
20
22
21
-
---
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:
22
24
23
-
Alternatively, you can install and use `pnpm` directly:
25
+
### backend:
24
26
25
27
```bash
26
-
npm i -g pnpm
27
-
pnpm install
28
-
```
28
+
export NODE_ENV=development
29
29
30
-
To configure the env variables, create `.env.development` and `.env.local` files in the backend and front-end packages, based on the example files provided. Alternatively, set the environment variables directly in your shell:
You can generate a JWT secret with OpenSSL and replace `jwtsecret` with the output:
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.
In Windows, you can use `set` instead of `export`:
48
84
49
-
```bash
50
-
set JWT_SECRET="jwtsecret"
51
-
set JWT_EXPIRES_IN="1d"
52
-
set DB_HOST="mongodb://localhost:27017/noteblockworld"
53
-
set DB_PASSWORD="noteblockworldpassword"
54
-
set DB_USER="noteblockworlduser"
55
-
set SERVER_URL="http://localhost:3000"
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
56
91
```
57
92
58
93
Finally, to run the frontend and backend servers:
@@ -61,4 +96,40 @@ Finally, to run the frontend and backend servers:
61
96
pnpm run dev
62
97
```
63
98
99
+
If you only want to run the backend or frontend, you can use the following commands:
100
+
101
+
```bash
102
+
pnpm run dev:server
103
+
```
104
+
105
+
```bash
106
+
pnpm run dev:web
107
+
```
108
+
64
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).
110
+
111
+
112
+
For populating the database with some test data by sending a post request:
113
+
114
+
```bash
115
+
curl -X 'GET' \
116
+
'http://localhost:4000/api/v1/seed/seed-dev' \
117
+
-H 'accept: */*'
118
+
```
119
+
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.
123
+
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:
125
+
126
+
```bash
127
+
pnpm test
128
+
```
129
+
130
+
## Code style
131
+
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:
0 commit comments