Skip to content

Latest commit

 

History

History
74 lines (51 loc) · 1.29 KB

README.md

File metadata and controls

74 lines (51 loc) · 1.29 KB

Discord Backend

Discord Clone using React, ReactQuery, Tailwindcss, Redux, Socket IO, NodeJS, Express, MongoDB and Redis.



Setup Backend

To run backend API, follow these steps:

inside backend directory

Install the dependencies:

yarn install

If you already have MongoDB and Redis installed on your system you can skip this step, otherwise you can run below command to install and run MongoDB and Redis using Docker.
# run MongoDB and Redis containers
yarn docker:dev

Set the environment variables:
cp .env.example .env

# open .env and modify the environment variables (if needed)

Commands

Running locally:

yarn dev

now backend will be running on http://localhost:4000

Environment Variables

The environment variables can be found and modified in the .env file. They come with these default values:

# Port number
PORT=4000

# URL of the Mongo DB
MONGODB_URL=mongodb://127.0.0.1:27017/discord-clone

# JWT
# JWT secret key
JWT_SECRET=thisisasamplesecret
# Number of minutes after which an access token expires
JWT_ACCESS_EXPIRATION_MINUTES=30
# Number of days after which a refresh token expires
JWT_REFRESH_EXPIRATION_DAYS=30

# redis
REDIS_HOST=redis://localhost:6379

production deploy