Deploying Your Website with Firebase Hosting
Prerequisites:
- A Gmail Account for Firebase sign-in.
- Node JS for installing Firebase CLI.
- Your static website files ready for deployment.
Step 1: Creating a New Project and a Web Instance in Firebase
- Visit firebase and sign in with your Gmail account.
- Go to the console and create a new project with a name of your choice.
Step 2: Open the Website in an IDE
Open the folder containing your website's files in an IDE (e.g., VS Code).
Step 3: Register App
- Click the "Web" button to create a web instance for your project.
- Provide a name for your website, select 'Also setup Firebase Hosting', and register the app.
Step 4: Add Firebase SDK
Copy the provided code snippet and paste it into your website's home page.
Step 5: Installing Firebase CLI
- After adding the script, go back to Firebase and proceed.
- Run the command
npm install -g firebase-toolsin your terminal to install Firebase CLI.
Step 6: Deploying to Firebase Hosting
- In Firebase, you'll find commands to deploy your website.
- Copy and paste each command in your terminal to execute.
- Start with
firebase loginto authenticate. - Run
firebase initand configure Firebase Hosting for your project: - Choose Hosting: Configure and deploy Firebase Hosting sites.
- Select an existing project.
- Choose your web instance.
- Set your public directory (default is 'public').
- Type 'y' to rewrite URLs to index.html.
- Move your website files to the public directory.
- Finally, run
firebase deployto deploy your website.
Final Thoughts
After the deployment is complete, you'll receive a hosting URL where your website is live.
Comments