Rebasely Beta: data may be purged

examples/storefront Public

Move payments into its own Worker #2

Changed files

30 files changed345 additions238 deletionssince main at 94db762

Uploading a product image

Not changed by this pull request.

  • Added
  • Rerouted, relabelled or moved
  • Removed

The merchant sends the image bytes to the API, which stores them in R2 under a hash of their content and points the product at the new key. Shoppers load the image from the bucket's custom domain, so image requests never run the Worker.

Uploading a product image: 6 steps between 5 participants Step 1: merchant to storefront-api, PUT /admin/products/:id/image, admin tokenPUT /admin/products/:id/image…Step 2: storefront-api to db, check that the product existscheck that the product existsStep 3: storefront-api to images, put products/<id>/<hash>.<ext>, cached a yearput products/<id>/<hash>.<ext>, cached a yearStep 4: storefront-api to db, set the product's image_keyset the product's image_keyStep 5: storefront-api to merchant, the product, image_url on IMAGES_URLthe product, image_url on IMA…Step 6: shopper to images, GET <IMAGES_URL>/<key>, from Cloudflare's cacheGET <IMAGES_URL>/<key>, from …merchantmerchantActorstorefront-apistorefront-apiWorkerdbdbD1 databaseimagesimagesR2 bucketshoppershopperActor

The flow image-upload at the head of this pull request, numbered in its order, with the steps it adds, reroutes, relabels, moves and removes. A removed step has no number.

Steps

  1. Step 1: merchant → storefront-api PUT /admin/products/:id/image, admin token
  2. Step 2: storefront-api → db check that the product exists
  3. Step 3: storefront-api → images put products/<id>/<hash>.<ext>, cached a year
  4. Step 4: storefront-api → db set the product's image_key
  5. Step 5: storefront-api → merchant the product, image_url on IMAGES_URL
  6. Step 6: shopper → images GET <IMAGES_URL>/<key>, from Cloudflare's cache

Knowledge base

Back to the conversation