The last provider registered for a given token wins. NestJS uses the order of the imports array to determine precedence — the module listed later takes priority. This silent shadowing is a common source of bugs and is best prevented by using unique namespaced tokens such as Symbols or InjectionToken.
Use Symbol() or InjectionToken for all non-class provider tokens — they are inherently unique.
Namespace string tokens with the module name: 'AuthModule.JwtSecret' not just 'JwtSecret'.
Avoid having two modules export providers under the same token.
Document which module is the authoritative source for shared infrastructure tokens.
Token shadowing is silent — there are no warnings at startup, only wrong behavior at runtime.