|
1 | 1 | # NotifyLog |
2 | 2 |
|
3 | | - |
4 | | - |
5 | | - |
| 3 | + |
| 4 | + |
| 5 | + |
6 | 6 |
|
7 | | -**NotifyLog** is a full-stack Node.js/NestJS microservice built with clean architecture and SOLID principles, designed for sending email/SMS notifications, logging messages/errors, and managing webhooks. It’s portable, modular, and paired with a Next.js/React frontend to visualize notification and error log history. Features an interactive **Swagger UI** for API exploration. |
| 7 | +**NotifyLog** is a full-stack Node.js/NestJS microservice built with **clean architecture** and **SOLID principles**, designed for sending email/SMS notifications, logging messages/errors, and managing webhooks. It’s portable, modular, and paired with a Next.js/React frontend dashboard for visualizing notification and error log history. Features a **GraphQL API** for flexible querying. |
8 | 8 |
|
9 | 9 | ## Table of Contents |
10 | 10 | - [Features](#features) |
11 | 11 | - [Tech Stack](#tech-stack) |
| 12 | +- [Clean Architecture](#clean-architecture) |
| 13 | +- [Project Structure](#project-structure) |
12 | 14 | - [Getting Started](#getting-started) |
13 | 15 | - [Frontend Setup](#frontend-setup) |
14 | 16 | - [API Documentation](#api-documentation) |
| 17 | +- [Testing](#testing) |
15 | 18 | - [Contributing](#contributing) |
16 | 19 | - [License](#license) |
17 | 20 |
|
18 | 21 | ## Features |
19 | 22 | - Send notifications (email/SMS) with a strategy pattern. |
20 | | -- Dual logging: Winston for info logs, MongoDB for error logs. |
| 23 | +- Centralized logging with Winston and MongoDB transport. |
21 | 24 | - Webhook subscriptions for real-time event notifications. |
22 | | -- Advanced log filtering and retrieval. |
23 | | -- Next.js/React frontend for notification and error log history. |
24 | | -- **Swagger UI** for interactive API documentation. |
| 25 | +- Advanced log filtering and retrieval via GraphQL. |
| 26 | +- Next.js/React frontend dashboard for notification and error log history. |
| 27 | +- **GraphQL API** for flexible, type-safe queries. |
| 28 | +- Extensible and portable for integration into any project. |
25 | 29 |
|
26 | 30 | ## Tech Stack |
27 | | -- **Backend**: Node.js, NestJS, MongoDB, Mongoose, Winston, TypeScript |
| 31 | +- **Backend**: Node.js, NestJS, GraphQL, Prisma, MongoDB, Winston, TypeScript |
28 | 32 | - **Frontend**: Next.js, React, Tailwind CSS, React Query |
29 | | -- **Tools**: Swagger UI, Prettier, ESLint |
| 33 | +- **Tools**: Prisma, GraphQL Playground, Prettier, ESLint, Docker |
30 | 34 |
|
31 | | -## Getting Started (Backend) |
32 | | -### Prerequisites |
33 | | -- Node.js (>=18.x) |
34 | | -- MongoDB (local or Atlas) |
35 | | -- Git |
| 35 | +## Clean Architecture |
| 36 | +**NotifyLog** adheres to **clean architecture** and **SOLID principles**, ensuring modularity, testability, and maintainability. Key layers include: |
36 | 37 |
|
37 | | -### Installation |
38 | | -1. Clone the repository: |
39 | | - ```bash |
40 | | - git clone https://github.com/your-username/NotifyLog.git |
41 | | - cd NotifyLog |
| 38 | +- **Domain** (`apps/notifylog-api/src/domain/`): Defines interfaces (e.g., `INotificationRepository`, `IWebhookRepository`) for business logic, independent of frameworks (Single Responsibility). |
| 39 | +- **Application** (`apps/notifylog-api/src/application/`): Implements business rules via factories (`NotificationFactory`) and strategies (`EmailNotificationStrategy`, `SMSNotificationStrategy`) (Dependency Inversion). |
| 40 | +- **Infrastructure** (`apps/notifylog-api/src/infrastructure/`): Handles persistence (`prisma/schema.prisma`) and repositories (`NotificationRepository`, `WebhookRepository`) (Open/Closed). |
| 41 | +- **Presentation** (`apps/notifylog-api/src/presentation/`): Exposes GraphQL APIs through resolvers (`NotificationResolver`, `WebhookResolver`, `LogResolver`) (Interface Segregation). |
42 | 42 |
|
| 43 | +Shared utilities and logging are abstracted into `libs/` for reusability across apps. |
43 | 44 |
|
44 | | -Install dependencies:npm install |
45 | | - |
46 | | - |
47 | | -Create .env:MONGO_URI=mongodb://localhost:27017/notifylog |
48 | | - |
49 | | - |
50 | | -Start MongoDB:mongod |
51 | | - |
52 | | - |
53 | | -Run the backend:npm run start |
54 | | - |
55 | | - |
56 | | - |
57 | | -Testing |
58 | | - |
59 | | -Access Swagger UI: http://localhost:3000/api |
60 | | -Send notification:curl -X POST http://localhost:3000/api/notifications \ |
61 | | --H 'Content-Type: application/json' \ |
62 | | --d '{"recipient":"test@example.com","subject":"Test","body":"Message ID: MSG123.","mediaType":"EMAIL","notificationType":"message-id"}' |
63 | | - |
64 | | - |
65 | | -Get logs:curl http://localhost:3000/api/logs?level=error&context=NotificationController |
66 | | - |
67 | | - |
68 | | - |
69 | | -Frontend Setup |
70 | | -Prerequisites |
71 | | - |
72 | | -Node.js (>=18.x) |
73 | | -Backend running at http://localhost:3000 |
74 | | - |
75 | | -Installation |
76 | | - |
77 | | -Clone the frontend (or navigate to directory):git clone https://github.com/your-username/notifylog-frontend.git |
78 | | -cd notifylog-frontend |
79 | | - |
80 | | - |
81 | | -Install dependencies:npm install |
82 | | - |
83 | | - |
84 | | -Run the frontend:npm run dev |
85 | | - |
86 | | - |
87 | | -Access at http://localhost:3001. |
88 | | - |
89 | | -API Documentation |
90 | | -Explore APIs interactively via Swagger UI at http://localhost:3000/api. Test endpoints like /api/notifications, /api/webhooks, and /api/logs with a user-friendly interface. |
91 | | -Contributing |
92 | | -Contributions are welcome! Check CONTRIBUTING.md for guidelines and issues for tasks (good first issue, hacktoberfest). Join our Discord. |
93 | | -License |
94 | | -MIT License. See LICENSE.``` |
| 45 | +## Project Structure |
0 commit comments