> ## Documentation Index
> Fetch the complete documentation index at: https://eo.utopy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# implementEffect

> Create an Effect-aware implementer for an oRPC contract.

`implementEffect(contract, layerOrRuntime)` creates an Effect-aware contract implementer.

```ts title="import.ts" theme={null}
import { implementEffect } from "effect-orpc";
```

## Signature

```ts title="signature.ts" theme={null}
const oe = implementEffect(contract, AppLive);
// or
const oe = implementEffect(contract, runtime);
```

## Implement a contract

```ts title="router.ts" theme={null}
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

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

## Contract leaf methods

| Method          | Purpose                                 |
| --------------- | --------------------------------------- |
| `.use(...)`     | Add middleware to this contract leaf.   |
| `.handler(...)` | Implement with a standard oRPC handler. |
| `.effect(...)`  | Implement with an Effect handler.       |

## See also

* [Contract-first APIs](/capabilities/contract-first)
* [`eoc`](/reference/eoc)
