Skip to content

Routes

Complete route table for the Maho Storefront Worker.

Catalog Routes (Edge Cached)

These routes render server-side HTML and are cached at the Cloudflare edge.

RouteMethodDescriptionEdge TTL
/GETHomepage30 min
/:slugGETCategory, product, CMS page, or blog post2-4 hours
/:category/:productGETProduct with category context4 hours

URL Resolution

For /:slug routes, the Worker resolves the entity type:

  1. Check KV for {store}:product:{slug} → Product page
  2. Check KV for {store}:category:{slug} → Category page
  3. Check KV for {store}:cms:{slug} → CMS page
  4. Check KV for {store}:blog:{slug} → Blog post
  5. API URL resolver fallback → Fetch + cache entity
  6. None found → 404 page

Dynamic Routes (Never Cached)

User-specific pages that always hit the Worker handler.

RouteMethodDescription
/cartGETShopping cart
/checkoutGETCheckout flow
/accountGETAccount dashboard
/account/ordersGETOrder history
/account/addressesGETAddress book
/loginGETLogin page
/registerGETRegistration page
/searchGETSearch results
/forgot-passwordGETPassword reset

Internal Endpoints

RouteMethodAuthDescription
/syncPOSTSecretFull data sync (all entities)
/sync/configPOSTSecretSync store config only
/sync/categoriesPOSTSecretSync categories only
/sync/productsPOSTSecretSync all products
/sync/cms-pagesPOSTSecretSync CMS pages
/sync/blog-postsPOSTSecretSync blog posts
/sync/countriesPOSTSecretSync country list
/cache/updatePOSTSecretUpdate specific KV entries
/cache/purgePOSTSecretPurge edge cache for URLs
/cache/deletePOSTSecretDelete KV keys
/freshnessPOSTNoneClient freshness check

Static Assets

RouteMethodCacheDescription
/styles.cssGET1 yearUnoCSS bundle
/controllers.jsGET1 yearesbuild JS bundle
/robots.txtGETProxyProxied from backend
/sitemap.xmlGETProxyProxied from backend
/media/*GETProxyMedia files proxied from backend

Client-Side API Proxy

These routes proxy requests to the Maho REST API.

RouteMethodDescription
/api/cartGETGet current cart
/api/cart/itemsPOSTAdd item to cart
/api/cart/items/:idPATCHUpdate cart item
/api/cart/items/:idDELETERemove cart item
/api/cart/couponPOSTApply coupon code
/api/cart/couponDELETERemove coupon
/api/cart/shipping-methodsPOSTGet shipping methods
/api/cart/shippingPOSTSet shipping method
/api/checkout/place-orderPOSTPlace order
/api/auth/loginPOSTCustomer login
/api/auth/logoutPOSTCustomer logout
/api/customersPOSTCreate account
/api/customers/password-resetPOSTRequest password reset
/api/searchGETSearch products
/api/reviewsPOSTSubmit product review

Source: src/index.tsx