effect-app uses a relatively thin layer around Effect RPC, adding the following changes:
- "Dynamic" middleware, based on configuration living on each Request. so instead of imperatively adding middleware to every RPC / Group, you configure it on a Request definition. e.g
allowAnonymous?: true will require a user for all endpoints, except those configured with allowAnonymous: true, idem with basic role requirements, e.g the default is to require admin access, unless you specify only the user role is required. Each dynamic middleware can either optionally provide context, or add to the Failures of an RPC
- Wrapping/Providing middleware on the global level; so not just per RPC or group, but for all.
- Providing middleware can provide Context; so more than 1 service at a time.
- a different API to define Controllers, and to use derived clients, with less ceremony to define rpcs and implement controllers (like there's the namespace auto derived from the folder structure)
- we do not support middleware that also affects the client, apart from Dynamic Middleware adding failure types to the RPCs.
- we support "bare" generator functions for controller handlers (instead of requiring
(x) => Effect.gen(function*() or Effect.fnUntraced(function* (x) wrapping
on the middleware level we are much more aligned now, except for the Dynamic Middleware.
TODO
effect-app uses a relatively thin layer around Effect RPC, adding the following changes:
allowAnonymous?: truewill require a user for all endpoints, except those configured withallowAnonymous: true, idem with basic role requirements, e.g the default is to require admin access, unless you specify only the user role is required. Each dynamic middleware can either optionally provide context, or add to the Failures of an RPC(x) => Effect.gen(function*()orEffect.fnUntraced(function* (x)wrappingon the middleware level we are much more aligned now, except for the Dynamic Middleware.
TODO
Router()ormatch()so we can support middleware on the controller level toorequires(the opposite ofprovides) RPC Middleware: play withrequires#293provides: [X, Y, Z]Context feature. https://github.com/Effect-TS/effect/pull/5328/filesrequires(seems harder due to the RpcGroup/toLayer api)RpcGroupmakeandtoLayerfrom prepared middleware.