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

# CLI Quickstart

> Use the Crave CLI to scaffold, configure, and launch a storefront template.

The Crave CLI (`craveup`) bootstraps a production-ready storefront in a few minutes. It installs dependencies, wires environment variables, and can even start the dev server for you.

## Install & run

Run the CLI anywhere you want to create the project directory:

```bash theme={null}
npx craveup init
```

The wizard will guide you through:

* Choosing a template (`storefront-default`, Tomodachi Sushi, or Xichuan Noodles)
* Authorizing with the Crave dashboard to obtain an API key
* Naming the project directory
* Installing dependencies with your detected package manager
* Optionally starting `pnpm dev` so you can preview immediately

## Non-interactive usage

Prefer automation or CI pipelines? Use flags to skip prompts.

| Flag                 | Description                                                                      |
| -------------------- | -------------------------------------------------------------------------------- |
| `--template <id>`    | Force a template (`storefront-default`, `tomodachi-sushi`, or `xichuan-noodles`) |
| `--dir <name>`       | Set the target directory name                                                    |
| `--api-key <key>`    | Provide the API key up front                                                     |
| `--location-id <id>` | Provide the location ID for single-location templates                            |
| `--org-slug <slug>`  | Provide the organization slug for organization templates                         |
| `--skip-install`     | Scaffold files without running the package manager                               |
| `--force`            | Overwrite an empty directory without confirmation                                |

Example:

```bash theme={null}
npx craveup init \
  --template storefront-default \
  --dir crave-storefront \
  --api-key sk_live_123 \
  --org-slug my-restaurant-group \
  --skip-install
```

## Environment variables

The CLI creates `.env.local` with placeholders. Update them before running the app:

```env theme={null}
# Optional: override the API base URL (usually inferred from the API key).
# NEXT_PUBLIC_API_URL=https://api.craveup.com/api/v1
NEXT_PUBLIC_CRAVEUP_API_KEY=sk_live_xxx
NEXT_PUBLIC_LOCATION_ID=loc_abc123
```

> Tip: keep separate API keys per environment. The CLI respects `CRAVEUP_DASHBOARD_URL` and `CRAVEUP_PARTNER_API_URL` if you need to point at staging.

## Project anatomy

Every template ships with:

* **Next.js 15 + App Router** for modern server-first rendering
* **`@craveup/storefront-sdk`** preconfigured in `src/lib/storefront-client.ts`
* **Typed API helpers** co-located with app routes
* **Component library** for menu browsing, cart management, and checkout

Explore the generated repository after the CLI finishes:

```bash theme={null}
cd crave-storefront
pnpm install # if you skipped installation
pnpm dev --port 3000
```

You now have a fully functional storefront backed by live Crave data. Continue to the [Storefront SDK guide](./storefront-sdk) to integrate custom flows.
