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
+75-39Lines changed: 75 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,45 @@ This page is a work in progress and will be updated as the project evolves. If y
6
6
7
7
## Stack
8
8
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)
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:
14
32
15
33
```bash
16
34
docker-compose -f docker-compose-dev.yml up -d
17
35
```
18
-
obs: You can remove the `-d` flag to see the containers' logs.
19
36
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.
22
40
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
+
---
24
42
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.
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. ~~
74
98
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:
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
92
113
93
-
Finally, to run the frontend and backend servers:
114
+
To install all dependencies, run in the root of the project:
94
115
95
116
```bash
96
-
pnpm run dev
117
+
bun install
97
118
```
98
119
99
-
If you only want to run the backend or frontend, you can use the following commands:
120
+
---
100
121
101
-
```bash
102
-
pnpm run dev:server
103
-
```
122
+
## Running the Project
123
+
124
+
To start both the backend and frontend:
104
125
105
126
```bash
106
-
pnpm run dev:web
127
+
bun run dev
107
128
```
108
129
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
+
```
110
143
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)
111
146
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:
113
152
114
153
```bash
115
154
curl -X 'GET' \
116
155
'http://localhost:4000/api/v1/seed/seed-dev' \
117
156
-H 'accept: */*'
118
157
```
119
158
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.
123
160
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
125
162
126
-
```bash
127
-
pnpm test
128
-
```
163
+
Currently, tests are available for the `server` and `shared` packages.
129
164
130
-
## Code style
165
+
We use [Jest](https://jestjs.io/) for testing. To run tests:
131
166
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:
133
167
```bash
134
-
pnpm run lint
168
+
bun run test
135
169
```
170
+
171
+
Run this inside the package directory you want to test.
0 commit comments