Before being able to run this project locally you will need to create a Discord bot that you can use for testing. You can follow the instructions below for creating a bot.
Once you have your bot set up you can create an environment file at dev/.env
with the following variables (make sure
to replace the bot token/ID with your values):
POSTGRES_DB=movie_list
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=5432
POSTGRES_HOST=db
SERVER_PORT=8000
DISCORD_JWT_SECRET=discord_jwt_secret
JWT_SECRET=jwt_secret
DISCORD_BOT_JWT_SECRET=discord_bot_jwt_secret
DISCORD_BOT_TOKEN=<your bot token>
DISCORD_BOT_ID=<your bot ID>
UI_ENDPOINT=http://localhost:3000
You will also need Docker installed to run the project locally. Once you have Docker set up, you can build and start all services by running:
docker compose -f dev/docker-compose.yaml up --build
or if you already have images built:
docker compose -f dev/docker-compose.yaml up
Once everything is running, you can go to the UI at http://localhost:3000. Each service is watching its files and will restart or hot reload as needed without you having to restart manually.
Additionally, you will have to run npm i
in each service directory in order to get your IDE's to recognize that all
dependencies have been installed. You do not have to do this to develop locally, but if you don't your code editor will
complain.
You can create a Discord bot from the Developer Portal
- Click on New Application and give your app a name (name doesn't matter, it can be whatever you want)
- Under the General Information tab take note of the APPLICATION ID (that value maps to the
DISCORD_BOT_ID
environment variable in your.env
file) - Go to the Bot section and click on Add Bot
- From Bot tab, unselect the PUBLIC BOT option and click on Save Changes
- From the Bot tab click on Reset Token (you may be asked for password or 2FA code), take note of the token
displayed (this value is only shown once) that value will map to the
DISCORD_BOT_TOKEN
environment variable in your.env
file
From the Developer Portal, select the app that's associated with your bot.
- Select the OAuth2 tab, then select the URL Generator sub-option
- Check bot in the SCOPES section
- In the BOT PERMISSIONS sections select the following permissions
- Send Messages
- Copy the link at the bottom of the page, and navigate to it on your browser
- Follow the instructions on that page to select the server, and add the bot