Firebase を使ってアプリ開発をする際、ローカル開発環境では、Firebase Emulator Suite を利用するのが便利そうだったので、試してみた。
実行環境
macOS Sequoia 15.0.1
Homebrew 4.4.12
セットアップ手順
まずは、Firebase のプロジェクトを作成する(作成手順は省略)
Firebase プロジェクト作成後、
mac のターミナルを起動し、firebase の初期設定を行う
firebase init
Firestore Emulator を使いたかったので、Firestore Emulator を選択し、それ以外はデフォルトを選択した。
=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices.
Firestore Emulator
? Which port do you want to use for the firestore emulator? 8080
? Would you like to enable the Emulator UI? Yes
? Which port do you want to use for the Emulator UI (leave empty to use any available port)?
? Would you like to download the emulators now? Yes
i firestore: downloading cloud-firestore-emulator-v1.19.8.jar...
Progress: =================================================================================================> (100% of 64MB
i ui: downloading ui-v1.14.0.zip...
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
✔ Firebase initialization complete!
Emutator を起動する
firebase emulators:start
正常に起動した。
http://127.0.0.1:4000/ にアクセスすると、以下の画面が表示された。
Firestore emulator だけ Status が On になっていることを確認