Skip to main content
Build a fully functional ordering storefront using Next.js 15 (App Router) and @craveup/storefront-sdk. By the end of this guide you will fetch menus, display products, and add items to a cart.

Prerequisites

  • Node.js 18+ and a package manager (pnpm, npm, or yarn)
  • A Crave API key from the Dashboard
  • At least one live location in your merchant account

1. Create a Next.js project

2. Install the SDK

3. Set environment variables

Create a .env.local file in the root of your project with the following variables:
VariableDescription
NEXT_PUBLIC_CRAVEUP_API_KEYLocation-scoped API key from the Dashboard
NEXT_PUBLIC_LOCATION_IDThe location ID to load menus and accept orders for
NEXT_PUBLIC_LOCATION_SLUGHuman-readable slug used for merchant lookups
Use different API keys per environment (development, staging, production). The SDK reads NEXT_PUBLIC_CRAVEUP_API_KEY by default.

4. Create the storefront client

Create a shared client instance that every server and client component can import.

5. Fetch merchant data (Server Component)

Use a React Server Component to load the merchant and its locations at request time.

6. Start an ordering session and display the cart

Create a Client Component that starts a session and lets users add items.

7. Run the dev server

Open http://localhost:3000 to see your merchant info, and navigate to /order to test the cart.

Next steps

Display Menu

Fetch menus, categories, and products for a location.

Manage Cart

Add, update, and remove items with modifiers.

Checkout Flow

Collect customer details and process payments.

SDK Reference

Full SDK documentation with all available modules.

Slack Community

Ask questions and get help from the Crave team and community.

Discord

Join our Discord server for real-time discussions.

Email Support

Reach out to hello@craveup.com for direct support.