{"id":21301771,"url":"https://github.com/dev-mayanktiwari/mlogs-email-service","last_synced_at":"2026-05-07T12:31:31.111Z","repository":{"id":260616024,"uuid":"880890439","full_name":"dev-mayanktiwari/mlogs-email-service","owner":"dev-mayanktiwari","description":"The notification service of MLOGS, can also be used as an isolated notification service. Use at your own risk.","archived":false,"fork":false,"pushed_at":"2024-12-13T20:59:22.000Z","size":173,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T19:45:59.426Z","etag":null,"topics":["backend","bullmq","email","mlogs","nodejs","notification","redis","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dev-mayanktiwari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-30T14:49:11.000Z","updated_at":"2024-12-13T20:59:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"5647713e-9002-4433-8a8f-93c33a7f6fb6","html_url":"https://github.com/dev-mayanktiwari/mlogs-email-service","commit_stats":null,"previous_names":["dev-mayanktiwari/mlogs-bullmq-email-microservice","dev-mayanktiwari/mlogs-email-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dev-mayanktiwari/mlogs-email-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-mayanktiwari%2Fmlogs-email-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-mayanktiwari%2Fmlogs-email-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-mayanktiwari%2Fmlogs-email-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-mayanktiwari%2Fmlogs-email-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev-mayanktiwari","download_url":"https://codeload.github.com/dev-mayanktiwari/mlogs-email-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-mayanktiwari%2Fmlogs-email-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32737634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","bullmq","email","mlogs","nodejs","notification","redis","typescript"],"created_at":"2024-11-21T15:50:57.268Z","updated_at":"2026-05-07T12:31:31.095Z","avatar_url":"https://github.com/dev-mayanktiwari.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MLOGS Email Microservice\r\n\r\n- [Service Overview](#service-overview)\r\n- [Getting Started](#getting-started)\r\n- [Dependency Graph](#dependency-graph)\r\n- [Development](#development)\r\n  - [Manual Setup](#manual-setup)\r\n  - [Setup using Docker](#setup-using-docker)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Service Overview\r\n\r\nThis repository houses the email service component of the [MLOGS](https://github.com/dev-mayanktiwari/mlogs-backend) application. The mlogs email service is a dedicated microservice for handling email-related functionalities such as account verification, password reset, and notifications. Built as a standalone service, it operates independently from the core mlogs backend, ensuring scalability and separation of concerns.\r\n\r\n### Built With\r\n\r\n- [Node.js](https://nodejs.org/en)\r\n- [Typescript](https://www.typescriptlang.org/)\r\n- [BullMQ](https://docs.bullmq.io/)\r\n- [Redis](https://redis.io/)\r\n- [Nodemailer](https://www.nodemailer.com/)\r\n\r\n## Getting Started\r\n\r\nTo get a local copy up and running, please follow these simple steps.\r\n\r\n### Prerequisites\r\n\r\nHere is what you need to be able to run MLOGS.\r\n\r\n- Node.js (Version: \u003e=20.x)\r\n- Redis \r\n- NPM\r\n\r\n### Dependency Graph\r\n\r\n![Backend Dependency Graph](./public/backend-dependency-graph.svg)\r\n\r\n## Development\r\n\r\nBefore setting up this email service, ensure the main backend is up and running with Redis properly configured. This service relies on Redis, using BullMQ to manage and queue emails.\r\n\r\nMake sure Redis is set up correctly so it can communicate with this service to handle email notifications and job processing.\r\n\r\n### Manual Setup\r\n\r\n1. Clone the repo into a public GitHub repository (or fork https://github.com/dev-mayanktiwari/mlogs-final).\r\n\r\n   ```sh\r\n   git clone https://github.com/dev-mayanktiwari/mlogs-email-service\r\n   ```\r\n\r\n   \u003e If you are on Windows, run the following command on `gitbash` with admin privileges: \u003cbr\u003e \u003e `git clone -c core.symlinks=true https://github.com/dev-mayanktiwari/mlogs-email-service` \u003cbr\u003e\r\n\r\n2. Go to the project folder\r\n\r\n   ```sh\r\n   cd mlogs-email-service\r\n   ```\r\n\r\n3. Install packages with npm\r\n\r\n   ```sh\r\n   npm install\r\n   ```\r\n\r\n4. Set up your `.env` file\r\n\r\n   - Duplicate `.env.example` to `.env`\r\n\r\n5. Setup Node\r\n   If your Node version does not meet the project's requirements as instructed by the docs, \"nvm\" (Node Version Manager) allows using Node at the version required by the project:\r\n\r\n   ```sh\r\n   nvm use\r\n   ```\r\n\r\n   You first might need to install the specific version and then use it:\r\n\r\n   ```sh\r\n   nvm install \u0026\u0026 nvm use\r\n   ```\r\n\r\n   You can install nvm from [here](https://github.com/nvm-sh/nvm).\r\n\r\n\r\n6. Redis Setup\r\n\r\n   To enable Redis functionality in the `mlogs` application, you need to configure Redis. You can set up Redis either locally or by using a cloud-based service.\r\n\r\n   Redis Cloud (Cloud-based)\r\n\r\n   1. **Choose a Redis Cloud Provider**\r\n\r\n      - Pick a Redis cloud provider from the following options:\r\n      - [Redis Labs](https://redislabs.com/)\r\n      - [Upstash](https://upstash.com/)\r\n      - [Aiven](https://aiven.io/redis)\r\n\r\n   2. **Create an Account and Provision a Redis Instance**\r\n\r\n      - Sign up for an account with your chosen provider.\r\n      - Create a new Redis instance through their dashboard.\r\n      - After the instance is created, you will be provided with connection details, including:\r\n        - **Host** (Redis endpoint)\r\n        - **Port** (usually `6379` or a custom port)\r\n        - **Password** (if authentication is enabled)\r\n\r\n   3. **Get the Redis Connection Details**\r\n\r\n      - You will need the following information from your Redis provider:\r\n        - **Host**: Your Redis instance hostname (e.g., `your-redis-hostname`).\r\n        - **Port**: Typically `6379`.\r\n        - **Password**: The password (if set) for connecting to the Redis instance.\r\n\r\n   4. **Add Redis Connection Details to Your `.env` File**\r\n\r\n      - In your `.env` file, configure the Redis connection as follows:\r\n\r\n        ```plaintext\r\n        REDIS_HOST=your-redis-hostname\r\n        REDIS_PORT=6379\r\n        REDIS_PASSWORD=your-redis-password (if applicable)\r\n        ```\r\n\r\n7. Nodemailer Setup\r\n   \r\n   To send notification emails, you need to configure an email account in the .env file, along with necessary credentials. It’s recommended to use app passwords instead of your main email password for security.\r\n   \r\n   If you’re using Gmail, you can follow this [guide to generate an app password](https://support.google.com/accounts/answer/185833?hl=en). For other email providers, check their settings for SMTP configuration and security best practices.\r\n\r\n   To send failed job notifications to the admin (optional), specify an admin email address in the .env file. You can use the same email account for both sending notifications and receiving admin alerts.\r\n\r\n   ```plaintext\r\n      MAILER_HOST=smtp.gmail.com  #GMAIL Example\r\n      MAILER_SERVICE=gmail        #GMAIL Example\r\n      MAILER_PORT=587\r\n      EMAIL_USER=your_email@example.com\r\n      EMAIL_PASS=youremailpassword\r\n      ADMIN_EMAIL=your_admin_email@example.com\r\n   ```\r\n\r\n8. Log Database Setup (Optional)\r\n\r\n   To enable logging in the `mlogs` application, you can set up a MongoDB database to store logs. Follow the steps below to configure MongoDB either through a managed service (MongoDB Atlas) or locally using Docker.\r\n\r\n   Setup using MongoDB Atlas (Cloud-based)\r\n\r\n   1. **Create an Account on MongoDB Atlas**\r\n\r\n      - Go to [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) and sign up for a free account.\r\n\r\n   2. **Create a New Cluster**\r\n\r\n      - After logging in, create a new cluster. Select your preferred cloud provider and region.\r\n\r\n   3. **Create a MongoDB User**\r\n\r\n      - Go to the \"Database Access\" section, and create a user with a username and password. Remember to keep these credentials safe.\r\n\r\n   4. **Get the Connection String**\r\n\r\n      - Replace `\u003cusername\u003e` and `\u003cpassword\u003e` in the connection string with the MongoDB user credentials you created.\r\n      - Go to the \"Connect\" section, select \"Connect your application,\" and copy the connection string.\r\n\r\n   5. **Add the Connection String to Your Environment Variables**\r\n\r\n      - In your `.env` file, add the connection string as follows:\r\n\r\n      ```plaintext\r\n      MONGO_URL=\"mongodb+srv://yourusername:yourpassword@yourcluster.mongodb.net/logs?retryWrites=true\u0026w=majority\"\r\n      ```\r\n\r\n   6. **Verify the Connection (Optional)**\r\n      - Run a quick connection test in your application to ensure MongoDB is correctly set up and accessible.\r\n\r\n\r\n9. Running the application\r\n\r\n   Once you've completed the setup, you can start the email service by running(make sure you have nodemon installed):\r\n\r\n   ```bash\r\n   npm run dev\r\n   ```\r\n\r\n### Setup using Docker\r\n\r\n1. Run Redis container (Optional, for email service)\r\n\r\n   Use the following docker command to run a docker container:\r\n\r\n   ```sh\r\n   docker run -d --name mlogs_redis -p 6379:6379 redis redis-server --requirepass mysecretpassword\r\n   ```\r\n\r\n   Update the .env file with the connection details:\r\n\r\n   ```plaintext\r\n   REDIS_HOST=localhost\r\n   REDIS_PORT=6379\r\n   REDIS_PASSWORD=mysecretpassword\r\n   ```\r\n\r\n2. Nodemailer Setup\r\n   \r\n   To send notification emails, you need to configure an email account in the .env file, along with necessary credentials. It’s recommended to use app passwords instead of your main email password for security.\r\n   \r\n   If you’re using Gmail, you can follow this [guide to generate an app password](https://support.google.com/accounts/answer/185833?hl=en). For other email providers, check their settings for SMTP configuration and security best practices.\r\n\r\n   To send failed job notifications to the admin (optional), specify an admin email address in the .env file. You can use the same email account for both sending notifications and receiving admin alerts.\r\n\r\n   ```plaintext\r\n      MAILER_HOST=smtp.gmail.com  #GMAIL Example\r\n      MAILER_SERVICE=gmail        #GMAIL Example\r\n      MAILER_PORT=587\r\n      EMAIL_USER=your_email@example.com\r\n      EMAIL_PASS=youremailpassword\r\n      ADMIN_EMAIL=your_admin_email@example.com\r\n   ```\r\n\r\n\r\n3. Run MONGODB Container (Optional)\r\n\r\n   Start a MONGODB container using docker, require for logging:\r\n\r\n   ```bash\r\n   docker run -d --name mlogs -p 27017:27017 mongo\r\n   ```\r\n\r\n   Update the .env file with the connection string:\r\n\r\n   ```plaintext\r\n   MONGO_URL=\"mongodb://localhost:27017\"\r\n   ```\r\n\r\n\r\n4. Build the image\r\n\r\n   In the root directory run the following command to build the image:\r\n\r\n   ```bash\r\n       docker build -t mlogs-email-service .\r\n   ```\r\n\r\n\r\n5. Start the container:\r\n\r\n   Run the image by running the following command and passing the env file:\r\n\r\n   ```bash\r\n       docker run -d --name mlogs_backend_container --env-file .env -p 3000:3000 mlogs-email-service\r\n   ```\r\n\r\n\u003c!-- CONTRIBUTING --\u003e\r\n\r\n## Contributing\r\n\r\nPlease see our [contributing guide](/CONTRIBUTING.md).\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-mayanktiwari%2Fmlogs-email-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev-mayanktiwari%2Fmlogs-email-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-mayanktiwari%2Fmlogs-email-service/lists"}