The Notification Service is an application developed in Node.js with the aim of providing a solution for sending notifications via email and SMS. It uses the SendGrid platforms to send emails and Twilio to send SMS messages. The project was built on technologies: Express, TypeScript and MongoDB.
- Sending emails using the Sendgrid API
- Sending SMS messages using the Twilio API
- Data entry validation using YUP
- Event logging using the Winston and Morgan
- Tests using the Jest
notification-service
├── LICENSE
├── README.md
├── jest.config.js
├── package-lock.json
├── package.json
├── src
│ ├── config
│ │ ├── logger.ts
│ │ └── mongoose.ts
│ ├── controller
│ │ ├── email.controller.ts
│ │ └── sms.controller.ts
│ ├── interfaces
│ │ ├── email.interface.ts
│ │ └── sms.interface.ts
│ ├── middlewares
│ │ └── morganMiddleware.ts
│ ├── models
│ │ ├── email.model.ts
│ │ └── sms.model.ts
│ ├── repositories
│ │ ├── email.repository.spec.ts
│ │ ├── email.repository.ts
│ │ └── sms.repository.ts
│ ├── routes
│ │ ├── email.routes.ts
│ │ ├── main.routes.ts
│ │ └── sms.routes.ts
│ ├── services
│ │ ├── email
│ │ │ ├── send.email.service.spec.ts
│ │ │ ├── send.email.service.ts
│ │ │ ├── update.email.service.spec.ts
│ │ │ └── update.email.service.ts
│ │ └── sms
│ │ └── send.sms.service.ts
│ └── validations
│ ├── email.validator.schema.ts
│ └── sms.validator.schema.ts
└── tsconfig.json
Before running the project, make sure you have the following tools installed:
- Node.js
- MongoDB
- Clone the repository to your local environment:
git clone [email protected]:lucas-eedu/notification-service.git
- Navigate to the project directory:
cd notification-service
- Install project dependencies using npm:
npm install
- Configure the environment variables: Copy the .env.example file to .env in the project root and set the following variables:
APP_PORT=3000
APP_URL=http://localhost
APP_STAGE="development"
MONGODB_URI=MongoDBDatabaseURL
SENDGRID_API_KEY=SuaChaveAPIdoSendGrid
TWILIO_SID=YourSendGridAPIKey
TWILIO_AUTH_TOKEN=YourTwilioAuthenticationToken
TWILIO_PHONE=YourPhoneNumberTwilio
Replace the above values with your MongoDB authentication and configuration data.
- Start the server:
npm start
The server will be available at http://localhost:3000.
npm test
Unit tests for email and SMS services, as well as integration tests for controllers.
Contributions are welcome! If you encounter any issues, have an idea for a new feature, or want to improve existing code, feel free to open an issue or submit a PR request. Let's build this project together and make it even better!
Linkedin: https://www.linkedin.com/in/lucas-eduardo/
E-mail: [email protected]