edge-commerce
FreeNo executable scriptsNot checkedReduce latency globally by running geo-routing, A/B tests, and personalization logic at the network edge using Cloudflare Workers or Vercel
by finsilabs★ 69 GitHub starsAbout this skill
Edge Commerce
Overview
Edge computing executes code in the CDN PoP closest to each user, reducing latency from hundreds of milliseconds (round-trip to a central origin) to under 50ms. For e-commerce, this enables geo-routing (redirect UK users to a UK storefront), edge-side personalization (inject user tier into cached pages), instant A/B testing without origin round-trips, and distributed inventory caching via edge KV stores.
When to Use This Skill
- When pages routed through a central origin have high TTFB (>300ms) for international users
- When you need to redirect users to region-specific storefronts or localized product catalogs
- When you want to run A/B tests without adding JavaScript that delays page rendering
- When building a multi-region deployment where each region needs its own origin but shares a single domain
Core Instructions
Step 1: Determine your platform and what edge computing can do for you
| Platform | Edge Capabilities | How to Use Them |
|---|---|---|
| Shopify | Shopify's CDN (Fastly) already serves stores from global edge locations | Use Shopify Markets for geo-routing and multi-currency without custom edge code; Markets handles currency, language, and domain routing natively |
| WooCommerce | Add Cloudflare as your CDN/proxy to get edge capabilities | Cloudflare Workers (free tier: 100k requests/day) adds edge logic; configure in Cloudflare dashboard after adding your domain |
| BigCommerce | BigCommerce uses Fastly CDN globally | Use BigCommerce's built-in multi-storefront feature for geo-routing; for custom edge logic add Cloudflare in front |
| Custom / Headless | Full control — choose Cloudflare Workers, Vercel Edge Middleware, or Fastly Compute | Build custom geo-routing, A/B testing, and personalization at the edge; see implementation below |
Step 2: Configure geo-routing on your platform
Shopify: Use Shopify Markets
- Go to Settings → Markets in your Shopify admin
- Click Add market and select the countries/regions for your new market
- Configure per-market settings:
- Currency: set the local currency (Shopify handles conversion automatically)
- Language: assign a translated theme version
- Domain/subdomain: e.g.,
uk.yourstore.comroutes UK visitors automatically
- Shopify automatically redirects users to their market based on IP geolocation — no custom code needed
- For manual market URL overrides: Shopify's cookie-based market selector handles users who want to change their market
WooCommerce: Cloudflare Workers geo-routing
- Add your domain to Cloudflare (free plan is sufficient for geo-routing)
- Go to Workers & Pages → Create Worker in the Cloudflare dashboard
- Add a simple geo-redirect rule:
// Cloudflare Worker — deploy via Cloudflare dashboard
export default {
async fetch(request) {
const country = request.headers.get('CF-IPCountry') ?? 'US';
const url = new URL(request.url);
// Redirect UK users to UK store variant
if (country === 'GB' && !url.pathname.startsWith('/uk')) {
return Response.redirect(`https://${url.hostname}/uk${url.pathname}`, 302);
}
return fetch(request);
}
};
- In Worker settings, add a Route that matches your domain:
*yourstore.com/* - For currency/language: use a WooCommerce multi-currency plugin (WPML + WooCommerce Multilingual, or Aelia Currency Switcher) that reads the URL path or a cookie set by the Worker
Custom / Headless
Vercel Edge Middleware (Next.js) for geo-routing:
// middleware.ts — runs at the edge globally, <5ms
import { NextRequest, NextResponse } from 'next/server';
import { geolocation } from '@vercel/functions';
const REGION_MAP: Record<string, string> = {
GB: 'uk', DE: 'de', FR: 'fr', CA: 'ca', AU: 'au',
};
export function middleware(request: NextRequest) {
const { country } = geolocation(request);
const region = country ? REGION_MAP[country] : null;
// Redirect root to regional store
if (region && request.nextUrl.pathname === '/') {
const url = request.nextUrl.clone();
url.pathname = `/${region}`;
return NextResponse.redirect(url, { status: 302 });
}
// Pass country to origin for catalog/pricing logic
const response = NextResponse.next();
if (country) response.headers.set('x-user-country', country);
return response;
}
export const config = { matcher: ['/', '/products/:path*', '/collections/:path*'] };
Edge A/B testing (assign variant once, persist in cookie):
// In middleware.ts — no origin round-trip needed
const EXPERIMENTS = [
{ id: 'checkout-cta', buckets: [{ name: 'control', weight: 0.5 }, { name: 'variant-a', weight: 0.5 }] },
];
function assignVariant(buckets: Array<{name: string; weight: number}>) {
let r = Math.random(), cumulative = 0;
for (const b of buckets) {
cumulative += b.weight;
if (r < cumulative)
Install edge-commerce in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
claude-codecursorgemini-clicopilotcodex-clikiroopencodeBundled files
FAQ
What does the edge-commerce skill do?
Reduce latency globally by running geo-routing, A/B tests, and personalization logic at the network edge using Cloudflare Workers or Vercel
How do I install the edge-commerce skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the edge-commerce skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic