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

# Engines

> Add a UI platform to e2e, such as a desktop app or a TV, by choosing how to build an engine, in TypeScript or in any other language over the engine protocol.

An engine drives a user interface, such as a browser, a simulator, or a TV,
for `screen`, `app`, and the agent. `@e2e-dev/web`, `@e2e-dev/mobile`,
`@e2e-dev/desktop`, and `@e2e-dev/electron` are engines, and you can write
one for another platform. The runner drives every engine over the
[engine protocol](https://e2e.com/docs/reference/engine-protocol): JSON-RPC messages, one per
engine member.

```mermaid
flowchart LR
  R[e2e runner] -- engine protocol --> T{transport}
  T -- in process --> A[defineEngine: web, mobile, yours]
  T -- child process --> B[serveEngine, or a server in any language]
  T -- socket --> C[a server on another machine or device]
```

## Choose how to write one

| You want | Write | Start at |
| --- | --- | --- |
| An engine in TypeScript | `defineEngine`, set on a target | [Writing an engine](https://e2e.com/docs/writing-an-engine) |
| A TypeScript engine in its own process | `defineEngine`, served with `serveEngine` | [Serve a TypeScript engine](https://e2e.com/docs/reference/engine-protocol#serve-a-typescript-engine) |
| An engine in another language, or on a device | A server that answers the protocol's messages | [Write a server in another language](https://e2e.com/docs/reference/engine-protocol#write-a-server-in-another-language) |

An engine from `defineEngine` runs in the runner's process. Every call still
crosses the protocol, so an engine that passes its suite needs nothing a
server elsewhere couldn't receive.

## Find a type or a message

Every path implements one contract, and two pages hold all of it:

| You need | Page |
| --- | --- |
| A member, hook, capability, type, or error code of the contract | [`e2e/engine`](https://e2e.com/docs/reference/engine) |
| A message's params and result, a transport, or `connectEngine` and `serveEngine` | [Engine protocol](https://e2e.com/docs/reference/engine-protocol) |

## Next

<CardGroup cols={2}>
  <Card title="Writing an engine" icon="code" href="/writing-an-engine">
    Build an engine with `defineEngine`, step by step.
  </Card>
  <Card title="Engine servers" icon="network-wired" href="/reference/engine-protocol#engine-servers">
    Run an engine in another process, machine, or language.
  </Card>
</CardGroup>
