Quickstart
This guide walks you through creating a basic Fanfare integration with React. By the end, you will have a working queue experience that customers can join.Prerequisites
Before you start, ensure you have:- Node.js 18 or later
- A Fanfare account with API credentials
- An experience created in your Fanfare dashboard
Step 1: Install the SDK
Install the React SDK and its peer dependencies:motion library powers the SDK’s animations. If you prefer not to use animations, you can still install it as the SDK handles cases where motion is disabled.
Step 2: Configure the Provider
Wrap your application withFanfareProvider and pass your credentials:
org_abc123 and pk_live_xyz789 with your actual credentials from the Fanfare dashboard.
The provider handles:
- SDK initialization
- Session restoration on page refresh
- Automatic reconnection after network interruptions
- Multi-tab synchronization
Step 3: Create a Queue Experience
Use theuseExperienceJourney hook to manage the customer’s journey through your experience:
Step 4: Use Pre-built Widgets (Optional)
Instead of building the UI yourself, use the pre-builtQueueWidget component:
Step 5: Test Locally
Start your development server and visit your product page. Click the button to join the queue. To test the full flow locally:- Open your browser’s developer tools
- Go to the Network tab
- Watch for requests to
api.fanfare.io - You should see session creation and queue entry requests
Complete Example
Here is a complete example combining all the pieces:What Happens Behind the Scenes
When a customer clicks to join the queue:- Session Creation: The SDK creates a consumer session (guest or authenticated)
- Experience Entry: The consumer enters the experience
- Sequence Routing: Fanfare determines which sequence the consumer belongs to
- Distribution Entry: The consumer joins the active queue distribution
- Position Updates: The SDK polls for position changes
- Admission: When admitted, the SDK receives an admission token
- Checkout: Your frontend redirects to checkout with the token
Troubleshooting
”organizationId is required” Error
Ensure you pass valid credentials toFanfareProvider. Check that:
- The
organizationIdstarts withorg_ - The
publishableKeystarts withpk_ - You are using your production or test credentials correctly
Queue Not Loading
Check that:- Your experience ID is correct and active
- The experience has an active queue distribution
- Your browser is not blocking requests to
api.fanfare.io
Consumer Not Admitted
Queue admission depends on your configuration in the Fanfare dashboard:- Check the admission rate setting
- Verify the queue is not paused
- Ensure there is available capacity
Next Steps
Now that you have a working integration:- Installation - Explore installation options for other frameworks
- Configuration - Learn about provider options
- First Experience - Create queues, draws, and auctions
- Testing - Set up local testing with mocks