Storefront - Getting Started
Learn how to set up and deploy your Ecomplify storefront on Cloudflare.
Overview
The Ecomplify Storefront is a modern, fast, and SEO-optimized online store built with React Router 7 and designed to run on Cloudflare Pages. It provides a seamless shopping experience for your customers.
Technology Stack
The storefront is built with:
- React Router 7 - Modern routing and server-side rendering
- TypeScript - Type-safe development
- Cloudflare Pages - Global CDN and hosting
- Cloudflare Workers - Serverless backend functions
Prerequisites
Before you begin, make sure you have:
- A Cloudflare account (free tier available)
- Node.js 18 or higher installed
- npm or pnpm package manager
- Git installed (for deployment)
Local Development Setup
1. Clone the Repository
git clone https://github.com/your-org/ecomplify-storefront.git
cd ecomplify-storefront
2. Install Dependencies
npm install
# or
pnpm install
3. Configure Environment Variables
Create a .env file in the project root:
# API Configuration
VITE_API_URL=https://api.ecomplify.com
# Store Configuration
VITE_STORE_ID=your-store-id
VITE_STORE_NAME=Your Store Name
4. Start Development Server
npm run dev
Your storefront will be available at http://localhost:5173
Deploying to Cloudflare Pages
Option 1: Deploy via Cloudflare Dashboard (Recommended)
-
Connect Your Git Repository
- Log in to your Cloudflare Dashboard
- Go to Pages > Create a project
- Connect your GitHub/GitLab account
- Select your storefront repository
-
Configure Build Settings
Build command: npm run build
Build output directory: dist
Root directory: / -
Set Environment Variables
- Add the same environment variables from your
.envfile - Click Save and Deploy
- Add the same environment variables from your
-
Deploy
- Cloudflare will automatically build and deploy your site
- Your site will be live at
your-project.pages.dev
Option 2: Deploy via Wrangler CLI
-
Install Wrangler
npm install -g wrangler -
Login to Cloudflare
wrangler login -
Build Your Project
npm run build -
Deploy
wrangler pages deploy dist
Custom Domain Setup
To use your own domain:
- Go to your Pages project in Cloudflare Dashboard
- Click Custom domains
- Click Set up a custom domain
- Enter your domain (e.g.,
shop.yourdomain.com) - Follow the DNS configuration instructions
- Wait for SSL certificate provisioning (usually takes a few minutes)
Storefront Features
Product Catalog
- Browse products by category
- Search functionality
- Product filtering and sorting
- Product detail pages with images and descriptions
Shopping Cart
- Add/remove items
- Update quantities
- Cart persistence across sessions
- Real-time price calculations
Checkout Process
- Guest and registered user checkout
- Multiple payment methods
- Shipping address management
- Order confirmation
Customer Account
- Order history
- Address book
- Wishlist
- Account settings
Customization
Styling
The storefront uses CSS modules and supports theming. To customize:
- Edit theme variables in
src/styles/theme.css - Modify component styles in their respective CSS modules
- Update the primary color to match your brand (#451991 by default)
Content
Update content in:
src/content/- Static content and copysrc/config/- Site configurationpublic/- Images and static assets
Performance Optimization
The storefront is optimized for performance:
- Edge Rendering - Pages rendered at Cloudflare's edge
- Asset Optimization - Automatic image and code optimization
- Caching - Smart caching strategies for fast page loads
- Code Splitting - Only load code needed for each page
Monitoring and Analytics
Track your storefront's performance:
- Enable Cloudflare Web Analytics in your Pages project
- View metrics in the Cloudflare Dashboard:
- Page views
- Unique visitors
- Performance metrics
- Geographic distribution
Troubleshooting
Build Failures
- Check build logs in Cloudflare Dashboard
- Verify all environment variables are set
- Ensure dependencies are correctly installed
API Connection Issues
- Verify API URL is correct
- Check CORS settings
- Ensure API keys are valid
Next Steps
Explore more about your storefront:
- Customization - Make the storefront match your brand identity
- Payment Methods - Set up and configure payment processing
- SEO Optimization - Improve search rankings and visibility
- Advanced Features - Unlock more capabilities as you grow
More detailed guides coming soon!
Support
Need help with deployment?
- Check Cloudflare Pages Documentation
- Visit the Ecomplify Community
- Contact support through your dashboard