Skip to main content
This guide explains how to run an Expo React Native and web application inside a Blaxel Sandbox, expose it securely using Blaxel previews, and access it on a mobile device.

Prerequisites

  • Blaxel CLI installed and authenticated with bl login
  • Node.js 18 or later
  • @blaxel/core installed in your project with npm install @blaxel/core

1. Understand the architecture

Running Expo inside a Blaxel Sandbox requires a few adjustments:
  • Expo normally binds to local or internal URLs
  • Blaxel exposes services through preview URLs
  • Expo must use those preview URLs explicitly
Inject the preview URL into app.json, set EXPO_PACKAGER_PROXY_URL, restart the development server after configuration changes, and expose the Expo server through a Blaxel preview URL.

2. Build the sandbox image

Create a Dockerfile:

3. Configure and deploy the image

Create blaxel.toml beside the Dockerfile:
Deploy the image:

4. Create or reuse a sandbox

5. Configure preview response headers

Expo development servers require permissive CORS headers when accessed through a preview URL:
Alternatively, use custom domains to expose previews on your own domain.

6. Create the preview and token

Expo runs on port 8081. Create a private preview for that port:
Generate a token that expires after one day:

7. Inject the preview URL into Expo

Expo Router requires the correct origin when it runs behind a proxy. Update app.json in the sandbox:

8. Configure the proxy URL

Expo must serve assets through the preview URL. The following function updates .env only when the expected value is missing:

9. Start and monitor the development server

After setting the proxy URL, start the development server:
Stream its logs:

10. Access the Expo application

Open the web application at:
To access the application on a mobile device, build an Expo URL from the authenticated preview URL:
Encode the exp:// URL in a QR code:
Scan the QR code with your device’s camera or the Expo Go application.

11. Run the complete example

This setup runs Expo fully inside a Blaxel Sandbox, securely exposes the development server, supports Expo Router and asset loading, provides mobile access through the exp:// protocol, and starts the server after configuration changes. It is suitable for preview environments, internal demos, and AI-powered coding workflows.

Resources

Real-time previews

Configure public and private preview URLs for sandbox services.

Sandbox images

Build and manage reusable Blaxel Sandbox images.
Last modified on October 5, 2026