NestJS architecture, dependency injection, validation, security, errors, testing, persistence, APIs, microservices, and deployment patterns with prioritized rule tiers and companion rule files.
99
100%
Does it follow best practices?
Impact
97%
1.12xAverage score across 2 eval scenarios
Advisory
Suggest reviewing before use
A B2B SaaS company is building a new platform and needs a complete authentication system. Currently, the team is using hard-coded credentials in the codebase and returning full database user records directly to API consumers. The security team has flagged both issues and requested a proper implementation before the platform goes live.
The platform requires users to log in with email and password, receive tokens they can use for subsequent API calls, and be able to refresh their session without re-entering their password. When a user changes their password or logs out, all existing sessions should be invalidated. The system also needs to protect against brute-force attacks on the login endpoint.
The engineering lead wants the authentication module implemented as a self-contained NestJS module that can be imported by other feature modules. The system must be deployable across staging and production environments with different secrets, and configuration errors should be caught at application startup rather than at runtime.
Produce TypeScript source files for a NestJS authentication module. The implementation should include:
main.ts snippet or separate file showing application bootstrap configurationauth.config.ts (or similar) showing the configuration namespace/schemaName your output files following NestJS conventions and place them under src/auth/. Include a brief IMPLEMENTATION_NOTES.md summarizing key security decisions made during implementation.
evals
scenario-1
scenario-2
rules