Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 7 days 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 (about 5 years ago)
- Default Branch: develop
- Last Pushed: 2024-09-18T08:03:57.000Z (2 months ago)
- Last Synced: 2024-09-18T10:39:33.150Z (2 months ago)
- Topics: api, docker, event-driven, javascript, kafka, kafka-consumer, microservice, nodejs, rest-api, restful, restful-api
- Language: JavaScript
- Homepage:
- Size: 1.81 MB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 71
-
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
![](./screenshots/EmailTemplate.png)### Actual Email
![](./screenshots/Email1.png)---
### 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="[email protected]"
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": "[email protected]",
"metadata": {
"name": "Vijay Soni",
"sale_id": "BigBillionDay101"
}
}
```Example:
```bashcurl -X POST -d '{"email":"[email protected]","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 PrettierprintWidth: 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":"[email protected]","metadata": {"name":"Jay Kumar","sale_id":888}}' "0.0.0.0:3333/api/v1/email" -H "Content-Type: application/json"
class based controller
```