Skip to main content
implementEffect(contract, layerOrRuntime) creates an Effect-aware contract implementer.
import.ts
import { implementEffect } from "effect-orpc";

Signature

signature.ts
const oe = implementEffect(contract, AppLive);
// or
const oe = implementEffect(contract, runtime);

Implement a contract

router.ts
const oe = implementEffect(contract, UsersRepo.Default);

export const router = oe.router({
  users: {
    get: oe.users.get.effect(function* ({ input }) {
      return yield* UsersRepo.findById(input.id);
    }),
  },
});

Add context and middleware

context.ts
const oe = implementEffect(contract, runtime)
  .$context<RequestContext>()
  .use(({ context, next }) =>
    next({ context: { requestLabel: `${context.role}:${context.requestId}` } }),
  );

Contract leaf methods

MethodPurpose
.use(...)Add middleware to this contract leaf.
.handler(...)Implement with a standard oRPC handler.
.effect(...)Implement with an Effect handler.

See also

Last modified on June 15, 2026