Deploy to Firebase Hosting
After you have the Hello Doctor Web app running locally, you can deploy it to Firebase Hosting so it is available on the web. This page walks you through building the React app and publishing it to Firebase.
Prerequisites
Before starting, you need:
- Firebase CLI installed and logged in. If you have not done this yet, run:
npm install -g firebase-tools
Then log in:
firebase login
- The Hello Doctor Web project set up with dependencies installed (
npm installalready run) and environment configured (.envwith Firebase credentials).
Step 1: Build the project
Open a terminal in the root of the Hello Doctor Web project and create a production build:
npm run build
The build output is usually written to a folder such as dist (Vite) or build (Create React App). Check your project’s package.json or build config to see which folder is used—you will need it for the next step.
If your project uses a different build command (e.g. npm run build:prod), run that instead. The important part is that you have a static output folder ready for hosting.
Step 2: Initialize Firebase Hosting
In the same project root, run:
firebase init
- Use the arrow keys to select Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys, then press Enter.
- When asked to choose a Firebase project, select your existing Hello Doctor project.
- When asked for the public directory, enter the folder where the build output was written:
- If the build output is in
dist, enter:dist - If the build output is in
build, enter:build
- If the build output is in
- When asked Configure as a single-page app (rewrite all urls to /index.html)?, choose Yes if your app is a client-side React app (recommended for most React setups).
- If asked about overwriting files (e.g.
index.html), choose No so your built app is not replaced. - Finish the prompts. Firebase will create (or update)
firebase.jsonand.firebasercin your project.
Step 3: Deploy
Deploy the app to Firebase Hosting:
firebase deploy
When the deploy finishes, the terminal will show your Hosting URL (e.g. https://your-project-id.web.app). Open that URL in a browser to use the deployed Hello Doctor Web app.
Next steps
- To redeploy after making changes, run
npm run buildagain, thenfirebase deploy. - You can set up a custom domain or GitHub Actions for automatic deploys from the Firebase Console under your project’s Hosting settings.