DI containers are dead, long live context containers!
· 12 min read

info
This story is for you if:
- You're still sad React Context cannot be used in Server Components.
- You like the ideas of SOLID architecture and decoupling in your apps but have found current DI frameworks in TypeScript unsatisfying or too complex.
- You've ever wanted to see a naked, frameworkless DI container in its simplest form (NSFW warning :P).
- You love TypeScript and enjoy pushing its inference capabilities to their limits.
This is the story of how, while refactoring my React app from Client to Server Components, I was forced to spend a year of my free time to:
- rediscover DI containers,
- obsolete traditional DI frameworks,
- discover Context containers, and
- finally, build my own fully type-inferred context container framework, typectx.
A tale of dumb, costly refactoring decisions that I hope produced a useful result in the end :).