https://github.com/vs4vijay/elli
A Microservice in NodeJS, Express, and Kafka to send out emails using SendGrid
https://github.com/vs4vijay/elli
api docker event-driven javascript kafka kafka-consumer microservice nodejs rest-api restful restful-api
Last synced: 5 months ago
JSON representation
A Microservice in NodeJS, Express, and Kafka to send out emails using SendGrid
- Host: GitHub
- URL: https://github.com/vs4vijay/elli
- Owner: vs4vijay
- Created: 2019-11-14T10:39:47.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2025-03-11T10:13:13.000Z (about 1 year ago)
- Last Synced: 2025-04-05T20:04:20.451Z (12 months ago)
- Topics: api, docker, event-driven, javascript, kafka, kafka-consumer, microservice, nodejs, rest-api, restful, restful-api
- Language: JavaScript
- Homepage:
- Size: 1.87 MB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 73
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elli - Email Service
A Microservice to send out emails using SendGrid
---
## Screenshots
### Email Template

### Actual Email

---
### Pre-requisite
Create a file `.env` with appropriate ENV. VARIABLES Values. Application reads this value while bootstrapping. e.g. Fill the SandGrid API Key and Template Id.
```
SENDGRID_API_KEY=""
FROM_EMAIL="vs4vijay@gmail.com"
TEMPLATE_SALE_SUMMARY="d-8ee94062b404488094ee4d1b44fb3d0c"
APP_URL="https://www.huddl.ai/features"
SENDER_NAME="Vijay Soni"
```
- Template is provided in `/templates` folder, Please upload it on SandGrid and get the template id
---
## Running
### Run without Docker
- `npm install` OR `yarn`
- `node src/app.js` OR `npm start` OR `npm start | pino-pretty`
### Run with Docker
- `docker build -t email-service .`
- `docker run -p 3333:3333 --env-file=".env" email-service`
---
## Push image to registry
- `docker build -t vs4vijay/email-service .`
- `docker login`
- `docker push vs4vijay/email-service`
---
## API Usage
Request: `POST /api/v1/email`
Body:
```javascript
{
"email": "vs4vijay@gmail.com",
"metadata": {
"name": "Vijay Soni",
"sale_id": "BigBillionDay101"
}
}
```
Example:
```bash
curl -X POST -d '{"email":"vs4vijay@gmail.com","metadata": {"name":"Jay Kumar","sale_id":123}}' "http://0.0.0.0:3333/api/v1/email" -H "Content-Type: application/json"
```
---
## To Do
- [x] Basic Node + Express
- [x] Dockerize
- [ ] Run as non-root user
- [ ] Multistage Build
- [ ] Kubernetes (Good to have)
- [ ] Deploy to Cloud
- [ ] nginx
- [ ] Code
- [x] Use `yarn` instead of `npm`
- [ ] Validation and Error Frameworks
- [x] Enhance the code structure and decouple
---
## Development Notes
```
npm i -D prettier eslint eslint eslint-config-prettier eslint-plugin-prettier
Install ESLint
Install Prettier
printWidth: 80
curl -X POST -d '{"metadata": {}}' "0.0.0.0:3333/api/v1/email" -v -H "Content-Type: application/json"
curl -X POST -d '{"email":"vs4vijay@gmail.com","metadata": {"name":"Jay Kumar","sale_id":888}}' "0.0.0.0:3333/api/v1/email" -H "Content-Type: application/json"
class based controller
```