This project is built with:
- Next.js
- Tailwind CSS
- Yarn package manager
Run the following command in your project root:
yarn-
Locate the
template.env.localfile in the project root -
Rename it to
.env.local -
Configure the following environment variables:
-
Rename file
template.env.localto.env.localat the root of the project. -
Replace the
FLUID_API_TOKEN's value with your api token found in the developer settings. -
Specify where the Fluid API is with
FLUID_BASE_URL(no trailing slash/).
# Your Fluid API token from developer settings
FLUID_API_TOKEN=your_api_token_here
# Fluid API base URL (leave trailing slash)
FLUID_BASE_URL=https://yourco.fluid.appRun the development server:
yarn devYour application will be available at http://localhost:3000
You can customize this project by:
- Following Next.js conventions for page routing and components
- Using Tailwind CSS utility classes for styling
- Modifying the configuration files for both Next.js and Tailwind CSS
- Navigate to the
shopdirectory - Create a new directory named with your product's ID (e.g.,
80) - Any product with this ID will use this custom page instead of the default dynamic product page
Example structure:
src/app/[affiliateSlug]/shop/
├── [productSlug]/ # Default dynamic product pages
└── 80/ # Custom page for product ID 80
This routing is handled by Next.js - [see Next.js routing documentation for more details]
Export a generateMetadata function from your page.tsx file:
export async function generateMetadata(): Promise<Metadata> {
return {
title: "Your Product Title",
description: "Product description",
// Add other metadata properties
};
}Add the following data attributes to your product elements:
<button data-fluid-product="[product-id]" data-fluid-variant="[variant-id]">
Add to Cart
</button>Reference implementation can be found in shop/ProductPage.tsx
To enable subscription options:
<div data-fluid-checkout-group>
<input type="radio" name="data-fluid-checkout-subscribe" value="subscription"
<!-- or "regular" for one-time purchase -->
checked />
</div>- Use Fluid's APIs to fetch product and variant data
- Design your checkout pages
- Implement cart functionality using the data attributes described above
- Add checkout flow according to your needs
The Fluid widget is configured in layout.tsx:
window.fcs = {
api_url_host: "${config.apiHost}",
affiliate: {
credit: "${affiliateSlug}", // Unique identifier
email: "rep@example.com", // Optional: Rep's email
external_id: "REP123", // Optional: External system ID
},
};To attribute sales to specific reps:
- Base URL format:
https://yourdomain.com/[REP_SLUG] - Replace
[REP_SLUG]with the rep's unique identifier - Ex for shop page:
https://yourdomain.com/[REP_SLUG/shop
Once attributation has been set, the visitor can navigate to any page and the attribution will follow via fingerprinting and / or cookies.
- A country/language selector is available in the top-right corner
- Default language is English
- Custom translations must be implemented manually
- Implement your own translation system for additional languages
