This is a server application built with Node.js and Express. It uses various packages such as nodemailer
for sending emails, openai
for AI functionalities, googleapis
for Google APIs, and axios
for HTTP requests and bullMQ
to process queues.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You need to have Node.js and npm installed on your machine. You can download Node.js from here and npm is included in the installation.
- Clone the repository to your local machine
git clone https://github.com/krrishexe/ReachInbox-Assignment
- Navigate to the root directory of the project directory :
cd server
- Run
npm install
to install all the dependencies - Create a
.env
file in the root directory with same IDs as in.env.example
file and fill in the required details.
- To start the server, run the following command in your terminal
npm start
This will start the server at localhost:5000 (or whatever port you have specified).
- To start the worker.ts file, run the following command in your terminal
nodemon src/worker.ts
- To start the redis server, run the following command in your terminal
docker run -itd -p 6379:6379 redis
- Node.js
- Express.js
- Nodemailer
- OpenAI
- Google APIs
- Axios
- bullMQ
- Zod (for validation)
For Google's OAuth2.0:
/api/mail/user/:email
- GET request to send an email/api/mail/drafts/:email
- GET request to view drafts mail./api/mail/drafts/:email
- GET request to view drafts mail.api/mail/read/:email/message/:message
- GET request to read a specific email(using id).api/mail/list/:email
- GET request to get a list of top 10 mails.api/mail/list/:email
- GET request to get a list of top 10 mails.api/mail/readdata/:id
- POST request to send a single mail for particular ID. format :
{
"from":"[email protected]",
"to":"[email protected]"
}
api/mail/sendmulti/:id
- POST request to send multiple mails to multiple users simulataneously for particular ID. format :
{
"from":"[email protected]",
"to":["[email protected]","[email protected]","[email protected]" ...]
}