## Deploy to Vercel

The recommended way to deploy your storefront is with [Vercel](https://vercel.com).

### One-Click Deploy

Use the deploy button in the [storefront repository](https://github.com/yournextstore/yournextstore) to deploy directly from GitHub.

### CLI Deploy

```bash
npx vercel --prod
```

Set your environment variables in the Vercel dashboard:

1. Go to your project **Settings > Environment Variables**
2. Add `YNS_API_KEY` with your production API key
3. Redeploy

### Git Integration

Connect your GitHub repository to Vercel for automatic deployments on every push:

1. Import your repo at [vercel.com/new](https://vercel.com/new)
2. Add `YNS_API_KEY` during setup
3. Deploy

Every push to `main` triggers a production deployment. Pull requests get preview deployments automatically.

## Custom Domain

In your Vercel project settings:

1. Go to **Settings > Domains**
2. Add your custom domain
3. Update your DNS records as instructed

## Environment Variables

For production, set these in your hosting platform:

| Variable | Value |
|----------|-------|
| `YNS_API_KEY` | Your production API key (`sk-...`) |

## Other Platforms

The storefront is a standard Next.js application. It can be deployed to any platform that supports Next.js:

- **Netlify** – use the Next.js adapter
- **AWS Amplify** – supports Next.js natively
- **Self-hosted** – run `npm run build && npm start`

### Docker

```dockerfile
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:22-alpine AS runner
WORKDIR /app
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./

EXPOSE 3000
CMD ["npm", "start"]
```