This guide will help you set up your development environment for Freighter Mobile.
-
Node.js & Yarn:
- Install Node.js (LTS version recommended). You can download it from nodejs.org.
- Yarn is the recommended package manager. Install it via npm (which comes
with Node.js):
npm install --global yarn
-
Watchman (macOS only):
- Watchman is a tool by Facebook for watching changes in the filesystem. It
is highly recommended for performance.
brew install watchman
- Watchman is a tool by Facebook for watching changes in the filesystem. It
is highly recommended for performance.
-
React Native CLI:
- Install the React Native command line interface:
npm install --global react-native-cli
- Alternatively, you might prefer to use
npx react-native <command>for running commands without a global installation.
- Install the React Native command line interface:
Follow the official React Native documentation for setting up your environment for iOS and Android development. This includes installing Xcode (for iOS) and Android Studio (for Android), along with their respective SDKs and command-line tools.
- Go to the React Native development environment setup page.
- Select "React Native CLI Quickstart".
- Follow the instructions for your development OS (macOS, Windows, Linux) and target OS (iOS, Android).
-
Clone the Repository:
git clone https://github.com/stellar/freighter-mobile.git cd freighter-mobile -
Install Dependencies:
yarn install
-
Environment Variables:
The project uses
react-native-configfor environment variables. You'll need to set up your environment variables before running the app:-
Create a
.envfile in the project root:touch .env
-
Add the required environment variables:
FREIGHTER_BACKEND_V1_PROD_URL=your_backend_v1_prod_url_here FREIGHTER_BACKEND_V2_PROD_URL=your_backend_v2_prod_url_here WALLET_KIT_PROJECT_ID_PROD=your_prod_project_id_here other variables... -
Update the
.env.examplefile for documentation, add the same variables without values:FREIGHTER_BACKEND_V1_PROD_URL= FREIGHTER_BACKEND_V2_PROD_URL= WALLET_KIT_PROJECT_ID_PROD= other variables...
Important:
- Never commit the
.envfile to version control - Keep
.env.exampleupdated with any new environment variables - If you don't have the required environment variables, ask a team member for the values
-
Important
See package.json for other useful scripts like more specific clean/install commands.
The app supports two different bundle IDs for different environments:
- Production:
org.stellar.freighterwallet(default) - Development:
org.stellar.freighterdev
Run on Android:
-
Development variant:
yarn android or yarn android-dev
-
Production variant:
yarn android-prod
Run on iOS (macOS only):
-
Development variant:
yarn ios or yarn ios-dev
-
Production variant:
yarn ios-prod
Important
- The Metro bundler should automatically launch in a separate terminal window
while running the
yarn iosoryarn androidscripts. You can also launch Metro manually through theyarn startcommand if needed - If you don't have an iOS simulator or Android emulator booted it will try to
boot the most recent one available while running the
yarn iosoryarn androidscripts - The development variant will have "Dev" in the app name to distinguish it from production
This should get you up and running with the Freighter Mobile app in your development environment. If you encounter any issues, please refer to the React Native documentation or open an issue in the repository.
The mock-dapp server allows you to manually test WalletConnect features like
stellar_signMessage and stellar_signXDR without needing a full dApp. This is
useful for both automated e2e tests and manual testing during development.
-
Navigate to mock-dapp directory:
cd mock-dapp -
Install dependencies:
npm install
-
Configure environment variables:
Create a
.envfile in themock-dappdirectory:cp .env.example .env
Add your WalletConnect project ID:
WALLET_KIT_PROJECT_ID=your_project_id_here PORT=3001 -
Start the server:
npm start
Or use the provided script from the e2e directory:
./e2e/scripts/start-mock-server.sh
The server will run on http://localhost:3001 and provide endpoints for:
- Creating WalletConnect sessions
- Sending sign message requests
- Sending sign transaction requests
- Viewing session responses
For more details, see the mock-dapp README.
To stop the server:
./e2e/scripts/stop-mock-server.sh