๐ Super App Mobile (React Native + Expo)
The Mobile App is built with React Native + Expo and TypeScript, serving as a secure container for dynamically loaded MicroApps. It provides OAuth 2.0 authentication via External IdP, token-based authorization, and a WebView bridge for MicroApp-to-native communication.
Getting Started
Prerequisites
Before setting up the project, ensure you have the following installed:
- Node.js (v18 or higher)
- npm package manager
- Expo CLI:
npm install -g @expo/cli - Git for version control
Project Setup
-
Clone the Repository
git clone <repository-url> cd superapp-mobile/frontend -
Install Dependencies
npm install -
Environment Configuration
cp .env.example .envFill in the required environment variables in
.env:- Authentication
- Explicit endpoints (recommended)
EXPO_PUBLIC_TOKEN_URLEXPO_PUBLIC_CLIENT_IDEXPO_PUBLIC_REDIRECT_URIEXPO_PUBLIC_LOGOUT_URL
- Explicit endpoints (recommended)
- APP Metadata
APP_NAMEAPP_SLUGAPP_SCHEMEAPP_VERSIONAPP_OWNERBUNDLE_IDENTIFIERANDROID_PACKAGE
- Backend
BACKEND_BASE_URL
- Other Services
EXPO_PUBLIC_EVENTS_URLEXPO_PUBLIC_NEWS_URL
- Optional
USE_BACKEND_TOKEN_EXCHANGE("true"|"false", default true)- OpenTelemetry: set
EXPO_PUBLIC_OTEL_ENABLED=trueto enable metrics during development and addEXPO_PUBLIC_OTEL_COLLECTOR_URL
Create a folder named
google-servicesinsidefrontend/and include the Firebase artifacts (google-services.jsonandGoogleService-Info.plist) inside it.For branding changes, refer to the
assetsfolder andconstant/colors.ts. - Authentication
-
Start Development Server
# Android npx expo prebuild --platform android --clean // To pre-build the package npx expo run:android # iOS Simulator npx expo prebuild --platform ios --clean npx expo run:ios
๐ Deployment
Build Process
Pre-build Native Projects
# Android only
npx expo prebuild --platform android --clean
# iOS only
npx expo prebuild --platform ios --clean
# Both platforms
npx expo prebuild --clean
Android Build
Navigate to the Android folder and build:
The resulting APK will be in android/app/build/outputs/apk/release/.
iOS Build
Use either Xcode or command line:
# Build for archiving
xcodebuild archive \
-workspace YourAppName.xcworkspace \
-scheme YourSchemeName \
-configuration Release \
-archivePath build/YourAppName.xcarchive
# Export the IPA
xcodebuild -exportArchive \
-archivePath build/YourAppName.xcarchive \
-exportPath build/ipa \
-exportOptionsPlist ExportOptions.plist
More Details
- Development build
- Android emulator
- iOS simulator
- Expo Go, a limited sandbox for trying out app development with Expo
You can start development by editing the files inside the app directory. This project uses file-based routing.
Production Builds Using EAS Build
# Using EAS Build
npx eas build --platform android
npx eas build --platform ios
# Or using Expo Application Services
npx expo build:android
npx expo build:ios
๐๏ธ Architecture Overview
Technology Stack
- Framework: React Native with Expo (SDK 52+)
- Language: TypeScript
- Architecture: MVVM (Model-View-ViewModel)
- Navigation: Expo Router (file-based routing)
- State Management: Redux Toolkit + Redux Persist
- Authentication: OAuth 2.0 / OIDC via External IdP
- Storage:
expo-secure-store- Encrypted storage for sensitive data (auth tokens, user configs)@react-native-async-storage/async-storage- General storage for non-sensitive data- Styling: React Native StyleSheet + Custom components
- HTTP Client: Axios
- Testing: Jest + React Native Testing Library
- E2E Testing: Maestro
๐ Security & Data Storage
Storage Strategy
The app uses a dual-storage approach for optimal security and performance:
๐ SecureStore (Encrypted Storage)
- Authentication tokens: Access tokens, refresh tokens, ID tokens
- User configurations: Settings that may contain sensitive preferences
- Implementation:
utils/secureStorage.tswrapper that automatically routes sensitive keys toexpo-secure-store
๐ฆ AsyncStorage (General Storage)
- App catalog: Micro-app metadata (names, descriptions, icons)
- User display info: Read-only user info for UI display (name, email)
- Cache data: News feed, events (non-sensitive, temporary data)
Security Features
- Token-based authentication with automatic refresh
- Encrypted storage for authentication credentials
- Secure token exchange for micro-app access
- Automatic token expiration handling
- Secure logout with complete token cleanup
High-Level Mobile App Flow
-
First launch
- If the user is not authenticated, the Login screen is shown.
- After successful sign-in, the app initializes user profile and configuration.
-
Landing experience (authenticated)
- Default landing tab is Feed.
- Tabs available: Feed, My Apps, Profile.
-
Authentication
- Retrieve access_token & refresh_token via the IdP and store them in encrypted storage.
- Fetch user configurations and profile info.
- Align locally installed micro-apps with server-side configuration (install/uninstall as needed).
-
Using the app
- Feed shows the latest content.
- My Apps lists the user's micro-apps.
- Profile provides account details and the sign-out option.
-
On re-open
- If a valid session exists, the app opens directly to the tabs (Feed by default).
- Checks for a Super App force update; if required, the update screen is shown.
- Checks if any micro-apps have updates and updates them automatically.
๐งช Testing
This project includes unit and integration tests following industry best practices.
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage report
npm run test:coverage
# Run tests in CI mode
npm run test:ci
# Update test snapshots
npm run test:update