What's new
NoobsPlanet

Join our community today and enjoy an ad-free experience. Ask questions or learn about anything related to technology!

How to Set Up a Firebase Project Using the Firebase CLI

Nikesh

Administrator
Staff member
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:

Code:
npm install -g firebase-tools
Verify the installation:

Code:
firebase --version
Step 2: Log In to Firebase
Authenticate your CLI with your Firebase account:

Code:
firebase login
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:

Code:
firebase projects:create your-project-name
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:

Code:
firebase init
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 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
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!
 
Top