> For the complete documentation index, see [llms.txt](https://txnlab.gitbook.io/haystack-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://txnlab.gitbook.io/haystack-dev/haystack-router/introduction.md).

# Introduction

Best-route market swaps for Algorand assets

Haystack Order Router is a protocol for on-chain market swaps of Algorand assets. The protocol provides best route discovery between any token pair that has liquidity in the Algorand ecosystem.

It plans and executes **slippage-optimized market orders**, combining the liquidity of multiple DEXs and liquid-staking protocols. Each route is compared against swapping on each pool directly, and it splits and hops only when that delivers more. Using it takes two steps:

1. Request a quote from the [Swap API](/haystack-dev/haystack-router/api-order-router.md).
2. Execute it atomically through the [Order Router App](/haystack-dev/haystack-router/architecture/order-router-app-v4.md).

The [TypeScript SDK](/haystack-dev/haystack-router/sdk.md) does both. The router is permissionless and fully composable: anyone can swap through it.

{% hint style="warning" %}
The router is for executing swaps, not for looking up prices. A quote searches every pool for one exact trade, which is slow. For prices, use the [Haystack API](/haystack-dev/haystack-api/assets.md#prices). See [Prices: use the Haystack API](/haystack-dev/haystack-router/api-order-router.md#prices-use-the-haystack-api).
{% endhint %}

The Haystack Router was formerly known as Deflex, originally developed by [Defly](https://defly.app/) and [Alammex](https://www.alammex.com/).

## Key Features

* **Smart Order Routing:** Haystack Order Router connects the AMM pools of every DEX it aggregates, together with liquid-staking and lending markets, and searches direct and atomic multi-hop routes between any two tokens in the Algorand ecosystem.
* **Automatic Liquidity Discovery:** The number of tokens and liquidity pools increases daily. The Haystack Order Router picks up new pools on the DEXes it aggregates automatically, as soon as they have meaningful liquidity.
* **Composability:** The Router is fully composable. Composability means developers can combine their own protocols with Haystacks protocol to build powerful and flexible systems.
* **Fixed-Output Support:** Haystack Order Router protocol is able to support fixed-output swaps (where excess from the swap is accumulated/redeemed in the input asset) for all composable DEX protocols, even if they do not support fixed-output themselves (eg. Pact).
* **Aggregated Slippage Check:** Haystack Order Router protocol performs a single slippage check on the final output asset, regardless of how many swaps are performed. This prevents a single swap from failing the entire transaction group even if it does not impact the final slippage check (resulting in higher swap success rate).
* **Atomic**: A swap executes in a single transaction group. If the output is below your minimum, the whole group fails and nothing moves.
* **Transparent**: The Haystack Order Router quote includes all protocol fees (including Haystack Order Router App fees). What you see is what you get!
