Skip to main content
Expo app with the dev server running on port 8081. Expo is a React Native framework that simplifies mobile and web app development.

Create the Expo project

Scaffold a fresh Expo app. The dev server starts automatically when the sandbox boots.
// template.ts
import { Template, waitForURL } from 'e2b'

export const template = Template()
  .fromNodeImage()
  .setWorkdir('/home/user/expo-app')
  .runCmd('npx create-expo-app@latest . --yes')
  // Move project files to /home/user for a cleaner working directory
  .runCmd('mv /home/user/expo-app/* /home/user/ && rm -rf /home/user/expo-app')
  .setWorkdir('/home/user')
  .setStartCmd('npx expo start', waitForURL('http://localhost:8081'))

Build and publish

Build the template with enough memory for the Expo bundler.
// build.ts
import { Template, defaultBuildLogger } from 'e2b'
import { template as expoTemplate } from './template'

await Template.build(expoTemplate, 'expo-app', {
  cpuCount: 4,
  memoryMB: 8192,
  onBuildLogs: defaultBuildLogger(),
})

Access the dev server

Create a sandbox and get the URL. Open it in your browser to see the Expo web preview on port 8081.
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create('expo-app', { timeoutMs: 60_000 })

const url = sandbox.getHost(8081)
console.log('Expo app running at:', url)