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.
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.
This is a multipackage monorepo managed by Bun. It includes both the backend and frontend of the project:
- Backend: NestJS
- Frontend: Next.js with Server-Side Rendering (SSR)
- Database: MongoDB
- File Storage: Backblaze B2 via its S3-compatible API
You'll need the following installed on your machine:
We provide a docker-compose-dev.yml file that sets up:
- A MongoDB instance
- A local mail server (
maildev) - An S3-compatible storage (
minio) - A MinIO client
To start the services, run the following in the root directory:
docker-compose -f docker-compose.yml up -dRemove the
-dflag if you'd like to see container logs in your terminal.
You can find authentication details in the docker-compose.yml file.
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.
export NODE_ENV=development
export GITHUB_CLIENT_ID=UNSET
export GITHUB_CLIENT_SECRET=UNSET
export GOOGLE_CLIENT_ID=UNSET
export GOOGLE_CLIENT_SECRET=UNSET
export DISCORD_CLIENT_ID=UNSET
export DISCORD_CLIENT_SECRET=UNSET
export MAGIC_LINK_SECRET=development_magic_link_secret
# in seconds
export COOKIE_EXPIRES_IN=604800 # 1 week
export JWT_SECRET=developmentsecret
export JWT_EXPIRES_IN=1h
export JWT_REFRESH_SECRET=developmentrefreshsecret
export JWT_REFRESH_EXPIRES_IN=7d
export MONGO_URL=mongodb://noteblockworlduser:noteblockworldpassword@localhost:27017/noteblockworld?authSource=admin
export SERVER_URL=http://localhost:4000
export FRONTEND_URL=http://localhost:3000
#APP_DOMAIN=
export RECAPTCHA_KEY=disabled
export S3_ENDPOINT=http://localhost:9000
export S3_BUCKET_SONGS=noteblockworld-songs
export S3_BUCKET_THUMBS=noteblockworld-thumbs
export S3_KEY=minioadmin
export S3_SECRET=minioadmin
export S3_REGION=us-east-1
export WHITELISTED_USERS=
export DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/UNSET
export MAIL_TRANSPORT=smtp://user:pass@localhost:1025
export MAIL_FROM="Example <noreply@noteblock.world>"You’ll need to register developer applications with GitHub, Google, and Discord and replace the
UNSETplaceholders.
~~ For development, you can use the magic link login method instead. ~~
On the frontend, you can set the environment variables in a .env.local file or directly in your shell. The following variables are required:
THUMBNAIL_URL=localhost:9000
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
NEXT_PUBLIC_URL=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:4000/v1To install all dependencies, run in the root of the project:
bun installTo start both the backend and frontend:
bun run devTo start them individually:
-
Backend only:
bun run dev:server
-
Frontend only:
bun run dev:web
The frontend will run at http://localhost:3000 The backend API will be at http://localhost:4000
You can populate the development database with test data using:
curl -X 'GET' \
'http://localhost:4000/v1/seed/seed-dev' \
-H 'accept: */*'This route is only available in
NODE_ENV=development. It will create some sample users, songs, and comments.
Currently, tests are available for the backendand some packages in the packages directory.
We use bun's built-in test runner for testing. To run tests:
bun run testFor more information, see the bun test documentation.