Setting up Firebase through the CLI is fast and efficient, especially when working with Flutter or other modern frameworks. Let’s get your Firebase project up and running step by step.
Step 1: Install the Firebase CLI
First, make sure you have Node.js installed. Then, install the Firebase CLI globally:
Verify the installation:
Step 2: Log In to Firebase
Authenticate your CLI with your Firebase account:
A browser window will open asking for permissions — approve it, and your CLI will be linked to your Firebase account.
Step 3: Create a New Firebase Project
Run the following command to create a new project:
Follow the prompts and choose a unique project name. Firebase will take care of setting up the backend.
Step 4: Set Up Firebase in Your Flutter App
Inside your Flutter project directory, initialize Firebase:
Select the services you want (like Firestore, Authentication, Hosting, etc.). When asked, choose your newly created project.
Step 5: Configure Platforms
For Android, iOS, and web, you’ll need to add Firebase configuration files:
- For Android: Add
- For iOS: Add
- For Web: Copy your config into
Step 6: Verify Setup
To confirm everything works, deploy a test service:
You should see a success message and be able to manage your project from the Firebase Console.
Wrapping Up
Using the Firebase CLI makes it easy to create and manage Firebase projects. From here, you can set up App Check, Firestore, Authentication, and more for your Flutter app. Happy coding!
Step 1: Install the Firebase CLI
First, make sure you have Node.js installed. Then, install the Firebase CLI globally:
Code:
npm install -g firebase-tools
Code:
firebase --version
Authenticate your CLI with your Firebase account:
Code:
firebase login
Step 3: Create a New Firebase Project
Run the following command to create a new project:
Code:
firebase projects:create your-project-name
Step 4: Set Up Firebase in Your Flutter App
Inside your Flutter project directory, initialize Firebase:
Code:
firebase init
Step 5: Configure Platforms
For Android, iOS, and web, you’ll need to add Firebase configuration files:
- For Android: Add
google-services.json
to android/app
.- For iOS: Add
GoogleService-Info.plist
to ios/Runner
.- For Web: Copy your config into
web/index.html
or your main.dart
setup.Step 6: Verify Setup
To confirm everything works, deploy a test service:
Code:
firebase deploy
Wrapping Up
Using the Firebase CLI makes it easy to create and manage Firebase projects. From here, you can set up App Check, Firestore, Authentication, and more for your Flutter app. Happy coding!