Skip to main content

Configure a Firebase Project for a React Native App

Many Instamobile React Native apps use Firebase for authentication, Firestore data, media storage, push notifications, analytics, and backend functions. This guide shows the full setup order before you connect the app to your own backend.

Quick Answer

Create one Firebase project for your product, add both the iOS and Android apps, download GoogleService-Info.plist and google-services.json, replace the app config files, enable the Firebase services used by the app, deploy rules/indexes/functions when included, then run the app and verify that new data appears in your Firebase console.

Firebase Setup Flow

Follow this order:

  1. Create or choose a Firebase project.
  2. Add an iOS app with the app's current bundle identifier.
  3. Add an Android app with the app's current application id.
  4. Download the iOS and Android Firebase config files.
  5. Replace the config files inside the React Native app.
  6. Enable Firebase Authentication providers used by the app.
  7. Enable Firestore.
  8. Enable Firebase Storage if the app uploads media.
  9. Deploy Firestore rules, Storage rules, and indexes if the app package includes them.
  10. Deploy Firebase Functions if the app package includes backend functions.
  11. Import seed data if the app ships demo data.
  12. Run the app and verify sign-up, login, reads, writes, and uploads.

Do not publish the app with Instamobile demo Firebase credentials. Use your own Firebase project before production.

1. Create a Firebase Project

Open Firebase Console and create a new project for your app.

Use one Firebase project per product or environment. For production teams, a common setup is:

EnvironmentPurpose
DevelopmentLocal testing, experiments, and early integration work.
StagingQA builds, review builds, and pre-release validation.
ProductionReal users, real data, production rules, and production billing.

Small projects can start with one Firebase project, but separate environments make releases safer.

2. Add the iOS App

In Firebase Console, choose Add app and select iOS.

Firebase asks for the iOS bundle identifier. Find it in the iOS project:

  • Xcode project settings under the app target;
  • ios/ project files;
  • app-specific release README, if included.

The bundle identifier must match the value used by the iOS app build. You can change it later during white-labeling, but then you must update Firebase and download a new GoogleService-Info.plist.

3. Add the Android App

In Firebase Console, choose Add app and select Android.

Firebase asks for the Android package name. Check:

  • android/app/build.gradle;
  • the applicationId field;
  • product-specific README notes, if included.

The package name must match the Android app build. If you change it later, add or update the Android app in Firebase and download a new google-services.json.

4. Download Firebase Config Files

Download the files generated by Firebase:

PlatformFirebase fileCommon app location
iOSGoogleService-Info.plistios/<AppName>/GoogleService-Info.plist
Androidgoogle-services.jsonandroid/app/google-services.json

Exact paths can vary by app. Search the app folder before replacing files:

find ios android -name "GoogleService-Info.plist" -o -name "google-services.json"

Replace the existing app config files with the files from your Firebase project.

5. Enable Firebase Authentication

Enable only the sign-in providers used by your app. Common providers include:

  • Email/password;
  • Phone;
  • Apple;
  • Google;
  • Facebook.

Some providers require native platform configuration in addition to Firebase Console setup. For example, Apple Sign In needs Apple Developer configuration, and Facebook Login needs Facebook app settings.

6. Enable Firestore

Enable Cloud Firestore in Firebase Console.

Apps that read feeds, products, bookings, listings, orders, chats, users, or profiles usually need Firestore collections. If the release includes seed data, import it after Firestore is enabled.

If the app reports a missing index, create the index from the Firebase Console link in the error or deploy firestore.indexes.json if the app includes it.

7. Enable Firebase Storage

Enable Firebase Storage when the app uploads or displays user media, such as:

  • profile photos;
  • post images;
  • chat attachments;
  • product photos;
  • listing photos;
  • videos.

Upload failures are often caused by missing Storage rules, missing config files, disabled Storage, or backend processing that has not been deployed.

8. Deploy Rules, Indexes, and Functions

Some app packages include a firebase/ folder with files such as:

firebase/
functions/
firestore.rules
storage.rules
firestore.indexes.json

Install the Firebase CLI and log in:

firebase login

Select your Firebase project from the app's Firebase folder:

firebase use --add

Deploy what the app package includes:

firebase deploy --only firestore:rules
firebase deploy --only firestore:indexes
firebase deploy --only storage
firebase deploy --only functions

Do not deploy demo rules blindly to production. Review rules and backend functions against your own data model and security requirements.

9. Spark vs Blaze Plan

Firebase has plan limits. Some features work during local testing on the free plan, while production apps or backend-heavy flows may require billing.

FeatureNotes
AuthUsually works for common providers, but provider-specific limits can apply.
FirestoreWorks within quota; production apps should monitor reads and writes.
StorageWorks within quota; media-heavy apps should monitor bandwidth and storage.
FunctionsBackend calls, media processing, payments, AI, and third-party APIs may require billing depending on the service and runtime needs.
Third-party APIsOpenAI, Stripe, Twilio, maps, and similar services require their own accounts and keys.

If uploads or Functions fail with generic network/internal errors, check whether the Firebase project plan and third-party services support the flow you are testing.

10. App Check for Production

Firebase App Check helps protect backend resources from unauthorized clients. It is a production hardening step, not a requirement for the first local run.

Add App Check after the app already works with your own Firebase project:

  1. verify Auth, Firestore, Storage, and Functions without App Check enforcement;
  2. register iOS and Android App Check providers in Firebase Console;
  3. add the required native configuration for each platform;
  4. test debug providers or test tokens in development builds;
  5. monitor App Check requests in Firebase Console;
  6. enable enforcement service by service when production traffic is ready.

Do not enable enforcement before your release build can obtain valid App Check tokens. Otherwise, Firestore, Storage, or Functions requests may start failing even though the Firebase config files are correct.

11. Secrets and Environment Variables

Do not place private keys in the React Native app.

Keep these in backend functions or server-side environment configuration:

  • OpenAI keys;
  • Stripe secret keys;
  • Twilio credentials;
  • Firebase service account credentials;
  • private webhook secrets;
  • payment provider signing secrets.

The mobile app can contain public Firebase config files and public client keys required by mobile SDKs. Backend secrets must stay server-side.

Verification Checklist

After configuring Firebase:

  • iOS has your GoogleService-Info.plist;
  • Android has your google-services.json;
  • Auth providers used by the app are enabled;
  • Firestore is enabled;
  • Storage is enabled if media upload is used;
  • rules and indexes are deployed if included;
  • Functions are deployed if included;
  • App Check is planned for production and tested before enforcement;
  • required backend secrets are configured;
  • seed data is imported if the app expects demo data;
  • a new test user appears in Firebase Authentication after sign-up;
  • expected documents appear in Firestore after using the app;
  • media upload writes files to your Storage bucket.

Common Issues

The app still shows demo data

Check that you replaced Firebase config files in the actual app target and rebuilt the app.

Sign-up fails

Check that the required Auth provider is enabled and that the app is using your Firebase config files.

Firestore reads fail with permission denied

Review Firestore rules, user authentication state, document paths, and required fields.

Media upload fails with network request failed

Check Storage is enabled, Storage rules are deployed, the user is authenticated, the selected file URI is valid, and any upload processing Functions are deployed.

Functions return internal errors

Check Firebase Functions logs:

firebase functions:log

Missing secrets, wrong project selection, billing limits, or region mismatch are common causes.

Next Steps