Development application for testing the Contentful Optimization React Native SDK.
Use this harness when you need an interactive local app for the package under
packages/react-native-sdk. For the published SDK API surface, start with the package
README. For the separate reference implementation used by repo-level E2E flows, see
implementations/react-native-sdk.
From the packages/react-native-sdk directory:
Run iOS setup:
pnpm dev:setup:iosRun Android setup:
pnpm dev:setup:androidStart only the mock server and Metro bundler:
pnpm dev:setup:serversOr run the script directly:
./dev/scripts/run-dev-dashboard.sh --ios
./dev/scripts/run-dev-dashboard.sh --android
./dev/scripts/run-dev-dashboard.sh --no-app
./dev/scripts/run-dev-dashboard.sh --clean
./dev/scripts/run-dev-dashboard.sh --help- Checks all prerequisites (Node.js, pnpm, Watchman, Xcode/CocoaPods or Android SDK)
- Installs workspace dependencies via
pnpm install - Starts the mock API server on port 8000
- Starts the Metro bundler on port 8081
- For iOS: Installs CocoaPods
- For Android: Sets up adb reverse port forwarding
- Builds and launches the app (unless
--no-appis specified) - Cleans up all background processes on exit (Ctrl+C)
All logs are written to packages/react-native-sdk/dev/logs/:
mock-server.log: Mock API server outputmetro.log: Metro bundler output
If you prefer to set things up manually:
From the workspace root:
pnpm installThe dev app requires the mock server to be running. From the workspace root:
pnpm serve:mocksThis starts the mock server on http://localhost:8000 with:
- Experience API:
http://localhost:8000/experience/ - Insights API:
http://localhost:8000/insights/ - Contentful CDA:
http://localhost:8000/contentful/
cd packages/react-native-sdk/dev/ios
pod install --repo-update
cd ..From packages/react-native-sdk:
pnpm dev:startOr with cache reset:
pnpm dev:start:cleanIn a new terminal, from packages/react-native-sdk:
Run iOS:
pnpm dev:iosRun Android:
pnpm dev:android- Node.js >= 20.19.0 (
24.13.0recommended to match.nvmrc) - pnpm (workspace package manager)
- Watchman (recommended for file watching)
brew install watchman
- Xcode with iOS Simulator
- CocoaPods
sudo gem install cocoapods
- Android Studio with emulator configured
- ANDROID_HOME environment variable set
This usually means the mock server isn't running. Make sure to start it:
pnpm serve:mocksFirst try to stop only the known development processes you started:
Stop Metro by exiting its terminal, or use the package clean start:
pnpm dev:start:cleanInspect port owners before stopping anything manually:
lsof -nP -iTCP:8000 -sTCP:LISTEN
lsof -nP -iTCP:8081 -sTCP:LISTENIf a stale local process is definitely the dev dashboard or mock server, stop that process by PID
with kill <pid>. Avoid broad or forceful cleanup unless you have confirmed the process is safe to
terminate.
Reset the cache:
pnpm dev:start:cleanClean and reinstall pods:
cd dev/ios
pod deintegrate
pod install --repo-updateIf CocoaPods still resolves stale native dependencies, remove Pods/ and Podfile.lock only from
packages/react-native-sdk/dev/ios/, then run pod install --repo-update again.
Clean Gradle cache:
cd dev/android
./gradlew cleandev/
├── App.tsx # Main app component
├── components/ # UI components
│ ├── LoadingScreen.tsx
│ ├── MergeTagDetailCard.tsx
│ ├── SDKConfigCard.tsx
│ └── SDKStatusCard.tsx
├── utils/
│ └── sdkHelpers.ts # SDK initialization and data fetching
├── env.config.ts # Environment configuration (mock server URLs)
├── scripts/
│ └── run-dev-dashboard.sh # Setup and run script
├── ios/ # iOS native project
└── android/ # Android native project
The app connects to the mock server by default. Configuration is in env.config.ts:
PUBLIC_EXPERIENCE_API_BASE_URL: Experience API endpointPUBLIC_INSIGHTS_API_BASE_URL: Insights API endpointPUBLIC_CONTENTFUL_CDA_HOST: Contentful mock server host
- SDK Initialization: Verifies the Optimization React Native SDK initializes correctly
- Profile Management: Tests profile creation and updates
- Merge Tag Resolution: Demonstrates merge tag value resolution
- Entry Tracking: Tests viewport-based analytics tracking
- Optimization: Shows optimized content rendering
| Script | Description |
|---|---|
pnpm dev:setup:ios |
Full setup and run on iOS |
pnpm dev:setup:android |
Full setup and run on Android |
pnpm dev:setup:servers |
Start mock server and Metro only |
pnpm dev:ios |
Run app on iOS (requires servers running) |
pnpm dev:android |
Run app on Android (requires servers running) |
pnpm dev:start |
Start Metro bundler |
pnpm dev:start:clean |
Start Metro with cache reset |