The Firebase Hosting emulator provides high-fidelity local emulation of Hosting services, providing much of the functionality found in production Hosting. The Hosting emulator lets you:
- Prototype your static sites and web apps without incurring storage or access charges
- Prototype, test and debug HTTPS functions before deploying to your Hosting site
- Test sites and web apps in containerized, continuous integration workflows.
Choose a Firebase project
The Firebase Local Emulator Suite emulates products for a single Firebase project.
To select the project to use, before you start the emulators, in the CLI run firebase use in your working directory. Or, you can pass the --project flag to each emulator command.
If you’re making quick iterations or you want your app to interact with emulated backend project resources, you can test your Hosting content and config locally. When testing locally, Firebase serves your web app at a locally hosted URL.
- (Optional) By default, your locally hosted app will interact with real, not emulated, project resources (functions, database, rules, etc.). You can instead optionally connect your app to use any emulated project resources that you’ve configured. Learn more: Realtime Database | Cloud Firestore | Cloud Functions
- From the root of your local project directory, run the following command:
firebase emulators:start
- Open your web app at the local URL returned by the CLI (usually
http://localhost:5000). - To update the local URL with changes, refresh your browser.
Test from other local devices
"emulators": {
// ...
"hosting": {
"port": 5000,
"host": "0.0.0.0"
}
}