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

# SDK

> Import cart, data loaders, analytics, and consent into a Replo site's code.

`@replohq/sdk` is the package a Replo site imports to load store data, run a cart, emit analytics, and inject tracking scripts. Every Replo site is a Next.js app, and the SDK is what connects that app to your store.

You need it when you are editing site code directly, either by [cloning the site's repository](https://docs.replo.app/git/overview.md) or by pointing a coding agent at it. If you only build through chat, Replo writes these imports for you and you never touch the package.

## Every import is a subpath

The SDK has no root export. Import from the specific module instead:

```ts theme={null}
import { ProductLoader } from "@replohq/sdk/loaders/product-loader";
import { useCart } from "@replohq/sdk/cart/cart-provider";
```

This does not work and fails at build time:

```ts theme={null}
import { ProductLoader } from "@replohq/sdk";
```

Only the subpaths listed in this reference resolve. Anything else fails the build with `ERR_PACKAGE_PATH_NOT_EXPORTED`, including a path that points at a real source file but is not part of the published surface. When you are unsure, check the [reference](https://docs.replo.app/sdk/reference/setup.md) rather than guessing from the repository layout.

Do not add a file extension. `@replohq/sdk/loaders/product-loader` is correct; `@replohq/sdk/loaders/product-loader.tsx` is not.

## What is in it

> [card] [Setup](https://docs.replo.app/sdk/reference/setup.md)
>
> `ReploProvider`, `siteConfig`, and the Next.js glue every site mounts once.

> [card] [Data loaders](https://docs.replo.app/sdk/reference/loaders.md)
>
> Products, collections, reviews, loyalty, and recommendations.

> [card] [Cart](https://docs.replo.app/sdk/reference/cart.md)
>
> Add to cart, buy now, discount codes, and cart state.

> [card] [Consent and scripts](https://docs.replo.app/sdk/reference/consent.md)
>
> Inject tracking scripts and gate them on visitor consent.

Also covered: [analytics](https://docs.replo.app/sdk/reference/analytics.md) events, [routing](https://docs.replo.app/sdk/reference/routing.md) for redirects and locales, and [content, money, and orders](https://docs.replo.app/sdk/reference/content-and-money.md).

## Next steps

> [card] [Install and upgrade](https://docs.replo.app/sdk/install.md)
>
> How the SDK reaches your site, and how versions move.

> [card] [Clone your site](https://docs.replo.app/git/overview.md)
>
> Get the repository on your machine to start editing.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.