Local Development Guide — PhotoSwipe Pro
The "Backend Not Configured" Error
If you see this error when clicking "Buy Now":
Setup Required: Demo mode: Backend not configured
This is expected in local development. Here's why and how to fix it:
Why This Happens
The checkout flow requires:
- LemonSqueezy store (payment processor)
- Backend API (to proxy requests securely)
- Environment variables (API keys, store IDs)
None of these exist in a fresh clone. You have 3 options:
Option 1: Mock Mode (Quick Demo)
Use this to: See the UI without setting up payments
The checkout page already shows pricing and UI. The error message is informative and links to setup docs. No changes needed for demo purposes.
What works:
- ✅ Browse
/checkoutpage - ✅ See pricing tiers
- ✅ View UI/UX
- ✅ Test navigation
What doesn't work:
- ❌ Actually purchasing
- ❌ Receiving license keys
Option 2: Local Backend (Full Development)
Use this to: Test complete purchase flow locally
Step 1: Set up LemonSqueezy Test Mode
- Create LemonSqueezy account (free): https://lemonsqueezy.com
- Go to Settings → API → Create API key
- Create test products (Site, Agency)
- Get test variant IDs
Step 2: Configure Environment
Create server/.env:
# LemonSqueezy Test Credentials
LEMON_SQUEEZY_API_KEY=test_your_key_here
LEMON_SQUEEZY_STORE_ID=12345
LEMON_SQUEEZY_VARIANT_ID_SITE=67890
LEMON_SQUEEZY_VARIANT_ID_AGENCY=67891
LEMON_SQUEEZY_PRODUCT_ID=your_product_id
# Local development
NODE_ENV=development
PORT=3001
ALLOWED_ORIGINS=http://localhost:3000
Step 3: Install and Start Backend
# Install dependencies
cd server
npm install
# Start backend
npm run dev
Backend runs on http://localhost:3001
Step 4: Configure Frontend Proxy
Add to demo-docs-website/docusaurus.config.js:
module.exports = {
// ... existing config
// Add proxy for local development
webpack: {
configure: (config) => {
config.devServer = {
...config.devServer,
proxy: {
'/api': {
target: 'http://localhost:3001',
changeOrigin: true,
},
},
};
return config;
},
},
};
Step 5: Start Docs Site
cd demo-docs-website
npm install
npm start
Site runs on http://localhost:3000
Step 6: Enable API Mode
Update demo-docs-website/src/pages/checkout.mdx:
- <CheckoutHandler>
+ <CheckoutHandler mode="api">
<PricingTable ctaText="Buy Now" highlightPopular />
</CheckoutHandler>
Step 7: Test
- Visit
http://localhost:3000/checkout - Click "Buy Now"
- Should redirect to LemonSqueezy test checkout
- Use test card:
4242 4242 4242 4242 - Complete purchase
- Verify email with license key
Option 3: Production Deployment
Use this to: Accept real payments
Follow the complete Deployment Guide:
- Set up production LemonSqueezy store
- Deploy backend to Vercel/Railway/Fly.io
- Set production environment variables
- Deploy docs site
- Update DNS
- Test with real purchase
Estimated time: 2-4 hours
Troubleshooting
"Failed to create checkout session"
Cause: Backend can't reach LemonSqueezy API
Fix:
- Check backend logs:
npm run dev(see errors) - Verify API key:
curl https://api.lemonsqueezy.com/v1/stores -H "Authorization: Bearer YOUR_KEY" - Check variant IDs exist in your LS store
"Network error" / "fetch failed"
Cause: Frontend can't reach backend
Fix:
- Verify backend is running:
curl http://localhost:3001/health - Check proxy configuration in
docusaurus.config.js - Check CORS headers in
server/index.js
"No checkout URL returned"
Cause: LemonSqueezy API returned success but no URL
Fix:
- Check backend response: Add
console.log(data)inserver/payment/router.js - Verify variant ID is correct for your store
- Check store is in "test mode" for development
Environment Variables Reference
Required for Checkout
LEMON_SQUEEZY_API_KEY= # From LS Settings → API
LEMON_SQUEEZY_STORE_ID= # From LS dashboard URL
LEMON_SQUEEZY_VARIANT_ID_SITE= # From product variant
LEMON_SQUEEZY_VARIANT_ID_AGENCY= # From product variant
Optional
LEMON_SQUEEZY_PRODUCT_ID= # For license validation
PORT=3001 # Backend port (default: 3001)
ALLOWED_ORIGINS=* # CORS origins (use specific domains in production)
NODE_ENV=development # Environment mode
Quick Start Commands
Full stack (backend + frontend):
# Terminal 1: Backend
cd server
npm install
npm run dev
# Terminal 2: Frontend
cd demo-docs-website
npm install
npm start
Backend only (test API):
cd server
npm install
npm run dev
# Test endpoints
curl http://localhost:3001/health
curl http://localhost:3001/api/payment/health
curl -X POST http://localhost:3001/api/payment/checkout \
-H "Content-Type: application/json" \
-d '{"productId":"site"}'
Next Steps
- For demo/development: Leave as-is (error message is informative)
- For local testing: Follow Option 2 (Local Backend)
- For production: Follow Deployment Guide
Still Stuck?
Check:
- Deployment Guide — Full production setup
- Environment Configuration — All env vars explained
- Architecture Overview — How everything fits together
Or create an issue on GitHub.