npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

firebase-dataconnect-bootstrap

v1.2.1

Published

Bootstrap Firebase Data Connect and Firestore onDocumentWritten function setup in any repository.

Readme

firebase-dataconnect-bootstrap

Firebase Data Connect と Cloud Functions のセットアップを自動化する CLI です。
初期作成だけでなく、再実行で設定変更(途中更新)もできます。

できること

  • .firebasercfirebase.json の生成/更新
  • dataconnect/ 初期ファイル生成
  • functions/ 未初期化時の最小構成作成
  • Firestore onDocumentWritten の生成/更新
  • ベクトル検索用 onRequest 関数の生成/更新
  • 埋め込み実装差し替え用 vectorSearchEmbedding テンプレート生成
  • 前回設定を .firebase-dataconnect-bootstrap.json に保存し、次回実行時に再利用

使い方

npx firebase-dataconnect-bootstrap

対話モードは日本語で質問が表示されます。
同じリポジトリで再実行すると、保存済み設定を初期値として設定変更できます。
既存設定がある場合は、対話中に「新しいコレクション設定を追加するか」を選べます。

追加コレクションを非対話で追加する例

npx firebase-dataconnect-bootstrap \
  --yes \
  --add-collection \
  --target . \
  --project your-firebase-project-id \
  --document 'articles/{articleId}' \
  --function onArticlesWritten \
  --vector-search \
  --vector-collection 'articles' \
  --source-text-field 'body' \
  --vector-field 'embedding' \
  --search-fields 'title,body,updatedAt' \
  --search-function 'searchArticlesByVector' \
  --top-k 8 \
  --no-install

非対話モード例

npx firebase-dataconnect-bootstrap \
  --yes \
  --target . \
  --project your-firebase-project-id \
  --region asia-northeast1 \
  --service your-service-id \
  --location asia-northeast1 \
  --document 'meetingSummaries/{summaryId}' \
  --function onMeetingSummaryWritten \
  --vector-search \
  --vector-collection 'meetingSummaries' \
  --source-text-field 'summary' \
  --vector-field 'embedding' \
  --search-fields 'title,summary,createdAt' \
  --search-function 'searchByVector' \
  --top-k 5 \
  --install

主なオプション

  • --config <name>: 設定保存ファイル名(既定: .firebase-dataconnect-bootstrap.json
  • --add-collection: 再実行時に既存設定へ新しいコレクション設定を追加
  • --vector-search / --no-vector-search: ベクトル検索 scaffold の有効/無効
  • --vector-collection <path>: 検索対象コレクション
  • --source-text-field <name>: 埋め込み更新対象のテキストフィールド
  • --vector-field <name>: ベクトル保存フィールド
  • --search-fields <csv>: 検索結果として返すフィールド
  • --search-function <name>: 生成する onRequest 関数名
  • --top-k <number>: 検索時のデフォルト上位件数

生成される主な関数(コレクションごと)

  • onDocumentWritten_<functionName>.*
    • sourceTextField の内容を embedText に渡し、vectorField へ保存
  • vectorSearchOnRequest_<searchFunctionName>.*
    • HTTP リクエストの vector(または query)でコサイン類似度検索
  • vectorSearchEmbedding_<functionName>.*
    • embedText を実装する差し替えポイント(デフォルトは null を返す)

npm モジュールとして検索クライアントを使う

import { createVectorSearchClient } from "firebase-dataconnect-bootstrap/search-client";

const client = createVectorSearchClient({
  endpoint: "https://<region>-<project>.cloudfunctions.net/searchByVector"
});

const result = await client.search({
  query: "議事録の要点",
  topK: 5
});

query を使う場合は、Functions 側 vectorSearchEmbedding.*embedText 実装が必要です。
vector を直接渡す場合は embedText が未実装でも検索できます。