Skip to content

Full Stack Development

Kimin Kim edited this page Feb 4, 2026 · 3 revisions

Local Development

We use Docker and Docker Compose V2 to run the app locally using containers. To build and run the full app with a snapshot of the dev database:

yarn compose up --build

or

yarn dev:up
  • Firebase emulators run functions code and a local Firestore instance, seeded with a snapshot of the development environment
  • A Typesense container runs local search
  • A Next.js container builds and serves the frontend with hot-reload
  • A Typescript container watches the functions directory and rebuilds on save

Docker Services

firebase

  • Purpose: Runs the Firebase emulators for Functions, Firestore, Auth, and Storage.
  • Details:
    • Executes your Cloud Functions code locally.
    • Provides a local Firestore instance, seeded with a snapshot of the development database for testing.
    • Shares the project directory with other containers for live code updates.
    • Health check ensures the emulators are ready before dependent services start.

search

  • Purpose: Runs a local Typesense search engine.
  • Details:
    • Provides full-text search capabilities for bills, hearings, and testimonies.
    • Use the API key test-api-key for local access.
    • Data is persisted in a Docker volume so your search collections survive container restarts.
    • Health check ensures Typesense is available before dependent services start.

next

  • Purpose: Builds and serves the Next.js frontend with hot-reload.
  • Details:
    • Watches for code changes and instantly reloads the frontend.
    • Connects to the local Firebase emulators and Typesense container

fn-builder

  • Purpose: Watches the /functions directory and rebuilds Cloud Functions automatically on save.
  • Details:
    • Ensures your local Cloud Functions code is always up-to-date without manual rebuilds.

search-backfill

  • Purpose: One-time run that populates Typesense collections for bills, hearings, and testimonies.
  • Details:
    • Runs the backfill script (yarn dev:backfill) after both Firebase and Typesense are healthy.
      • This calls pub/sub function checkSearchIndexVersion, which will compare the schema on the dev/local environment, based on env variables and update them if necessary
    • Reads from the local Firestore emulator and writes to the local Typesense instance.
    • Ensures your search collections are populated with realistic data for development and testing.

CLI Tools

  • yarn typesense-admin -e local console starts a node console with a client global for the local environment.
  • yarn firebase-admin -e local console starts a node console with firebase, db, auth, admin, and api (MA Legislature API) globals for the local environment.

Clone this wiki locally