-
Couldn't load subscription status.
- Fork 14
Home
Hello reader! Welcome to multi-email. There are two ways you can set up the project locally. The first method is done manually, and the second one is with docker. Let's do the manual way first:
- Latest Node js version
- Yarn installed (npm i -g yarn)
- Mongodb installed on local system
- .env file with all required variables (check environment variables mentioned below)
mkdir multi-email
cd multi-email
git clone https://github.com/MultiEmail/backend.git
cd backendyarn installyarn devyarn build
npm i -g .
multi-email-admin -e <email> -u <username> -p <password>PSA: If you are using unix operating system than prefix all bash commands with sudo
- Docker is installed on your local system
-
.envfile with all required variables (check environment variables mentioned below)
docker compose --env-file ./.env up
docker compose --env-file ./.env up --build
List current running docker containers
docker psOutput
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d07f06c78445 backend-api "docker-entrypoint.s…" 46 minutes ago Up 46 minutes 0.0.0.0:3001->3001/tcp, :::3001->3001/tcp Server
91826c111b76 mongo:latest "docker-entrypoint.s…" 52 minutes ago Up 46 minutes 0.0.0.0:2717->27017/tcp, :::2717->27017/tcp Database
now copy the CONTAINER ID of image/container backend-api and replace <container_id> in the below mentioned commands and execute them
# build and install the command line tool in docker container
docker exec <container_id> yarn build
docker exec <container_id> npm i -g .# create new admin user in database in docker container
docker exec <container_id> multi-email-admin -e <email> -u <username> -p <password>| Container | PORT (host) | Port (container) |
|---|---|---|
| Server | 3001 | 3001 |
| MongoDB | 2717 | 27017 |
if you want to access database inside docker container from host than use
mongosh --port 2717or if you want to use mongodb compass than you can use this connection string
mongodb://mongo_db:27017/multiemail
To run this project, you will need to add the following environment variables to your .env file
| Name | Description | Example |
|---|---|---|
| DB_URI | URI on which database is running | mongodb://localhost:27017/multiemail |
| GOOGLE_CLIENT_ID | Client ID obtained while creating google oauth concent screen | 758327950938-90jskrnp9b8d2e6ljpqrstd8fdl2k9fljkhchasnnrnj8.apps.googleusercontent.com |
| GOOGLE_CLIENT_SECRET | Client Secret obtained while creating google oauth concent screen | GOCSPX-NL52LzLNzF6YGJxlAoeLAnGK-a6 |
| NODE_ENV | What type of environment are you running this app in | development |
| EMAIL_ID | Which ID will be used for sending email | no-reply@multiemail.com |
| EMAIL_PASSWORD | Password of your email id | mystrongpassword |
| ACCESS_TOKEN_PRIVATE_KEY | private RSA key which will be used to sign access token | check .env.example file |
| ACCESS_TOKEN_PUBLIC_KEY | public RSA key which will be used to verify access token | check .env.example file |
| REFRESH_TOKEN_PRIVATE_KEY | private RSA key which will be used to sign refresh token | check .env.example file |
| REFRESH_TOKEN_PUBLIC_KEY | public RSA key which will be used to verify refresh token | check .env.example file |
- Your
DB_URImust bemongodb://mongo_db:27017/multiemailif you are using docker - If you use gmail account as
EMAIL_IDthan you must enable 2FA for your google account and generate app password and use it asEMAIL_PASS
- You can get google credentials by following this guide
- You can use crypto tools for generating RSA keys for access and refresh tokens
- RSA keys must be
1024