> For the complete documentation index, see [llms.txt](https://txnlab.gitbook.io/haystack-router/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-router/readme.md).

# Haystack Router

Advanced protocol for better DeFi

The Haystack order-router is an exchange infrastructure for best-in-class DeFi trading. It leverages Algorand's renowned efficiency by optimizing and combining liquidity of multiple DEXs and LST protocols. Additionally it can leverage peer-to-peer liquidity and function as a building block for order book and RFQ systems.

The Haystack protocol is implemented as a fully composable, on-chain trading protocol based on a permissionless architecture. Everybody can use it to get better swaps. Platform integrators can use our SDK to get started quickly.

The core functionality consists of planning and executing **slippage-optimized market orders**. It guarantees equal or better trades than single DEX orders by finding the best routes and liquidity. Usage is simply a matter of (1) requesting a swap plan and (2) executing this plan atomically through its smart contracts.

This functionality is provided by the following components:

* [**Order-Routing API:**](/haystack-router/developers/api-order-router.md) Find the best swap plan for any trading pair
* [**Order-Router Protocol:**](/haystack-router/order-router-protocol/introduction.md) Place optimized **market-orders** securely on-chain

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

{% hint style="info" %}
Need help? Join the [Haystack discord](https://discord.gg/tE8TnWvucm) and look for the haystack-router channel.
{% endhint %}
