DEV Community

Cover image for How to Host a Project on Firebase Hosting
Md Sana ullah
Md Sana ullah

Posted on

2

How to Host a Project on Firebase Hosting

Step 1: Install Firebase CLI

  • Open your terminal and install Firebase CLI globally:
npm install -g firebase-tools
Enter fullscreen mode Exit fullscreen mode
  • Verify the installation:
firebase --version
Enter fullscreen mode Exit fullscreen mode

Step 2: Log in to Firebase

  • Log in to your Firebase account:
  1. firebase login

Follow the instructions in your browser to complete the authentication.

Step 3: Initialize Firebase Hosting
Navigate to your project folder:


cd your-project-folder
Enter fullscreen mode Exit fullscreen mode

Initialize Firebase Hosting:

firebase init
Enter fullscreen mode Exit fullscreen mode
  • Follow the prompts:
  1. Select Features: Use arrow keys to select Hosting: Configure files for Firebase Hosting (press space to select, then press enter).
  2. Select Project: Choose an existing Firebase project or create a new one.
  3. Public Directory: Enter the folder containing your built files (e.g., dist or build).
  4. Single-Page App: Choose Yes for "Configure as a single-page app."
  5. Overwrite Files: Choose No if it asks to overwrite index.html. Step 4: Build Your Project If your project requires building (e.g., React or Vue), run:
npm run build
Enter fullscreen mode Exit fullscreen mode

Ensure the output folder (e.g., dist or build) contains the production-ready files.
**
Step 5: Deploy Your Project**
Deploy the project to Firebase Hosting:

firebase deploy
Enter fullscreen mode Exit fullscreen mode
  • Once deployed, Firebase will provide a live URL for your project. Step 6: Update and Redeploy

Make changes to your project locally.
Build your project again:

**

npm run build
Enter fullscreen mode Exit fullscreen mode

**

  • Deploy the updated project:
firebase deploy
Enter fullscreen mode Exit fullscreen mode

Step 7: Debugging Common Issues

Incorrect Public Directory: Ensure the folder specified during initialization contains your index.html.
Cache Issues: Clear your browser cache and hard reload the page.
Error Logs: Check deployment logs in the terminal for debugging.
Congratulations! Your project is now live on Firebase Hosting. πŸŽ‰

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo πŸ“Šβœ¨

Top comments (0)

Image of DataStax

AI Agents Made Easy with Langflow

Connect models, vector stores, memory and other AI building blocks with the click of a button to build and deploy AI-powered agents.

Get started for free

πŸ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay