- OAuth Integration: Seamless connection with Outlook, allowing users to securely link their email accounts.
- Email Synchronization: Efficiently synchronize emails from Outlook, storing data in Elasticsearch.
- Real-time Updates: Monitors and reflects changes in email status, including read/unread, status, moved emails, deletions etc.
- Scalability: Designed to handle a large number of users and email accounts, supporting both horizontal and vertical scaling.
- Extensibility: Easily extendable to support additional email providers in the future using standard protocols.
- User-friendly Interface: Simple frontend for account management and real-time display of email synchronization status.
- Secure Data Handling: Utilizes Elasticsearch for secure and efficient storage of email data, ensuring user information is protected.
- Email Event Subscription: Subscribes to Outlook events using Microsoft Graph Client.
- Environment Configuration: Supports both production and development environments using environment variables.
- Docker Integration: Configured as an integrated system for streamlined operations.
- Centralized Logger and Error Handler: Efficiently manages application logs and errors for improved debugging and monitoring.
- Node.js (v14 or higher)
- Docker
- Azure account access
- Azure Admin privileges to register applications
- 
Clone the repository: git clone https://github.com/biswajitpanday/EmailEngine.git cd EmailEngine
- 
Set up environment variables: Create a .env file in the root directory and add the following variables: NODE_ENV=production [development | Production] <Select production for Docker & development for debugging in local> CORS_ORIGIN=http://localhost:3001 PORT=3000 ELASTICSEARCH_HOST=http://host.docker.internal:9200 ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=<your_elasticsearch_password> OUTLOOK_CLIENT_ID=<outlook_client_id> OUTLOOK_CLIENT_SECRET=<outlook_client_secret> NGROK_AUTHTOKEN=<ngrok_auth_token> 
- 
Build and start the Docker containers: npm run docker:up 
- 
Stop and remove the Docker containers: npm run docker:down 
- 
Clean up Docker resources: npm run docker:prune 
- 
Reset Docker environment: Master Command. This will run => (npm run docker:down && npm run docker:prune && npm run docker:up) npm run docker:reset 
- 
Hit the following Url on your browser and provide your microsoft credential and allow requested access. http://localhost:3001 
- 
Navigate to App Registrations - Go to Azure portal.
- Select "Azure Active Directory" > "App registrations".
- Click "New registration".
 
- 
Application Details - Name: Choose a descriptive name for your BACKEND app
- Supported account types: "Accounts in any organizational directory and personal Microsoft accounts".
- Redirect URI: Leave empty for backend configuration.
- Click "Register".
 
- Name: 
- 
Expose an API - In "Expose an API", set the Application ID URI to api://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
- Add a scope with:
- Scope name: choose a scope name
- Admin consent display name: "choose an admin consent display name"
- User consent display name: "choose a user consent display name"
 
- Scope name: 
- Click "Add scope".
 
- In "Expose an API", set the Application ID URI to 
- 
API Permissions - Under "API permissions", add the following Microsoft Graph permissions:
- Mail.Read
- Mail.ReadWrite
- User.Read
 
- Grant admin consent for these permissions.
 
- Under "API permissions", add the following Microsoft Graph permissions:
- 
Generate Client Secret - Go to "Certificates & secrets" and create a new client secret.
- Note down the secret value; it won't be visible again.
 
- 
Navigate to App Registrations - Go to Azure portal.
- Select "Azure Active Directory" > "App registrations".
- Click "New registration".
 
- 
Application Details - Name: Choose a descriptive name for your FRONTEND app
- Supported account types: "Accounts in any organizational directory and personal Microsoft accounts".
- Redirect URIs: Add http://localhost:3001/add-accountfor SPA andhttp://localhost:3000for web.
- Click "Register".
 
- Name: 
- 
Configure Authentication - Under "Authentication", enable "ID tokens" for single-page applications.
 
- 
API Permissions - Under "API permissions", add:
- Microsoft Graph permissions:
- Mail.Read
- Mail.ReadWrite
- User.Read
 
- Access to the backend API (api://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx):- Scope: Scope name you provided for the backend application
 
- Scope: 
 
- Microsoft Graph permissions:
- Grant admin consent for these permissions.
 
- Under "API permissions", add:
- 
Generate Client Secret - Go to "Certificates & secrets" and create a new client secret.
- Note down the secret value; it won't be visible again.
 
- In your backend .envfile, set the following variables:OUTLOOK_CLIENT_ID=<your_application_client_id> OUTLOOK_CLIENT_SECRET=<your_generated_client_secret> 
- 
How to obtain Ngrok Authtoken? To obtain Ngrok Authtoken please Login/Signup on Ngrok official site and find the menu Your Authtoken from the dashboard. 
- 
How to browse Elasticsearch Database? Here's a Chrome Extension: https://chromewebstore.google.com/detail/elasticvue/hkedbapjpblbodpgbajblpnlpenaebaa?hl=en 
For detailed information on managing Gitflow, please refer to the Gitflow documentation.