How ehwplus/zitadel-nodejs-nestjs works
Main Components
• NestJS Application: Represented by the “src” folder. This includes the primary application modules (app.module.ts), controllers (app.controller.ts), and entry point (main.ts).
• Zitadel Authentication Library: The “libs/zitadel-auth” folder is dedicated to the Zitadel authentication integration. It contains key modules, interfaces, strategies (using Passport), and module definitions specific to Zitadel.
• Configuration & Environment: Important configuration files and environment files (like .env.sample) are critical to the setup and deployment of the authentication flow.
Relationships and Interactions
• The NestJS application invokes the Zitadel authentication module (from libs/zitadel-auth) when handling authentication requests.
• The Passport strategy defined in libs/zitadel-auth (zitadel.strategy.ts) manages the interaction with the external Zitadel OIDC endpoints to facilitate login flows.
• Environment variables (populated from the .env file) configure client IDs, secrets, and other Zitadel-specific parameters.
• Any results from the authentication process are then handled by the NestJS controllers/services.
Architectural Patterns and Design Principles
• Modular Architecture: The code is structured into separate modules (e.g., the application module in “src” and the separate authentication library in “libs”), which hints at a clean separation of concerns.
• Passport Integration & Strategy Pattern: Using Passport for authentication with a custom strategy to liaise with Zitadel.
• Configuration-as-Code: The reliance on environmental configurations and dedicated config files (.env, tsconfig files, etc.) ensures a flexible, environment-specific setup.
Relevant Technologies
• NestJS: The primary backend framework.
• Passport: For managing authentication strategies.
• TypeScript: Evident from all the “.ts” files and tsconfig configurations.
• Zitadel: The external authentication provider.
• Potential tooling and linting frameworks such as ESLint and Prettier are used for code quality.