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

# Hyrex: The Durable Task Queue for Product Engineers

> Durable tasks made simple

<div className="overview-hero" style={{ display: 'flex', alignItems: 'flex-start', gap: '2rem' }}>
  <div className="overview-hero-text" style={{ flex: 1 }}>
    <h2>What is Hyrex?</h2>
    <p>Hyrex is a task orchestration framework that uses PostgreSQL (or Hyrex Cloud) as a durable task queue. Define tasks in Python or TypeScript, send them to be processed asynchronously, and let Hyrex handle the rest.</p>
    <p>Get started with our <a href="../reference/python/quickstart">Python SDK</a> or <a href="../reference/typescript/quickstart">TypeScript SDK</a>.</p>
  </div>

  <img className="rounded-xl overview-hero-image" style={{ width: '200px', height: '200px', flexShrink: 0 }} src="https://hyrex.io/logo.png" alt="Hyrex Mascot" />
</div>

## Get Started

<CardGroup cols={2}>
  <Card title="Python Quick Start" href="/reference/python/quickstart" icon="python">
    Get started with Python SDK
  </Card>

  <Card title="TypeScript Quick Start" href="/reference/typescript/quickstart" icon="js">
    Get started with TypeScript SDK
  </Card>

  <Card title="Examples" href="/examples/common-patterns" icon="code">
    Real-world patterns and use cases
  </Card>

  <Card title="Deploy to Production" href="/examples/production-guide" icon="server">
    Production deployment guide
  </Card>
</CardGroup>

## COLD Properties

<CardGroup cols={2}>
  <Card title="Controllable" icon="square-1">
    You control when, where, and how your tasks run.
  </Card>

  <Card title="Observable" icon="square-2">
    You get logging by tasks, metrics/performance data, and a beautiful open-source UI.
  </Card>

  <Card title="Large Scale" icon="square-3">
    Your workloads become fully-horizontally scalable across any cloud setup.
  </Card>

  <Card title="Durable" icon="square-4">
    You get a distributed, fault-tolerant cluster of workers that monitor one another
    and self-heal.
  </Card>
</CardGroup>

## How It Works

```mermaid theme={null}
%%{init: {'theme':'neutral', 'themeVariables': {'primaryColor':'#ff6b6b','primaryTextColor':'#fff','primaryBorderColor':'#cc5500','lineColor':'#5c7cfa','secondaryColor':'#ffd43b','tertiaryColor':'#74c0fc','background':'#f8f9fa','mainBkg':'#e9ecef','secondBkg':'#dee2e6','tertiaryBkg':'#ced4da','textColor':'#495057','borderColor':'#adb5bd','fontFamily':'ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif'}}}%%
flowchart LR
    %% Producers
    subgraph "Your Application"
        app1[API Server]
        app2[Web App]
        app3[Cron Jobs]
    end

    %% Task Storage
    subgraph "Durable Task Queue"
        db[(PostgreSQL<br/>or<br/>Hyrex Cloud)]
    end

    %% Workers
    subgraph "Worker Fleet"
        w1[Worker 1]
        w2[Worker 2]
        w3[Worker N...]
    end

    %% Flow
    app1 -->|"send()"| db
    app2 -->|"send()"| db
    app3 -->|"send()"| db
    db -->|"poll & execute"| w1
    db -->|"poll & execute"| w2
    db -->|"poll & execute"| w3
```

### Three Simple Steps:

1. **Define** - Create tasks with the `@hy.task` decorator (Python) or `hy.task()` method (TypeScript)
2. **Send** - Queue tasks asynchronously with `.send()` from anywhere in your application
3. **Process** - Workers automatically pull and execute tasks with built-in retries and monitoring

No message brokers, no complex infrastructure - just your database and your code.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from hyrex import HyrexRegistry

    hy = HyrexRegistry()

    @hy.task
    def send_email(to: str, subject: str):
        # Your email logic here
        print(f"Sending email to {to}: {subject}")
        return {"sent": True}

    # Send task asynchronously
    send_email.send(
        to="user@example.com",
        subject="Welcome to Hyrex!"
    )
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    import { HyrexRegistry } from '@hyrex/hyrex';

    const hy = new HyrexRegistry();

    const sendEmail = hy.task({
        name: 'sendEmail',
        func: async ({ to, subject }: { to: string; subject: string }) => {
            // Your email logic here
            console.log(`Sending email to ${to}: ${subject}`);
            return { sent: true };
        }
    });

    // Send task asynchronously
    sendEmail.send({
        to: "user@example.com",
        subject: "Welcome to Hyrex!"
    });
    ```
  </Tab>
</Tabs>

## Why Hyrex?

* **No new infrastructure** - Use your existing PostgreSQL or our managed cloud
* **Type-safe** - Automatic type-checking to ensure data integrity
* **Open-source** - Built on proven PostgreSQL reliability
* **Observable** - Built-in monitoring with Hyrex Studio
* **Scalable** - From single worker to thousands

Ready to build? Choose your language above to get started in 5 minutes!
