> ## 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](/git/get-started) 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](/sdk/reference/setup) 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

<CardGroup cols={2}>
  <Card title="Setup" icon="plug" href="/sdk/reference/setup">
    `ReploProvider`, `siteConfig`, and the Next.js glue every site mounts once.
  </Card>

  <Card title="Data loaders" icon="database" href="/sdk/reference/loaders">
    Products, collections, reviews, loyalty, and recommendations.
  </Card>

  <Card title="Cart" icon="cart-shopping" href="/sdk/reference/cart">
    Add to cart, buy now, discount codes, and cart state.
  </Card>

  <Card title="Consent and scripts" icon="shield-check" href="/sdk/reference/consent">
    Inject tracking scripts and gate them on visitor consent.
  </Card>
</CardGroup>

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

## Working alongside the rest of the monorepo

A published site only has the SDK and its npm dependencies installed. Import types and values from `@replohq/sdk` and never from Replo's internal packages, even when your editor offers them as a completion. An import from an internal package type-checks locally and then fails once the site builds on its own.

<Note>
  A few types cross an internal boundary and can appear widened in editor tooltips. Where that happens, the SDK re-exports its own version of the type, such as `FullProduct` from `@replohq/sdk/loaders/loader-schemas`. Prefer those.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Install and upgrade" icon="download" href="/sdk/install">
    How the SDK reaches your site, and how versions move.
  </Card>

  <Card title="Clone your site" icon="code-branch" href="/git/get-started">
    Get the repository on your machine to start editing.
  </Card>
</CardGroup>
