# setup

Deploy your own instance of the YESNO terminal.

## Prerequisites

* Node.js 18+
* A Vercel account (free tier works)
* API keys (see [Environment Variables](broken://pages/665c0770c3cc05e0f41b5121b4ae64c30e8a506e))

## Quick Start

{% stepper %}
{% step %}

### Clone the Repository

```bash
git clone https://github.com/your-repo/yesno-terminal.git
cd yesno-terminal
```

{% endstep %}

{% step %}

### Install Dependencies

```bash
npm install
```

{% endstep %}

{% step %}

### Configure Environment Variables

Copy the example env file and fill in your keys:

```bash
cp .env.example .env.local
```

See [Environment Variables](broken://pages/665c0770c3cc05e0f41b5121b4ae64c30e8a506e) for every variable explained.

At minimum, you need:

* `OPENROUTER_API_KEY` (for AI analysis)
* `BRAVE_API_KEY` (for news search)
  {% endstep %}

{% step %}

### Run Locally

```bash
npx vercel dev
```

The terminal will be available at `http://localhost:3000`.
{% endstep %}

{% step %}

### Deploy to Vercel

```bash
npx vercel --prod
```

Or connect your GitHub repository to Vercel for automatic deployments on push.
{% endstep %}
{% endstepper %}

## Post-Deploy Configuration

### Set Up Cron (Agents)

The AI agents require a cron job. Vercel handles this automatically based on `vercel.json`:

```json
{
  "crons": [{
    "path": "/api/agents-run?key=YOUR_CRON_KEY",
    "schedule": "*/30 * * * *"
  }]
}
```

Set `AGENTS_CRON_KEY` in your Vercel environment variables to secure the endpoint.

### Configure Redis (Agents)

The agent system requires Upstash Redis for state persistence:

1. Create a free Upstash Redis database at [upstash.com](https://upstash.com/)
2. Copy your `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`
3. Add them to your Vercel environment variables

Without Redis, the agents panel will show default empty state but the rest of the terminal works fine.

### Set Up Domain

Point your domain to the Vercel deployment. The terminal is accessible at `/terminal` or `/` (both rewrite to `terminal.html`).

## File Structure

```
├── public/
│   ├── terminal.html    # Main terminal (6,900+ lines)
│   └── walkthrough.md   # User walkthrough
├── api/
│   ├── mcp.js           # MCP server
│   ├── agents-run.js    # Agent cron handler
│   ├── agents-state.js  # Agent state endpoint
│   ├── polymarket-analyze.js   # AI analysis
│   ├── polymarket-enriched.js  # Enriched signals
│   ├── polymarket-depth.js     # Order book
│   ├── polymarket-whales.js    # Whale trades
│   ├── polymarket-leaderboard.js  # Top traders
│   ├── polymarket-news.js      # News search
│   └── polymarket-holders.js   # Top holders
├── vercel.json          # Deployment config
└── package.json
```


---

# 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://yesno-1.gitbook.io/yesno-docs/self-hosting/setup.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.
