# Self Hosting

Hypercast runs on Cloudflare, so if you don't have an account, set one up first. You'll also need to install their CLI tool `wrangler` andl log in.

### Creating your instance

This is all the code it takes to run a simple instance:

```typescript
import { Operator } from 'hypercast/server'
export { Hypercast } from 'hypercast/server'
export default new Operator()
```

To deploy to Cloudflare, you'll also need a `wrangler.toml` config file.

```toml
name = "my-hypercast"
main = "src/index.ts"

account_id = 'abcdefg1234567'
compatibility_date = "2022-12-03"

[durable_objects]
  bindings = [
    { name = "hypercasts", class_name = "Hypercast" }
  ]

[[migrations]]
  tag = "init_hypercast"
  new_classes = ["Hypercast"]
```

With that, simply run `wrangler publish`.

### Connecting to your instance

To connect a Hypercast client to your server instance, we'll need it's URL.

```typescript
import { Operator, Hypercast } from 'hypercast/client'

const operator = new Operator('https://my-hypercast.org.workers.dev')

// or

const hypercast = new Hypercast(topic, 'https://my-hypercast.org.workers.dev')
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://front-of-house.gitbook.io/hypercast/self-hosting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
