Top Related Projects
Firebase Quickstart Samples for Android
Firebase Quickstart Samples for iOS
👾 Clean and minimalist React Native template for a quick start with TypeScript.
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
Quick Overview
The invertase/react-native-firebase-starter is a template project for React Native applications that integrates Firebase services. It provides a pre-configured setup for developers to quickly start building cross-platform mobile apps with Firebase functionality, including authentication, real-time database, cloud functions, and more.
Pros
- Quick setup for React Native projects with Firebase integration
- Includes pre-configured Firebase services and example usage
- Regularly updated to support the latest versions of React Native and Firebase
- Comprehensive documentation and community support
Cons
- May include unnecessary dependencies for projects that don't need all Firebase services
- Requires some Firebase knowledge to fully utilize the template
- Potential learning curve for developers new to React Native or Firebase
- May need customization for specific project requirements
Code Examples
- Firebase Authentication:
import auth from '@react-native-firebase/auth';
const signIn = async (email, password) => {
try {
await auth().signInWithEmailAndPassword(email, password);
console.log('User signed in successfully');
} catch (error) {
console.error('Sign-in error:', error);
}
};
- Firestore Database Operations:
import firestore from '@react-native-firebase/firestore';
const addUser = async (userData) => {
try {
await firestore().collection('users').add(userData);
console.log('User added to Firestore');
} catch (error) {
console.error('Error adding user:', error);
}
};
- Cloud Messaging:
import messaging from '@react-native-firebase/messaging';
const requestUserPermission = async () => {
const authStatus = await messaging().requestPermission();
const enabled =
authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
authStatus === messaging.AuthorizationStatus.PROVISIONAL;
if (enabled) {
console.log('Authorization status:', authStatus);
}
};
Getting Started
-
Clone the repository:
git clone https://github.com/invertase/react-native-firebase-starter.git
-
Install dependencies:
cd react-native-firebase-starter yarn install
-
Set up Firebase:
- Create a new Firebase project in the Firebase Console
- Download the
google-services.json
(Android) andGoogleService-Info.plist
(iOS) files - Place these files in the appropriate directories in your project
-
Run the app:
npx react-native run-android # or npx react-native run-ios
Competitor Comparisons
Firebase Quickstart Samples for Android
Pros of quickstart-android
- Native Android development, potentially better performance
- Direct access to Android-specific features and APIs
- Comprehensive examples covering various Firebase services
Cons of quickstart-android
- Limited to Android platform, not cross-platform like react-native-firebase-starter
- Steeper learning curve for developers not familiar with native Android development
- May require more boilerplate code compared to React Native
Code Comparison
quickstart-android (Java):
FirebaseAuth mAuth = FirebaseAuth.getInstance();
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success
} else {
// Sign in failed
}
}
});
react-native-firebase-starter (JavaScript):
import auth from '@react-native-firebase/auth';
auth()
.signInWithEmailAndPassword(email, password)
.then(() => {
console.log('User signed in!');
})
.catch(error => {
console.error(error);
});
The quickstart-android example uses Java and Android-specific APIs, while react-native-firebase-starter uses JavaScript and React Native Firebase, offering a more familiar syntax for web developers and cross-platform compatibility.
Firebase Quickstart Samples for iOS
Pros of quickstart-ios
- Native iOS development, potentially better performance and deeper iOS integration
- Direct access to Firebase iOS SDK features without abstraction layers
- Comprehensive examples covering multiple Firebase services in a single repository
Cons of quickstart-ios
- Limited to iOS platform, not cross-platform like React Native
- Steeper learning curve for developers not familiar with Swift or Objective-C
- May require more code for custom UI components compared to React Native's declarative approach
Code Comparison
quickstart-ios (Swift):
import Firebase
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
}
react-native-firebase-starter (JavaScript):
import { firebase } from '@react-native-firebase/app';
function App() {
useEffect(() => {
firebase.initializeApp();
}, []);
return (
// App components
);
}
The quickstart-ios example shows native iOS Firebase initialization, while react-native-firebase-starter demonstrates a React Native approach. The iOS version is more tightly integrated with the platform, but the React Native version offers cross-platform compatibility and a more familiar JavaScript syntax for web developers.
👾 Clean and minimalist React Native template for a quick start with TypeScript.
Pros of react-native-template-typescript
- Focuses on TypeScript integration, providing a solid foundation for type-safe React Native development
- Maintained by the React Native community, ensuring regular updates and compatibility with the latest React Native versions
- Lightweight and minimal, allowing developers to add only the dependencies they need
Cons of react-native-template-typescript
- Lacks pre-configured Firebase integration, requiring additional setup for Firebase-based projects
- Does not include example components or screens, which may be helpful for beginners
- Requires more initial configuration for common features like navigation and state management
Code Comparison
react-native-template-typescript:
import React from 'react';
import { View, Text } from 'react-native';
const App = () => {
return (
<View>
<Text>Hello, TypeScript!</Text>
</View>
);
};
react-native-firebase-starter:
import React from 'react';
import { View, Text } from 'react-native';
import firebase from '@react-native-firebase/app';
const App = () => {
return (
<View>
<Text>Hello, Firebase!</Text>
</View>
);
};
The main difference in the code examples is the inclusion of Firebase import in the react-native-firebase-starter template, showcasing its pre-configured Firebase setup.
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!
Pros of Ignite
- More comprehensive boilerplate with a full-featured app structure
- Includes a CLI for generating components, screens, and other project elements
- Offers a wider range of pre-configured tools and libraries
Cons of Ignite
- Steeper learning curve due to its opinionated structure and additional features
- May include unnecessary components for simpler projects
- Requires more setup and configuration for Firebase integration
Code Comparison
Ignite component generation:
ignite generate component MyComponent
react-native-firebase-starter Firebase initialization:
import firebase from '@react-native-firebase/app';
const firebaseConfig = {
// Your Firebase configuration
};
if (!firebase.apps.length) {
firebase.initializeApp(firebaseConfig);
}
Summary
Ignite provides a more feature-rich starting point for React Native projects, offering a CLI and pre-configured tools. However, it may be overkill for simpler apps and requires additional setup for Firebase integration. react-native-firebase-starter focuses specifically on Firebase integration, making it more straightforward for projects centered around Firebase services but less comprehensive in terms of overall app structure and tooling.
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
Pros of Expo
- Simplified development workflow with a managed environment
- Extensive library of pre-built components and APIs
- Easier deployment and over-the-air updates
Cons of Expo
- Limited access to native modules and custom native code
- Larger app size due to included libraries
- Potential performance overhead in complex applications
Code Comparison
React Native Firebase Starter:
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/auth';
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
Expo:
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
Key Differences
- React Native Firebase Starter provides direct integration with Firebase, while Expo uses the web SDK
- Expo offers a more abstracted approach to Firebase integration
- React Native Firebase Starter allows for more granular control over Firebase modules
Use Cases
- Choose Expo for rapid prototyping and simpler projects
- Opt for React Native Firebase Starter when deep Firebase integration and native module access are required
Community and Support
- Expo has a larger community and more extensive documentation
- React Native Firebase Starter is more focused on Firebase-specific implementations
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
DEPRECATED
DEPRECATED: This is for RNFB v5 only. For v6 onwards please follow the new projects guide.
React Native Firebase Starter
A basic react native app with react-native-firebase
pre-integrated to get you started quickly.
DEPRECATED
DEPRECATED: This is for RNFB v5 only. For v6 onwards please follow the new projects guide.
Getting Started
If you're only developing for one platform you can ignore the steps below that are tagged with the platform you don't require.
1) Clone & Install Dependencies
- 1.1)
git clone https://github.com/invertase/react-native-firebase-starter.git
- 1.2)
cd react-native-firebase-starter
- cd into your newly created project directory. - 1.3) Install NPM packages with your package manager of choice - i.e run
yarn
ornpm install
2) Rename Project
You will need to be running Node version 7.6 or greater for the rename functionality to work
- 2.1)
npm run rename
- you'll be prompted to enter a project name and company name - 2.2) Note down the package name value - you'll need this when setting up your Firebase project
3) [iOS] Install Pods RN < 0.60.0
- 3.1)
cd ios
and runpod install
- if you don't have CocoaPods you can follow these instructions to install it.
4) Add Google Services
files (plist & JSON)
- 4.1) [iOS] Follow the
add firebase to your app
instructions here to generate yourGoogleService-Info.plist
file if you haven't done so already - use the package name generated previously as youriOS bundle ID
. - 4.2) [iOS] Place this file in the
ios/
directory of your project.- Once added to the directory, add the file to your Xcode project using 'File > Add Files to "[YOUR APP NAME]"â¦' and selecting the plist file.
- 4.3) [Android] Follow the
manually add firebase
to your app instructions here to generate yourgoogle-services.json
file if you haven't done so already - use the package name generated previously as yourAndroid package name
. - 4.4) [Android] Place this file in the
android/app/
directory of your project.
5) AdMob Setup (Or Removal)
- 5.1) React Native Firebase Starter kit comes with AdMob pre-install. The default Sample AdMob App ID is used in both the
info.plist
[iOS] and theAndroidManifest.xml
[Android] files. If you don't want to use AdMob, just remove it. If you do, be sure to update your ID! - 5.2) [iOS] Remove or change in
info.plist
by editing theGADApplicationIdentifier
key string. - 5.3) [Android] Remove or change in
AndroidManifest.xml
by modifying the content of<meta-data />
tag within the<application />
tag. - 5.4) More instrucation can be found here.
6) Start your app
- 6.1) Start the react native packager, run
yarn run start
ornpm start
from the root of your project. - 6.2) [iOS] Build and run the iOS app, run
npm run ios
oryarn run ios
from the root of your project. The first build will take some time. This will automatically start up a simulator also for you on a successful build if one wasn't already started. - 6.3) [Android] If you haven't already got an android device attached/emulator running then you'll need to get one running (make sure the emulator is with Google Play / APIs). When ready run
npm run android
oryarn run android
from the root of your project.
If all has gone well you'll see an initial screen like the one below.
Screenshots
Contributors
This project exists thanks to all the people who contribute. [Contribute].
Backers
Thank you to all our backers! ð [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
License
- See LICENSE
Top Related Projects
Firebase Quickstart Samples for Android
Firebase Quickstart Samples for iOS
👾 Clean and minimalist React Native template for a quick start with TypeScript.
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot