Skip to content

Dependency Injection

DI is centralized in backend/src/Containers/inversify.config.ts.

  • Keep controllers/use cases independent from concrete repository/service implementations.
  • Allow adapter replacement (e.g., OCR provider, token service) without route rewrites.
  • Keep one composition root for easier code review and onboarding.
  • Repositories: user, wallet, category, transaction, budget, budget allocation.
  • Use cases: auth, wallet, category, transaction, budget, dashboard.
  • Ports/services: token hashing, ID generation, OCR, voice, logger.
  • Presentation: controllers and auth middleware factory.
  • All injectable symbols are declared in backend/src/Containers/Types.ts.
container
.bind<TransactionCreatorPort>(TYPES.TransactionCreatorPort)
.toService(TYPES.AddTransactionImpl);

This alias lets AI flows reuse the same transaction creation use case.