# How the parts fit together

> The service, the endia command line, images, machines and fleets, and how they map to Docker.

East India gives you, your AI and your automated tests throwaway Windows desktops to work in. You describe Windows images in Dockerfile-style recipes and the machines that run them in Compose files. East India then creates the machines, and you, your AI or your tests run programs in them, copy files in and out, control their desktops and take screenshots. If you know Docker and Docker Compose, you already know most of East India: an image is a Windows disk instead of a container image, and each Compose service becomes a Hyper-V virtual machine instead of a container.

## The parts

- **The East India service** runs on the Windows PC that hosts Hyper-V. It does all the work: it creates, starts and removes virtual machines, and talks to the programs inside them.
- **The `endia` command line** is how you ask the service for work. It runs on the PC itself or in a Docker sandbox on the same PC, and it follows Docker's commands and options wherever Docker has one.
- **Access** follows Docker Desktop. On the PC, members of the `eastindia-users` group reach the service through a named pipe and need no certificate. A Docker sandbox presents a client certificate instead. Every authorised user or client may run every command.
- **An image** is a Windows disk that machines start from. A root image is Windows with East India's programs, which `endia base prepare` installs from a Windows disc; a built image adds the steps of a recipe on top of a parent image.
- **A machine** is a Hyper-V virtual machine on its own new disk, layered over an image. A machine that is removed takes its disk with it; the image is unchanged.
- **A fleet** is everything one Compose project creates: its machines, private networks and volumes. `endia compose up` creates it and `endia compose down` removes it.

## Docker equivalents

| Docker | East India |
|---|---|
| `docker build` | `endia build`, with a recipe in Dockerfile syntax |
| `docker compose up`, `down`, `exec`, `cp`, `logs` | the same commands under `endia compose` |
| a container | a machine |
| a container's main process | a machine's main process; when it exits, the machine stops |
| `docker exec`, `docker cp`, `docker top` | `endia exec`, `endia cp`, `endia process ls` |
| (none) | `endia desktop`, which drives a machine's Windows desktop |

East India has no `endia run`. Machines come only from a Compose file, even when you need just one.

## Client libraries

A test runner written in C#, Python or JavaScript can call East India's API through a client library rather than run `endia` and read what it prints. Each library gives every answer as a typed record. A refusal arrives as an exception that carries the API's error code, such as `NOT_FOUND` or `TIMEOUT`. A program's exit code arrives in full: 3010 stays 3010.

| Language | Package | Guide |
|---|---|---|
| C# | NuGet `EastIndia.Client` (not yet published) | |
| Python 3.10 and later | PyPI `endia`, imported as `endia` | [endia-python](https://github.com/teaToolkit/endia-python/blob/main/REFERENCE.md) |
| Node 20 and later, with TypeScript types | npm `endia` | [endia-node](https://github.com/teaToolkit/endia-node/blob/main/REFERENCE.md) |

The Python library installs with `pip install endia` and is imported with `import endia`. Until East India 0.16.80 it was shipped as a wheel named `eastindia_client`. `endia` has every public class and function that package had and reads the same environment variables, so moving to it means changing the import from `eastindia_client` to `endia`.

Each library connects from the environment as `endia` does, with `EastIndiaClient.FromEnvironment()`, `EastIndiaClient.from_env()` or `EastIndiaClient.fromEnv()`. It uses `EASTINDIA_HOST` with the certificate files in `EASTINDIA_CERT_PATH` when they are set, then the context that `EASTINDIA_CONTEXT` names, then the current context in `~/.eastindia`. A program that runs where `endia version` works therefore needs no settings of its own.

None of the libraries reads Compose files. To launch a fleet, pass the project's resolved model, which `endia compose config --format json` prints. The library sends it with the build contexts and bind-mount sources, as `endia compose up` does.
