Serving & Caching (Edge)
After a theme is built and published, Shoppex serves it as static files through an edge layer (close to the customer). As a theme developer, you do not need to run a server. Your job is to:- build to
dist/ - make sure
dist/index.htmlreferences the assets that actually exist indist/
Request Flow (Simplified)
- Customer visits
https://{shop}.{storefront-domain}/... - Shoppex resolves which shop/theme should serve that domain
- The edge layer returns
index.htmland your built assets (JS/CSS/images)
Cache Rules (In Human Terms)
index.htmlshould not be cached long (so updates show quickly)- hashed assets under
/assets/*-[hash].*can be cached βforeverβ
Debugging Tips
Page looks stale (old version)
Page looks stale (old version)
Try, in order:
- Hard refresh (Cmd+Shift+R / Ctrl+Shift+R)
- Confirm you are on the correct shop domain (and not a preview link)
- Republish the theme (so the platform can pick up the new
dist/)
HTML loads but CSS/JS 404s
HTML loads but CSS/JS 404s
This almost always means an asset path mismatch.Check:
- your build actually wrote the file to
dist/(e.g.dist/assets/...) dist/index.htmlreferences the same filename/path- you are not hard-coding absolute paths that break on a different domain
Everything 404s
Everything 404s
Check:
bun run buildreally producesdist/index.html- you published the theme successfully (local build output alone is not βliveβ)
Cache headers and behavior
Cache headers and behavior
Shoppex sets
Cache-Control headers based on file type:index.htmluses short-lived or no-cache headers so updates are visible quickly- Hashed assets (JS/CSS with content hashes in the filename) use long-lived cache headers since the filename changes when content changes
Custom Domains
Shoppex can serve storefronts on custom domains. When a customer visits a custom domain, the edge layer resolves which shop/theme to serve via the domain lookup API. Theme developers do not need to configure anything β custom domain support is handled at the platform level.Next Steps
Build Pipeline
Understand what happens during publish (install, build, optional injection, deploy).
Troubleshooting
Quick fixes for the most common edge serving issues.