---
title: "Services and the edge"
image: "https://hem.run/social/hem.png"
---

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

# Services and the edge

A `service` is an interface for domain dependencies, emitted as a `Context.Service` class (§16 shows both sides). `Users!` yields the live implementation. Wiring implementations uses standard library code without dedicated syntax: layers are written with `Layer`. `Layer` is the one Effect namespace Hem does not auto-import (the other namespaces in this tour are inferred from usage); import it explicitly with `import { Layer } from "effect"`:

```hem
let UsersLive = Layer.effect(Users, effect {
  let db = Db!
  makeUsersService(db)
})
```

And the edge of a Workers app is one pipe chain in a route module:

```hem
export let loader = ({ params }: Route.LoaderArgs) =>
  getUser(params.userId) |> Effect.provide(AppLayer) |> Effect.runPromise
```

If a required service is omitted, the compiler reports which services are missing and where they were introduced, rather than emitting TypeScript's `Type 'Users' is not assignable to type 'never'`.

Source: https://hem.run/tour/services-and-the-edge/index.mdx
