Overview
This guide will help you build a basic restaurant storefront using the Crave API. You’ll have a working menu and cart system in under 30 minutes.Prerequisites
- Node.js 18+ and npm/yarn
- Next.js project (or create one with
npx create-next-app@latest
) - Paid Crave subscription (required for API access)
- API key (see below for how to obtain)
Step 1: Get Your API Key
Option 1: Developer Dashboard
Visit dashboard.craveup.com/developers to generate your API key:- Sign up or log in to your Crave developer account
- Navigate to the API Keys section
- Click “Create New API Key”
- Name your key (e.g., “My Storefront API Key”)
- Copy your API key - Store it securely (you won’t see it again)
- Note your Location ID - This will be provided in your dashboard
Option 2: Request from Merchant
If you’re building for a specific merchant, contact them directly to obtain your API key and location ID.Option 3: Generate via API (Enterprise Only)
Admin APIs unlock powerful automation capabilities for large-scale operations. If you’re building multi-tenant platforms, managing hundreds of locations, creating white-label solutions, or need programmatic control over merchant settings, admin API access can streamline your operations significantly. Key Benefits of Admin API Access:- Automated onboarding of new merchants and locations
- Bulk management of menus, pricing, and inventory across multiple locations
- Dynamic API key generation for client applications
- Real-time sync with your existing restaurant management systems
- Custom analytics and reporting across your entire merchant network
- Contact support at hello@craveup.com for beta access request
- Provide your use case and Enterprise tier details
- Receive admin API documentation and authentication tokens
- Generate keys programmatically:
Note: This option requires Enterprise tier subscription and beta access approval.
Step 2: Environment Setup
Create a.env.local
file in your project root:
Test Environment
For development and testing, you can use these test values:Note: The test environment uses the production API with a test location and API key provided for development purposes.
Step 3: Install Dependencies
Step 4: Create API Client
Createlib/api-client.js
:
Step 5: Create Menu Component
Createcomponents/Menu.js
:
Step 6: Create Cart Component
Createcomponents/Cart.js
:
Step 7: Create Main Page
Updatepages/index.js
:
Step 8: Add Basic Styling
Createstyles/globals.css
:
Step 9: Test Your Storefront
- Start your development server:
- Open http://localhost:3000
- Verify that:
- Menu loads correctly
- You can add items to cart
- Cart updates properly
- No console errors
Next Steps
Now that you have a basic storefront:- Add Payments: Follow the Stripe Integration Guide
- Improve UI: Add better styling and components
- Add Features: Customer info, order scheduling, etc.
- Error Handling: Add proper error boundaries
- Performance: Add loading states and caching
Common Issues
- Menu not loading: Check your API key and location ID
- CORS errors: Make sure you’re using server-side API calls
- Rate limiting: Implement proper caching to avoid hitting limits