|
| 1 | +```markdown |
1 | 2 | # NotifyLog |
2 | 3 |
|
3 | 4 |  |
|
33 | 34 | - **Tools**: Prisma, GraphQL Playground, Prettier, ESLint, Docker |
34 | 35 |
|
35 | 36 | ## Clean Architecture |
36 | | -**NotifyLog** adheres to **clean architecture** and **SOLID principles**, ensuring modularity, testability, and maintainability. Key layers include: |
| 37 | +**NotifyLog** follows **clean architecture** and **SOLID principles**, ensuring modularity, testability, and maintainability. Key layers include: |
37 | 38 |
|
38 | 39 | - **Domain** (`apps/notifylog-api/src/domain/`): Defines interfaces (e.g., `INotificationRepository`, `IWebhookRepository`) for business logic, independent of frameworks (Single Responsibility). |
39 | 40 | - **Application** (`apps/notifylog-api/src/application/`): Implements business rules via factories (`NotificationFactory`) and strategies (`EmailNotificationStrategy`, `SMSNotificationStrategy`) (Dependency Inversion). |
|
43 | 44 | Shared utilities and logging are abstracted into `libs/` for reusability across apps. |
44 | 45 |
|
45 | 46 | ## Project Structure |
46 | | - |
| 47 | +``` |
47 | 48 | notifylog/ |
48 | 49 | ├── apps/ # Monorepo applications |
49 | 50 | │ ├── notifylog-api/ # NestJS microservice (GraphQL + Notification logic) |
@@ -135,4 +136,96 @@ notifylog/ |
135 | 136 | ├── README.md |
136 | 137 | ├── CONTRIBUTING.md |
137 | 138 | ├── CODE_OF_CONDUCT.md |
138 | | -└── LICENSE |
| 139 | +├── LICENSE |
| 140 | +``` |
| 141 | +
|
| 142 | +## Getting Started (Backend) |
| 143 | +### Prerequisites |
| 144 | +- Node.js (>=18.x) |
| 145 | +- MongoDB (local or Atlas) |
| 146 | +- Yarn or npm |
| 147 | +- Docker (optional) |
| 148 | +
|
| 149 | +### Installation |
| 150 | +1. Clone the repository: |
| 151 | + ```bash |
| 152 | + git clone https://github.com/your-username/notifylog.git |
| 153 | + cd notifylog |
| 154 | + ``` |
| 155 | +2. Install dependencies: |
| 156 | + ```bash |
| 157 | + yarn install |
| 158 | + ``` |
| 159 | +3. Set up environment variables: |
| 160 | + ```bash |
| 161 | + cp apps/notifylog-api/.env.example apps/notifylog-api/.env |
| 162 | + ``` |
| 163 | + Update `apps/notifylog-api/.env`: |
| 164 | + ```env |
| 165 | + DATABASE_URL=mongodb://localhost:27017/notifylog |
| 166 | + ``` |
| 167 | +4. Run Prisma migrations: |
| 168 | + ```bash |
| 169 | + cd apps/notifylog-api |
| 170 | + npx prisma migrate dev |
| 171 | + ``` |
| 172 | +5. Start the backend: |
| 173 | + ```bash |
| 174 | + yarn workspace notifylog-api start:dev |
| 175 | + ``` |
| 176 | + |
| 177 | +### Docker Setup |
| 178 | +Run both backend and frontend with Docker: |
| 179 | +```bash |
| 180 | +docker-compose up --build |
| 181 | +``` |
| 182 | + |
| 183 | +## Frontend Setup |
| 184 | +### Prerequisites |
| 185 | +- Node.js (>=18.x) |
| 186 | +- Backend running at `http://localhost:3000` |
| 187 | + |
| 188 | +### Installation |
| 189 | +1. Install frontend dependencies: |
| 190 | + ```bash |
| 191 | + cd apps/notifylog-ui |
| 192 | + yarn install |
| 193 | + ``` |
| 194 | +2. Run the frontend: |
| 195 | + ```bash |
| 196 | + yarn dev |
| 197 | + ``` |
| 198 | +3. Access at `http://localhost:3001`. |
| 199 | + |
| 200 | +## API Documentation |
| 201 | +Explore the **GraphQL API** via **GraphQL Playground** at [http://localhost:3000/graphql](http://localhost:3000/graphql). Example query: |
| 202 | +```graphql |
| 203 | +mutation SendNotification { |
| 204 | + sendNotification(input: { |
| 205 | + type: "EMAIL" |
| 206 | + to: "example@domain.com" |
| 207 | + subject: "Welcome!" |
| 208 | + message: "Hello from NotifyLog!" |
| 209 | + }) { |
| 210 | + success |
| 211 | + messageId |
| 212 | + } |
| 213 | +} |
| 214 | +``` |
| 215 | + |
| 216 | +## Testing |
| 217 | +Run tests with Jest: |
| 218 | +```bash |
| 219 | +yarn test |
| 220 | +``` |
| 221 | +Generate coverage: |
| 222 | +```bash |
| 223 | +yarn test:cov |
| 224 | +``` |
| 225 | + |
| 226 | +## Contributing |
| 227 | +Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines and [issues](https://github.com/your-username/notifylog/issues) for tasks (`good first issue`, `hacktoberfest`). Use issue templates in `.github/ISSUE_TEMPLATE`. Join our [Discord](https://discord.gg/your-invite-link). |
| 228 | + |
| 229 | +## License |
| 230 | +MIT License. See [LICENSE](LICENSE). |
| 231 | +``` |
0 commit comments