The Notification Service is a modular application designed to manage subscriptions and send notifications through multiple channels. It supports subscription management, scheduled notifications, and distribution across various platforms such as email, SMS, and push notifications.
-
src/: Contains the source code for the application.
- index.ts: Entry point of the application.
- controllers/: Contains controllers for handling requests.
- subscription.controller.ts: Manages subscription-related operations.
- services/: Contains business logic for the application.
- subscription.service.ts: Handles subscription management.
- scheduler.service.ts: Manages scheduled notifications.
- dispatcher.service.ts: Distributes notifications across channels.
- channels/: Contains implementations for different notification channels.
- email.channel.ts: Sends notifications via email.
- sms.channel.ts: Sends notifications via SMS.
- push.channel.ts: Sends push notifications.
- models/: Defines data structures.
- subscription.ts: Represents a subscription object.
- jobs/: Contains job definitions for scheduled tasks.
- send-job.ts: Defines the job for sending notifications.
- utils/: Utility functions and helpers.
- logger.ts: Provides logging functionality.
- types/: Type definitions used throughout the application.
- index.ts: Exports various TypeScript types and interfaces.
-
config/: Contains configuration files.
- default.json: Default configuration settings.
-
scripts/: Contains scripts for various tasks.
- migrate.ts: Database migration script.
-
package.json: NPM configuration file.
-
tsconfig.json: TypeScript configuration file.
-
.env.example: Example environment variables.
-
Clone the repository:
git clone <repository-url> cd notification-service -
Install dependencies:
npm install -
Configure environment variables by copying
.env.exampleto.envand updating the values as needed. -
Run the application:
npm start
-
To manage subscriptions, use the SubscriptionController methods:
createSubscription: Create a new subscription.getSubscriptions: Retrieve all subscriptions.deleteSubscription: Remove a subscription.
-
Notifications can be scheduled using the SchedulerService, and they will be dispatched through the appropriate channels by the DispatcherService.
Contributions are welcome! Please submit a pull request or open an issue for discussion.
This project is licensed under the MIT License.