> For the complete documentation index, see [llms.txt](https://geekyants-5.gitbook.io/flatandflatmates/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://geekyants-5.gitbook.io/flatandflatmates/installation/how-to-deploy-in-local-machine-1.md).

# How to deploy in local machine

## Deploy Api-Server and Mobile App in Local machine <a href="#deploy-api-server-and-mobile-app-in-local-machine" id="deploy-api-server-and-mobile-app-in-local-machine"></a>

### Installation Steps <a href="#installation-steps" id="installation-steps"></a>

* Download FlatAndFlatmates full app and extract it
* Open terminal in extracted folder

## Api Server <a href="#api-server" id="api-server"></a>

1. &#x20;**Run** **`cd ApiServer/`** in terminal
2. **Open** another terminal and enter `mongod` this would start mongo server
3. **Run** **`npm install`** or **`yarn install`** to install packages
4. **Update** the OneSignal AppId and Api key for Mobile App in `ApiServer/server/service/pushNotifications.js at line 8 nad 9.`
5. Update the Cloudinary details `cloud_name`, `api_key,` `api_secret` in `ApiServer/config/cloudinaryConfig.js`
6. **Run** **`npm start`** in terminal to start server

**Issue Resolved : Common Issue of the mongo server**

Unable to lock file: /data/db/**mongod.lock** resource temporarily unavailable. Is a **mongod** instance already running? , terminating, You need to enter, `sudo killall -15 mongod`

## FlatAndFlatmates Mobile App <a href="#deliveryz-mobile-app" id="deliveryz-mobile-app"></a>

* **Install packages** Navigate to MobileApp folder of the app run `yarn` or run `npm i`
* Update your server url (Ip address) in MobileApp/config.js `serverSideUrl: 'http://00.00.00.00'`
* **Run on iOS** Navigate to ios folder of Mobile App and then run `pod install`
  * Opt #1:
    * Open the project in Xcode from `ios/FlatAndFlatmates.xcworkspace`
    * Click `run` button to simulate
  * Opt #2:
    * Run `react-native run-ios` in your terminal&#x20;
* **Run on Android**
  * Make sure you have an `Android emulator` installed and running or connect to android device
  * Run `react-native run-android` in your terminal

​

### Configuring Google Map <a href="#configuring-google-map" id="configuring-google-map"></a>

Update `YOUR_GOOGLE_API_KEY` in MobileApp/ios/AppName/AppDelegate.m file for ios in line 30

Update `YOUR_GOOGLE_API_KEY` in MobileApp/android/app/src/main/res/values/strings.xml file for Android in line 4

You need to update key `YOUR_GOOGLE_API_KEY` inside `MobileApp/src/Util/data.js`  file in line 3

Get Google Map API key from [here](https://developers.google.com/maps/documentation/ios-sdk/get-api-key)​

If you have trouble setting up follow [here](https://github.com/react-community/react-native-maps/blob/master/docs/installation.md)​

### Configuring Facebook Login <a href="#configuring-facebook-login" id="configuring-facebook-login"></a>

Create App on [Facebook Developer](https://developers.facebook.com/apps/)​

You need to update the Facebook App ID in `ios/AppName/Info.plist` line 28,35 && `android/app/src/main/res/values/strings.xml`

If you have trouble setting up follow [here](https://github.com/facebook/react-native-fbsdk)​

### Configuring Sentry <a href="#configuring-sentry" id="configuring-sentry"></a>

Create App on [sentry.io](https://sentry.io/) You need to update sentry.properties file inside ios folder and in an android folder, along with it update the DNS for your app in App.js in the root folder of Mobile App

Follow documentation [here](https://github.com/getsentry/react-native-sentry) and link your Mobile App.

### Configuring OneSignal <a href="#configuring-onesignal" id="configuring-onesignal"></a>

Before setting up the onesignal you will need to generate an iOS Push Certificate && a Google Server API Key on Firebase console.

Go to [Firebase Console](https://console.firebase.google.com/) -> Settings -> Project Settings -> Cloud Messaging -> iOS app configuration

You will get Google Server API Key on the same page of iOS app configuration

You need to update key `OnesignalAppId` inside `MobileApp/src/Util/data.js` file.

You have to follow [here](https://documentation.onesignal.com/docs/react-native-sdk-setup) to set up the environment.
