@domusjs/auth Introduction
The Auth Module in DomusJS provides a modular, extensible foundation for handling user authentication in modern backend applications.
What Does the Auth Module Provide?
Section titled “What Does the Auth Module Provide?”The Auth Module in DomusJS provides a modular, extensible foundation for handling user authentication in modern backend applications.
✅ AuthService → A pluggable service that works with multiple authentication strategies (local, social, etc.) that the developer implements.
✅ JWTService → A ready-to-use service built on top of jsonwebtoken to issue and verify JWT tokens.
✅ JWT middleware → A middleware that can be plugged into an express app to authenticate requests using a JWT token.
Note: the module does not force a fixed set of strategies — it provides the scaffolding and leaves the strategy implementations flexible and customizable by the developer.
Why Modular Authentication?
Section titled “Why Modular Authentication?”DomusJS’s auth module is designed to be:
- Extensible → Add or swap strategies (e.g., GitHub, Facebook) easily.
- Decoupled → Core domain logic is not tied to specific libraries or frameworks.
- Secure → Built on industry best practices using JWT.
- Composable → Works seamlessly with other DomusJS modules like jobs and observability.
Use Cases
Section titled “Use Cases”- Build backend APIs with secure user authentication.
- Support multiple authentication methods (password, social login, token-based).
- Integrate login/register flows into microservices or modular applications.
- Provide JWT-secured routes and user context handling.
✅ Whether you’re building a simple API or a complex microservice architecture, the Auth Module gives you the tools to handle authentication robustly.