It is a node.js server based on the idea of clean architecture and DDD best practices with event-driven architecture. This project is aimed to be executed in terms of both microservice and monolithic since each context has been separated into individual folder. Due to the fact of traffic is in low amount, monolithic is preferred in current version. However, it is easily to expand to microservice or even CQRS architecture.
The full product is still under constructing and the full product is committed to gitlab. I only share part of the use-case in order to demonstrate how I built up the staff-server.
-
Everything is use-case, no matter it is worker, event handler or normal api handler.
-
Workers are executed immediately when server start, e.g. building ternary tree for auto-complete searching feature.
-
Clean architecture
- References
Clean Architecture and Modular pattern
- References
Clean Architecture and Modular pattern
-
Controller layer define various of adapters firing use-case, e.g. api controller, graphql controller or worker controller.
- application
- dto
- IStaffDTO
- mapper
- StaffMap
- useCase
- createStaff
- getStaffbyID
- dto
- domain
- events
- Staff.ts
- ...
- infra
- http
- restful
- graphql
- repo
- socket
- streaming
- http
- Integration Test
- Unit Test
- Node.js with Express in Typescript
- WebSocket
- Apollo GraphQL Server
- Sequelize
-
Inspiration of structure