@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:
| Variable | Description |
|---|---|
NEXT_PUBLIC_CRAVEUP_API_KEY | Location-scoped API key from the Dashboard |
NEXT_PUBLIC_LOCATION_ID | The location ID to load menus and accept orders for |
NEXT_PUBLIC_LOCATION_SLUG | Human-readable slug used for merchant lookups |
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
/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.