Firebase CLI provides comprehensive local development tools including a development server and emulator setup utilities.
Start a local server for static assets and development.
/**
* Start a local server for static assets and development
* @param options - Configuration options
* @returns Promise resolving when server starts
*/
function serve(options?: Options & {
/** Port to listen on (default: 5000) */
port?: number;
/** Host to listen on (default: localhost) */
host?: string;
/** Comma-separated list of targets to serve */
only?: string;
}): Promise<void>;Set up individual Firebase emulators for local development.
/**
* Set up Realtime Database emulator
* @param options - Configuration options
* @returns Promise resolving when setup completes
*/
function setupEmulatorsDatabase(options?: Options): Promise<void>;
/**
* Set up Firestore emulator
* @param options - Configuration options
* @returns Promise resolving when setup completes
*/
function setupEmulatorsFirestore(options?: Options): Promise<void>;
/**
* Set up Pub/Sub emulator
* @param options - Configuration options
* @returns Promise resolving when setup completes
*/
function setupEmulatorsPubsub(options?: Options): Promise<void>;
/**
* Set up Storage emulator
* @param options - Configuration options
* @returns Promise resolving when setup completes
*/
function setupEmulatorsStorage(options?: Options): Promise<void>;
/**
* Set up Emulator UI
* @param options - Configuration options
* @returns Promise resolving when setup completes
*/
function setupEmulatorsUi(options?: Options): Promise<void>;
/**
* Set up Data Connect emulator
* @param options - Configuration options
* @returns Promise resolving when setup completes
*/
function setupEmulatorsDataconnect(options?: Options): Promise<void>;import * as client from "firebase-tools";
// Start development server with default settings
await client.serve({
project: "my-project"
});
// Start server on custom port and host
await client.serve({
project: "my-project",
port: 8080,
host: "0.0.0.0"
});
// Serve only specific targets
await client.serve({
project: "my-project",
port: 3000,
only: "hosting,functions"
});// Set up individual emulators
await client.setup.emulators.database({
project: "my-project"
});
await client.setup.emulators.firestore({
project: "my-project"
});
await client.setup.emulators.storage({
project: "my-project"
});
// Set up Emulator UI
await client.setup.emulators.ui({
project: "my-project"
});# Start development server with defaults
firebase serve
# Custom port and host
firebase serve --port=8080 --host=0.0.0.0
# Serve specific targets only
firebase serve --only=hosting,functions --port=3000# Set up individual emulators
firebase setup:emulators:database
firebase setup:emulators:firestore
firebase setup:emulators:storage
firebase setup:emulators:pubsub
firebase setup:emulators:ui
firebase setup:emulators:dataconnectThe serve command supports the following targets:
Development server behavior is configured through:
--host=0.0.0.0 to allow external connections to the development server