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

# Overview

> How Perpetra fits together, end to end

Perpetra is a perpetuals trading platform where every trade is matched off-chain for speed, then settled on-chain for security. Everything else in the architecture section is really just detail on top of this one idea.

## The big picture

```mermaid theme={null}
flowchart TD
    A[Trader signs\nan order] --> B[Off-chain matching\nfinds a counterparty]
    B --> C[Live checks:\nprice, slippage,\nrisk limits]
    C --> D[Settled on-chain]
    D --> E[Position opened,\nincreased, or closed]

    F[Price feeds] -.feeds live prices.-> C
    F -.feeds live prices.-> G
    H[Keeper bots] -.trigger.-> B
    H -.trigger.-> G[Ongoing position\nmonitoring]
    G -- Unhealthy --> I[Liquidation]
    G -- On schedule --> J[Funding payments\nbetween longs & shorts]

    E --> G
```

A trade's journey has two very different halves. Getting matched, checking prices, and validating limits all happen off-chain, fast and cheap, before anything touches the chain. Once a match is found and confirmed valid, settlement itself, and everything after it, happens on-chain, where it's secure and verifiable.

## What keeps running after a trade settles

A position doesn't just sit still once it's opened. In the background, on a schedule:

* **Funding payments** move between longs and shorts to keep Perpetra's price in line with the real market, see [Funding Rate](/funding-rate)
* **Position health** is continuously watched, and unhealthy positions get liquidated, see [Liquidation Engine](/liquidation-engine)
* **Fees** from trading and liquidations get collected and distributed, see [Fees](/fees)

None of this runs on its own. It's triggered by approved bots, see [Keeper System](/keeper-system), and depends on a steady feed of live prices, see [Mark Price & Index Price](/mark-price-and-index-price).

## Funds stay in one place

Deposits, withdrawals, and every internal balance movement, fees, liquidation payouts, funding, all flow through a single custody contract. See [Deposits & Withdrawals](/deposit-and-withdrawal).

## Every trade is authorized by you, and only you

Nothing moves without your signature. Every order is signed by your wallet before it's ever submitted, and that signature is verified before any trade is allowed to settle. See [Order Signing](/order-signing-eip712) and [Order Lifecycle](/order-lifecycle) for the full path an order takes from signature to settled position.

## For a piece-by-piece breakdown

See [Contract Map](/contract-map) for what each individual piece of the system is responsible for.
