Introduction
Firebase is a mobile and web application development platform. It is owned by Google. Firebase provides below services/features -
Services/Features
- Analytics
- Authentication
- Database
- Storage
- Hosting
- Functions (Cloud functions)
- Test Lab
- Crash Reporting
- Performance
- Notifications (Firebase Cloud Messaging - FCM)
- Remote configs
- Dynamic Links
- AdMob
Lets take a look on “Hosting” service provided by firebase.
Hosting
Firebase Hosting is very easy to use and anyone can deploy and see a static website working in 4 simple steps - Login to firebase, Add project, Initialize project and Deploy.
Login to firebase
-
Go to https://firebase.google.com and Sign-In with your GMail Account.
-
Go to Firebase console
Add Project
-
Click “Add Project”
-
Enter Project Name e.g. “MyFirstWebsite” and Country/Region e.g. “India”
-
And then “Create Project” button
Initialize project
-
Install Firebase CLI, Firebase CLI depends upon
Node.j
andnpm
. Install Nodejs which comes withnpm
. So, no need to installnpm
separately. Then firebase CLI, open command line interface/terminal of your OS and type -$ npm install -g firebase-tools
-
Initialize your website.
cd
to your local website project and type$ firebase init
select type to “hosting”, press space and enter. select project “MyFirstWebsite” which you created on firebase and enter.
Deploy website
-
firebase init
will create few files and directory in your project directory e.g.firebase.json
andpublic
. -
Move all your website files(
index.html
,css
,js
etc) topublic
directory available at root of your website project directory. -
At last in terminal type -
$ firebase deploy
-
As soon as your code deploys you will see a sub-domain created for your website with firebase.com domain, may be something link ->
myfirstwebsite.firebase.com
. -
If you want your own personal site and you can buy any domain and can always link that domain with your firebase project.