Prerequisites
- Blaxel CLI installed and authenticated with
bl login - Node.js 18 or later
@blaxel/coreinstalled in your project withnpm 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
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 aDockerfile:
3. Configure and deploy the image
Createblaxel.toml beside the Dockerfile:
4. Create or reuse a sandbox
5. Configure preview response headers
Expo development servers require permissive CORS headers when accessed through a preview URL:6. Create the preview and token
Expo runs on port8081. Create a private preview for that port:
7. Inject the preview URL into Expo
Expo Router requires the correct origin when it runs behind a proxy. Updateapp.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:10. Access the Expo application
Open the web application at:exp:// URL in a QR code:
11. Run the complete example
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.