While you can run the F8 App on your mobile device by downloading it from the iOS App Store, or the Google Play Store, you might want to run it locally while reading these tutorials.

Follow this short guide to setup and run the source code locally on OSX (the Android version of React Native has some support for Windows and Linux testing).

Requirements

Before you get started, you’ll need to install some pre-requisites:

  1. React Native (follow iOS and Android guides)
  2. CocoaPods 1.0+ (only for iOS)
  3. MongoDB (needed to run Parse Server locally)

Setup

1. Clone the repo

1
2
$ git clone https://github.com/fbsamples/f8app.git
$ cd f8app

2. Install dependencies (npm v3+):

1
2
$ npm install
$ (cd ios; pod install)        # only for iOS version

3. Make sure MongoDB is running:

1
$ lsof -iTCP:27017 -sTCP:LISTEN

or if using external MongoDB server, set DATABASE_URI:

1
$ export DATABASE_URI=mongodb://example-mongo-hosting.com:1337/my-awesome-database

4. Start Parse/GraphQL servers:

1
$ npm start

5. Import sample data (the local Parse Server should be running):

1
$ npm run import-data

Make sure everything works by visiting:

6. Running the Android version:

1
2
3
$ react-native run-android
$ adb reverse tcp:8081 tcp:8081   # required to ensure the Android app can
$ adb reverse tcp:8080 tcp:8080   # access the Packager and GraphQL server

7. Running the iOS version:

1
$ react-native run-ios