## Clone the Template

Use `create-next-app` to clone the storefront:

```bash
npx create-next-app@latest my-store --example https://github.com/yournextstore/yournextstore
```

Or clone directly:

```bash
git clone https://github.com/yournextstore/yournextstore.git my-store
cd my-store
```

## Install Dependencies

```bash
npm install
# or
pnpm install
# or
bun install
```

## Environment Variables

Create a `.env.local` file in the project root:

```bash
YNS_API_KEY=sk-your-api-key-here
```

Get your API key from the [YNS dashboard](https://yns.store/manage) under **Settings → API → API keys**.

### Staging vs Production

- **Production keys** (`sk-...`) connect to `yns.store`
- **Staging keys** (`sk-s-...`) connect to `yns.cx` (sandbox)

The Commerce SDK automatically detects which environment to use based on the key prefix.

## Run Development Server

```bash
npm run dev
```

The store will be available at [localhost:3000](http://localhost:3000).

## Verify Setup

You should see your store's products on the homepage. If you see an error, check that:

1. Your `YNS_API_KEY` is set correctly in `.env.local`
2. Your store has at least one published product
3. Your Stripe account is connected in the YNS dashboard