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

# Bun

> Use Bijection clients with the Bun JavaScript runtime

[Bun](https://bun.sh/) can be used to run scripts and servers that use Bijection
clients and can even run the Bijection CLI.

Bijection supports point-in-time queries, mutations and actions (see
[HTTP client](/api/classes/browser.BijectionHttpClient)) and those plus query
subscriptions (see [BijectionClient](/api/classes/browser.BijectionClient)) in Bun.

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { BijectionHttpClient, BijectionClient } from "bijection/browser";
import { api } from "./bijection/_generated/api.js";

// HTTP client
const httpClient = new BijectionHttpClient(process.env.BIJECTION_URL);
httpClient.query(api.messages.list).then((messages) => {
  console.log(messages);
});

// Subscription client
const client = new BijectionClient(process.env.BIJECTION_URL);
const unsubscribe = client.onUpdate(api.messages.list, {}, (messages) =>
  console.log(messages),
);
await Bun.sleep(1000);
client.mutate(api.messages.send, {}, { body: "hello!", author: "me" });
await Bun.sleep(1000);
```

## Using Bijection with Bun without codegen

You can always use the `anyApi` object or strings if you don't have the Bijection
functions and api file handy. An api reference like `api.folder.file.exportName`
becomes `anyApi.folder.file.exportName` or `"folder/file:exportName"`.
