Using Effect Context for Current User Information: Best Practices and Considerations

In the @effect/rpc doc, there's a CurrentUser tag being defined and this made me think about something.

Directly accessing the CurrentUser in different parts of the application is often useful, for example when we want to interact with the outside world "as this user" and provide that identity contextually to different client in the lower level layers of the application (grab user specific API keys, whatever). Instead of adding a user parameter of some to all functions down the way, context could play naturally here. Context is meant to solve this kind of problem, avoid arguments drilling.

Question: is yielding the CurrentUser in the core of the application a good idea or am I just shooting myself in the foot?

RPC is an implementation detail so my question is not about RPC, but really about using Effect context for passing info about the current User / Session / whatever is scoped to the current http request/response cycle (if developing a web server).
Was this page helpful?