Recently while developing TsFullStack, I deeply integrated Effect into the backend API design.
Why Effect-TS?
Consider this file upload API example - it internally depends on authService (user authentication). If we were to pass auth through parameters, it would become extremely cumbersome in nested call scenarios, especially when new dependencies need to be added later (requiring full-chain modifications).
Traditional solutions like thread-local variables (CLS in Node.js), InversifyJS, or Vue's provide/inject all share one critical limitation: you can't know a program's dependencies until runtime (or after reading the entire codebase).
Effect solves this elegantly through its type system. In this TsFullStack example running our upload API, if I manually comment out the authService provider, TypeScript immediately flags the missing AuthService dependency:
This gives us compile-time knowledge of all dependencies. Why is this revolutionary?
- Writing robust systems: Eliminates whole categories of dependency-related bugs
- Unit testing: No more guessing what dependencies a component needs - they're explicitly declared in the type system
Top comments (0)