Axonpack

Storage

One S3-compatible bucket holds every preview. Public or private, and the two keys.

Previews live in one S3-compatible bucket: AWS S3, Cloudflare R2, MinIO, or any other host with the S3 API. There is no server of your own and no provider switch. The CLI writes to the bucket with a write key, and the app reads from it.

HostGuide
AWS S3AWS S3
Cloudflare R2Cloudflare R2
MinIO on your own server, or on your laptopMinIO
MinIO AIStorMinIO AIStor
Any other S3-compatible hostAny S3-compatible host

The URL

Both sides take one URL: <endpoint>/<bucket>. Requests are path-style.

ExampleEndpointBucket
http://localhost:9000/previews-publichttp://localhost:9000previews-public
https://s3.eu-west-1.amazonaws.com/acme-previewshttps://s3.eu-west-1.amazonaws.comacme-previews
https://<account>.r2.cloudflarestorage.com/previewshttps://<account>.r2.cloudflarestorage.compreviews

Several apps can share one bucket. Each app's files go in a folder named after its Expo slug: the CLI reads the slug from the app config, and the app gets it from the config plugin, which bakes it into the build. One app never lists, downloads or deletes another app's previews, and the URL needs no folder for that.

A URL that ends in a folder (<endpoint>/<bucket>/<folder>) still works. The slug folder goes inside it, as <folder>/<slug>/. You no longer need that folder. To drop it, change the URL on both sides (the app's change needs a new build) and publish the previews you still need again.

Public or private

Pick one per bucket.

ModeWho can readWhat the app gets
PublicAnyone with the URLThe URL only. Reads are plain HTTPS GETs
PrivateOnly requests signed with a keyThe URL and a read-only key. The app signs each read with SigV4

Either way, only the write key can write. A public bucket is the simpler setup: nothing secret is in the app at all. A private bucket keeps strangers from downloading your previews, but the read key is inside the app binary, and anyone with the binary can pull it out. So the read key must be read-only, and limited to the preview bucket.

For a public bucket the app's URL can be any address the files are public under: the same <endpoint>/<bucket> URL, R2's https://pub-<id>.r2.dev, your own domain, or a CDN in front. With a read key it must be the real <endpoint>/<bucket> URL, because the app signs for that bucket.

The two keys

KeyUsed byNeeds
Write keypreview publish, unpublish, pruneRead, write, delete and list objects in the bucket
Read keyThe app, for a private bucket onlyRead and list objects in the bucket. Nothing else

As an S3 policy, the write key needs s3:GetObject, s3:PutObject, s3:DeleteObject and s3:ListBucket on the bucket. The read key needs s3:GetObject and s3:ListBucket.

With several apps in one bucket, each app can have keys of its own. Where a policy can name a path, as on AWS S3 and MinIO, limit a key's object actions to that app's folder, arn:aws:s3:::<bucket>/<slug>/*. See AWS's bucket policy examples and MinIO's policy management for how to write one. A read key limited this way can't read previews published by 0.1.0, which sit outside the folder (below).

s3:ListBucket matters on the read key too. Without it, S3 answers a missing file with 403 instead of 404. A build with nothing published yet would then show an error instead of an empty list.

The write key never goes in the app

Expo builds every EXPO_PUBLIC_* value into the app. The write key belongs in CI secrets or a gitignored .env.local, and the CLI reads it under a name with no EXPO_PUBLIC_ prefix. See Settings and env files.

What is in the bucket

<slug>/index.json                            every native build and its previews, for people
<slug>/index/<platform>/<key>.json           what one native build can run; the app reads this
<slug>/previews/<platform>/<key>/<id>.json   one preview's manifest: files, changelog, versions
<slug>/files/<sha256>                        bundle and image blobs, shared between previews

<slug> is the app's Expo slug. <key> is version-1.0.0 or fingerprint-<hash>, as on Compatibility. The app downloads one small file, <slug>/index/<platform>/<key>.json, and gets only what it can run. A native change starts a new, empty list on its own, so there is nothing to clean up on the server.

Files are stored once per app under their sha256. A rebuild that only changed JS uploads one new bundle and reuses every image.

unpublish and prune only touch the app's own folder.

Both lists are updated only if nobody wrote in between: the CLI sends If-Match with the ETag, or If-None-Match: * for a new file. On a clash it reads again and retries, so two publishes at the same time both end up listed. The host has to honour those headers on a PUT.

Previews published by 0.1.0

0.1.0 wrote the same files without the slug folder. When the app finds no list for its build in the slug folder, it reads the old list and downloads those previews from where they are, so they keep showing. The first publish for that build under the slug makes a new list, and from then on the app reads only that one. So publish again every old preview QA still needs. The CLI never writes outside the slug folder, and prune never deletes there, so delete the old files by hand once nothing uses them.

It works one way only. A build made with 0.1.0 still reads outside the slug folder, so it never lists a preview published with a newer CLI. Give QA a new build once you update the package.

HTTPS

Use HTTPS for a real bucket. Every file is also checked against its sha256 before it is used, but the list itself is only as safe as the connection it came over.

Plain HTTP works where the platform allows it, which is mostly for testing:

  • Android: a release build refuses plain HTTP to any host unless the app allows cleartext traffic (expo-build-properties, android.usesCleartextTraffic). A debug build allows it.
  • iOS: App Transport Security blocks plain HTTP to named hosts. It does not apply to IP addresses or localhost.

The package never turns cleartext on by itself. If you do, do it in your own app config, and preferably only in builds that point at a test server.

Next: AWS S3

On this page