High-Level Architecture
Expo consists of several interconnected components:Core Components
1. Expo SDK
The Expo SDK is a collection of 50+ JavaScript libraries that provide access to native device capabilities. Each library is a separate npm package. Key SDK Modules:Core Modules
expo-asset- Asset loading systemexpo-constants- App manifest constantsexpo-file-system- File operationsexpo-font- Custom font loading
Device Features
expo-camera- Camera accessexpo-location- GPS and locationexpo-sensors- Accelerometer, gyroscopeexpo-battery- Battery status
UI Components
expo-blur- Blur effectsexpo-glass-effect- Glass morphismexpo-symbols- SF Symbols (iOS)expo-image- Optimized images
Network & Storage
expo-network- Network infoexpo-secure-store- Encrypted storageexpo-sqlite- SQLite databaseexpo-auth-session- OAuth flows
expo package bundles essential modules:
package.json (from expo package)
2. Expo Modules Core
expo-modules-core is the foundation that enables writing native modules that work seamlessly across iOS and Android. It provides:
- Unified Native API: Write native code once, works on both platforms
- Autolinking: Automatic native module discovery and linking
- Type Safety: Generated TypeScript types from native code
- Module Registration: Automatic module registration in the runtime
- Native code is written using the Expo Modules API (Swift for iOS, Kotlin for Android)
- Autolinking discovers modules at build time
- Modules are automatically registered with React Native
- JavaScript can import and use the module immediately
For details on creating modules, see the Expo Modules documentation.
3. Expo CLI
The@expo/cli package is the command-line interface for Expo. It provides:
Development Commands:
expo start- Start Metro bundler and dev serverexpo run:ios- Build and run on iOSexpo run:android- Build and run on Android
expo prebuild- Generate native projectsexpo export- Export for production
expo install- Install compatible packagesexpo config- View merged app configurationexpo customize- Customize Metro config
4. Expo Router
Expo Router provides file-based routing for React Native apps. It’s built on React Navigation but uses your file structure to automatically generate navigation. Router Architecture: Key Concepts:- File-Based Routes: Files in
app/become routes - Layouts:
_layout.tsxfiles define navigation structure - Dynamic Routes:
[param].tsxfor dynamic segments - Groups:
(group)folders organize without affecting URLs - Type Safety: Automatic TypeScript types for routes
Learn more about routing in the Development Workflow guide.
5. Metro Bundler
Metro is the JavaScript bundler that transforms and bundles your code. Expo integrates Metro with enhancements: Metro’s Role:- Transformation: Converts TypeScript/JSX to JavaScript
- Bundling: Combines modules into optimized bundles
- Code Splitting: Separates code for different platforms
- Fast Refresh: Updates app without losing state
- Multi-platform support (iOS, Android, Web)
- Asset handling (images, fonts, etc.)
- Environment variable support
- Web compatibility shims
- Server-side rendering support
metro.config.js
6. React Native
At the foundation, Expo builds on React Native, which provides:- JavaScript Runtime: Hermes (default) or JSC
- Bridge: Communication between JS and native
- Native Components: View, Text, Image, etc.
- Native Modules: Platform APIs
Development Workflow
How Development Server Works
When you runnpx expo start:
Build Process
Development Build Process: Production Build Process:Configuration System
Expo uses a layered configuration system:app.json / app.config.js
Your app’s configuration file defines:app.json
Config Plugins
Config plugins modify native projects duringexpo prebuild:
app.config.js
- Modify iOS Info.plist and Podfile
- Modify Android AndroidManifest.xml and build.gradle
- Add native dependencies
- Configure permissions
- Add entitlements
Autolinking
Autolinking automatically configures native dependencies: How it works:- Install package:
npx expo install expo-camera - Autolinking runs during build
- Scans
node_modulesfor Expo modules - Generates native configuration
- Registers modules in app
Podfile
settings.gradle
Platform Differences
Expo handles platform differences through:File Extensions
Platform Module
Conditional Imports
Performance Optimizations
Expo includes several performance optimizations:Hermes Engine
Hermes is enabled by default for faster startup:app.json
Bundle Splitting
Metro splits bundles by platform:Asset Optimization
Assets are automatically optimized:- Images: Compressed and sized appropriately
- Fonts: Subsetted when possible
- Videos: Served with proper MIME types
Summary
Expo SDK
JavaScript libraries for device features, built on expo-modules-core
Expo CLI
Command-line tools for development, building, and deployment
Expo Router
File-based routing built on React Navigation
Metro Bundler
JavaScript bundler with multi-platform support
Next Steps
Expo Modules
Learn how native modules work
Development Workflow
Understand the development cycle
Expo Go
Learn about the Expo Go app
Tutorial
Build your first app