This repo contains a server and client that implement the Expo Updates protocol specification.
Expo provides a set of service named EAS (Expo Application Services), one of which is EAS Update which can host and serve updates for an Expo app using the expo-updates
library.
In some cases more control of how updates are sent to an app may be needed, and one option is to implement a custom updates server that adheres to the specification in order to serve update manifests and assets. This repo contains an example server implementation of the specification and a client app configured to use the example server.
To understand this repo, it's important to understand some terminology around updates:
expo-update-server
worksThe flow for creating an update is as follows:
Note: The app is configured to load updates from the server running at http://localhost:3000. If you prefer to load them from a different base URL (for example, in an Android emulator):
.env.local
in the server.updates.url
in app.json
and re-run the build steps below.The example Expo project configured for the server is located in /expo-updates-client.
Run yarn
and yarn ios --configuration Release
.
Run yarn
and then run yarn android --variant release
.
Let's make a change to the project in /expo-updates-client that we'll want to push as an over-the-air update from our custom server to the "release" app. cd
in to /expo-updates-client, then make a change in App.js.
Once you've made a change you're happy with, inside of /expo-updates-server, run yarn expo-publish
. Under the hood, this script runs npx expo export
in the client, copies the exported app to the server, and then copies the Expo config to the server as well.
Now we're ready to run the update server. Run yarn dev
in the server folder of this repo to start the server.
In the simulator running the "release" version of the app, force close the app and re-open it. It should make a request to /api/manifest, then requests to /api/assets. After the app loads, it should show any changes you made locally.
This server was created with NextJS. You can find the API endpoints in pages/api/manifest.js and pages/api/assets.js.
The code signing keys and certificates were generated using https://github.com/expo/code-signing-certificates.
We chose to make this example with NextJS so that you can run one command to get the API running, and also so that you could deploy this to Vercel to load updates from a real server. If you choose to deploy this to Vercel, you'll need to find the URL the endpoints exist at, then update the Expo.plist for iOS with the URL under the EXUpdatesURL
key, then rebuild a "release" app to include the new URL.