feat: expand DI container with lifecycle management and domain modules#553
Merged
Smartdevs17 merged 2 commits intoJun 28, 2026
Merged
Conversation
Smartdevs17#485) - DIContainer: singleton, transient, scoped lifecycles with <1ms resolution - DIContainer.createFresh() for test isolation (no shared singleton state) - container.validate() for startup validation with DI_VALIDATION=false feature flag - Per-domain modules: project.module.ts, auth.module.ts, payment.module.ts - bootstrapDI() entry point in di/index.ts - Comprehensive unit tests: all lifecycles, mock injection, dependency graph, validation, reset, and performance (<1ms assertion)
|
@devJaja is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@jajafwangshak86-ops Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #485
What's changed
backend/src/di/container.tsDIContainer.createFresh()— isolated instance for test mock injection, no shared statecontainer.validate()— iterates all registrations at startup; throws on misconfigured factoriescontainer.reset()— clears singleton cache (tests)get(),set(),has(), and typed getters unchangedbackend/src/di/modules/Per-domain module files that call
c.register():project.module.ts— ProjectRepository → ProjectService → ProjectControllerauth.module.ts— LockoutManager, AuditServicepayment.module.ts— AnalyticsService, VerificationService, InvoiceServicebackend/src/di/index.ts—bootstrapDI()validate()on startup (opt-out viaDI_VALIDATION=falseenv var)backend/src/di/__tests__/container.test.ts