0
0
Firebasecloud~10 mins

Hosting setup and deployment in Firebase - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Hosting setup and deployment
Install Firebase CLI
Login to Firebase
Initialize Hosting
Build Project Files
Deploy to Firebase Hosting
Access Website URL
This flow shows the steps to set up and deploy a website using Firebase Hosting from installation to accessing the live site.
Execution Sample
Firebase
npm install -g firebase-tools
firebase login
firebase init hosting
npm run build
firebase deploy --only hosting
These commands install tools, log in, initialize hosting, build files, and deploy the site to Firebase Hosting.
Process Table
StepCommandActionResult
1npm install -g firebase-toolsInstall Firebase CLI globallyFirebase CLI installed
2firebase loginAuthenticate user with FirebaseUser logged in successfully
3firebase init hostingSet up hosting config filesfirebase.json and public folder created
4npm run buildBuild project files for deploymentCompiled files ready in 'build' or 'public' folder
5firebase deploy --only hostingUpload files to Firebase HostingSite deployed and live URL provided
6Access website URLOpen deployed site in browserWebsite loads from Firebase Hosting
💡 Deployment complete, site is live and accessible
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
Firebase CLINot installedInstalledInstalledInstalledInstalledInstalledInstalled
User Login StatusLogged outLogged outLogged inLogged inLogged inLogged inLogged in
Hosting ConfigNoneNoneNoneInitializedInitializedInitializedInitialized
Build FilesNoneNoneNoneNoneBuiltBuiltBuilt
Deployment StatusNot deployedNot deployedNot deployedNot deployedNot deployedDeployedDeployed
Key Moments - 3 Insights
Why do we need to run 'firebase init hosting' before deploying?
Because 'firebase init hosting' creates the configuration files and folder structure needed for Firebase to know what to deploy, as shown in step 3 of the execution_table.
What happens if you try to deploy without building your project files?
The deployment will upload no or incomplete files, so the site won't work properly. Step 4 shows building files is necessary before deployment in step 5.
Why must you login with 'firebase login' before deploying?
Firebase needs to verify your identity to allow deployment. Step 2 shows login is required before initialization and deployment.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the result after running 'firebase init hosting'?
Afirebase.json and public folder created
BUser logged in successfully
CSite deployed and live URL provided
DCompiled files ready in 'build' or 'public' folder
💡 Hint
Check step 3 in the execution_table for the result of 'firebase init hosting'
At which step does the deployment status change to 'Deployed'?
AStep 4
BStep 2
CStep 5
DStep 3
💡 Hint
Look at the variable_tracker row 'Deployment Status' and see when it changes
If you skip 'npm run build', what will be the likely result in the deployment?
ADeployment will succeed with all files
BNo files or incomplete files will be deployed
CFirebase CLI will not be installed
DUser will not be logged in
💡 Hint
Refer to key_moments explanation about building files before deployment
Concept Snapshot
Firebase Hosting Setup & Deployment:
1. Install Firebase CLI globally.
2. Login with 'firebase login'.
3. Initialize hosting with 'firebase init hosting' to create config.
4. Build your project files (e.g., 'npm run build').
5. Deploy with 'firebase deploy --only hosting'.
6. Access your live site URL.
Full Transcript
This visual execution shows how to set up and deploy a website using Firebase Hosting. First, you install the Firebase CLI tool globally on your computer. Then, you log in to your Firebase account to authenticate. Next, you initialize hosting which creates the necessary configuration files and folders. After that, you build your project files so they are ready for deployment. Then, you deploy only the hosting part to Firebase, which uploads your files and makes your site live. Finally, you can open the provided URL to see your website hosted on Firebase. Each step updates the state of your tools, login status, configuration, build files, and deployment status. Key moments include understanding why initialization and building are necessary before deployment.