Firenook 用 Rust 重写 Firebase 模拟器 写入快 40 倍

原标题:Show HN: Firenook – Firebase emulators in Rust: 40× faster writes, 10× less RAM
62AI 研判分

Firenook 是 Firebase Local Emulator Suite 的 Rust 重写版,保持 firebase.json、SDK 与端口不变,只需改动脚本中的一个词即可切换,且无需安装 Java、数据可跨重启保留。作者给出的基准显示写入中位数 5.1 ms 对 208.2 ms(约 40 倍),峰值内存 2.11 GiB 对 22.57 GiB(约 10 倍),带数据重启 0.59 秒对 30.8 秒。项目已内部试用一个月后开源,当前版本 0.2.0。

报道正文

本文目录19 个章节

A faster drop-in replacement for the Firebase Local Emulator Suite

Keep your firebase.json, SDKs and ports, and change one word in your script. No Java to install, and your data survives restarts.

$npm install --save-dev firenookGet started40×faster writes5.1 ms against 208.2 ms, median10×less memory2.11 GiB against 22.57 GiB at peak0.59 sto restart with your dataagainst 30.8 sdemo-shoprecorded from firenook 0.2.0

文本
  ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮
  │                                                                                                      │
  │       ▄█                                                                                             │
  │    ▄███▀ ▄     firenook  0.2.0                                                                       │
  │  ▄███▀ ███▄    demo-shop · picking up the data saved just now                                        │
  │  ▀██▀ ███▀     Node 24.20.0 · data in .firenook/state                                                │
  │      █▀▀                                                                                             │
  │                                                                                                      │
  ├─ Start-up ────────────────────────────────────────────────────────────────────────────────── 796 ms ─┤
  │                                                                                                      │
  │  Firestore   ✓ 255 ms  1,207,802 documents                                                           │
  │  Auth        ✓ 255 ms  64,000 users                                                                  │
  │  Storage     ✓ 255 ms  5,400 objects                                                                 │
  │  Functions   ✓ 423 ms  4 functions                                                                   │
  │  Pub/Sub     ✓   0 ms  1 schedule                                                                    │
  │                                                                                                      │
  ├─ ✓ All emulators ready ──────────────────────────────────────────────────────────────────────────────┤
  │                                                                                                      │
  │  Console       http://127.0.0.1:4000/console                                                         │
  │  Ports         Firestore 8080   Auth 9099   Storage 9199   Functions 5001   Pub/Sub 8085   Hub 4400  │
  │                                                                                                      │
  ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯

── Logs ────────────────────────────────────────────────────────────────────────────────────────────────

21:05:40    ✓ checkout        117 ms  http · POST / · 201
     21:05:40    ✓ sendReceipt       6 ms  firestore · orders/qXoV1oOgJ0IILQs5psZP created
                 │ receipt queued   order qXoV1oOgJ0IILQs5psZP · total 36
     21:05:42    ✓ checkout          4 ms  http · POST / · 201
     21:05:42    ✓ sendReceipt       1 ms  firestore · orders/ZskDC6u3kTKSGalf4o5L created
                 │ receipt queued   order ZskDC6u3kTKSGalf4o5L · total 32
     21:05:43    ✕ stripeWebhook     1 ms  http · POST / · 500
                 │ Unhandled error Error: No signatures found matching the expected signature for payload
                 │   at functions/index.js:24:11
                 │ + 9 more lines · open in console

────────────────────────────────────────────────────────────────────────────────────────────────────────
     ● running 6s · 5 calls · 1 failed                              o console   r reload   ? keys   q quit
文本
  ╭────────────────────────────────────────────────────────────╮
  │                                                            │
  │       ▄█                                                   │
  │    ▄███▀ ▄     firenook  0.2.0                             │
  │  ▄███▀ ███▄    demo-shop · picking up the data saved jus…  │
  │  ▀██▀ ███▀     Node 24.20.0 · data in .firenook/state      │
  │      █▀▀                                                   │
  │                                                            │
  ├─ Start-up ──────────────────────────────────────── 602 ms ─┤
  │                                                            │
  │  Firestore   ✓ 240 ms  1,207,804 documents                 │
  │  Auth        ✓ 240 ms  64,000 users                        │
  │  Storage     ✓ 240 ms  5,400 objects                       │
  │  Functions   ✓ 299 ms  4 functions                         │
  │  Pub/Sub     ✓   0 ms  1 schedule                          │
  │                                                            │
  ├─ ✓ All emulators ready ────────────────────────────────────┤
  │                                                            │
  │  Console       http://127.0.0.1:4000/console               │
  │  Ports         Firestore 8080   Auth 9099   Storage 9199   │
  │                Functions 5001   Pub/Sub 8085   Hub 4400    │
  │                                                            │
  ╰────────────────────────────────────────────────────────────╯

── Logs ──────────────────────────────────────────────────────

21:05:49    ✓ checkout        115 ms  http · POST / · 201
     21:05:49    ✓ sendReceipt       6 ms  firestore · orders/E…
                 │ receipt queued
                 │ order EYi9LKG7xQ53eLrWktHm · total 36
     21:05:50    ✓ checkout          6 ms  http · POST / · 201
     21:05:50    ✓ sendReceipt       2 ms  firestore · orders/C…
                 │ receipt queued
                 │ order CU0LwsLgczq054BqsEuH · total 32
     21:05:51    ✕ stripeWebhook     1 ms  http · POST / · 500
                 │ Unhandled error Error: No signatures found
                 │ matching the expected signature for payload
                 │   at functions/index.js:24:11
                 │ + 9 more lines · open in console

──────────────────────────────────────────────────────────────
     ● running 6s · 5 calls · 1 failed
     o console   r reload   ? keys   q quit
文本
$ npx firebase emulators:start

Firenook’s own screen, recorded from 0.2.0 on a demo shop: it starts with the 1.2 million documents, 64,000 users and 5,400 files it kept from its last run, takes two orders, and shows a webhook that fails, with its stack trace.

Change one word

Same flags, same ports, same export format. Your project stays as it is, and firebase-tools stays for deploying.

package.json

文本
-  "emulators": "firebase emulators:start --import ./data"+  "emulators": "firenook emulators:start --import ./data"
  • firebase.json and .firebaserc

Read the way the Firebase CLI reads them.

  • Rules, indexes, Functions

Your code and config stay as they are.

  • Your SDKs

connectFirestoreEmulator, FIRESTORE_EMULATOR_HOST and the rest connect unchanged.

  • Your data

Imports and exports the official format, both ways.

Eight emulators, on the ports you already use

Your SDKs connect to them as they connect to Google’s: the same hosts, the same ports, the same environment variables.

Native and web SDKs, realtime listeners, Security Rules, named databases, and the official import and export.

orders12 documents

  • XXfs8ZLaWvmMOeaVAcw8
  • 5XSNbW90qkxiTbqQilu1
  • mqr7wc5Vjb6d5y75tfKy
  • ijO11GokICQ0ki9Ta4p9
  • c0yT9Jkt9NGpiX7HMV9r

createdAt2026-10-23 13:06:17.872 UTCitems[{ price: 54, qty: 1, sku: "hoodie" }, { price: 28, qty: 1, sku: "tee" }]total82

Every operation of the official Auth emulator: password, email link, phone, MFA, passkeys, tenants and blocking functions.

Users12

The Firebase and Cloud Storage APIs, with Security Rules evaluated natively, firestore.get() included.

demo-shop.appspot.com / products8 files

  • cap.svgimage/svg+xml404 B
  • hoodie.svgimage/svg+xml408 B
  • mug.svgimage/svg+xml404 B

HTTP, callable and streaming functions, and every trigger: Firestore, Storage, Auth, Pub/Sub, Eventarc, schedules and task queues. Code reloads on save.

Function calls25

TimeFunctionTriggerSummaryStatusDuration
13:06:19stripeWebhookhttpPOST /5001.1 ms
13:06:18sendReceiptfirestoreorders/mzbnHY1n79leG5ioi2nD created2001.8 ms
13:06:18checkouthttpPOST /2016.3 ms
13:06:18sendReceiptfirestoreorders/c0yT9Jkt9NGpiX7HMV9r created2001.7 ms
13:06:18checkouthttpPOST /2015.0 ms

Every RPC over gRPC and HTTP/JSON: push, ordering, filters, dead-letter topics, seek, snapshots and schemas.

nightlyReport, every day 02:00: next run 2026-10-24 02:00 UTC

Queues for onTaskDispatched, with the official retry and rate-limit behaviour.

Custom events delivered to onCustomEventPublished, and the Firebase services’ own.

Extensions from local, vendored or registry sources, offline once vendored.

The orders, users, files and calls above are from a run of the demo project, as Firenook returned them. Realtime Database, Hosting, App Hosting and Data Connect are not emulated; a firebase.json that configures them still starts, with a warning. What each service covers.

Measured on a real application

Two hours of a production app’s traffic against each emulator in turn, every operation timed by the client.

Memory at peak

10× less

Official22.6 GiBFirenook2.11 GiB

Write, median

40× faster

Official208 msFirenook5.1 ms

Listener update, median

19× faster

Official209 msFirenook11 ms

Restart with data kept

52× sooner

Official30.8 sFirenook0.59 s

orderBy, limit 20

8× faster

Official96.3 msFirenook12.0 ms

CPU over two hours

61% less

Official1,586 sFirenook616 s

The app holds 211,205 Firestore documents and 6.7 GB in Storage; both emulators ran on one server. Firenook answered 25 of 26 query shapes faster and tied on the last. How it was measured.

Your data stays where you left it

Add --keep-data and Firestore, Auth and Storage come back with all your data in about half a second, even with millions of documents. No export at every stop, no import at every start.

A crash loses at most the last second of writes, where the official emulator loses everything since its last export. A stop always closes the data cleanly.

$npx firenook emulators:start --keep-data

Official emulator

Stop: export, 50–57 sStart: import, 21.6–23.6 s

Firenook

Stop, 0.04–0.30 sStart, 0.54–0.57 s

0 s20 s40 s60 s80 sStopping with the data saved, then starting again with it, on one time scale. The dim blocks are the spread between the fastest and the slowest runs.demo-shop7 of its 35 lines

文本
$ npx firenook emulators:exec "node --test checkout.test.mjs"
firenook: Starting emulators: auth, functions, firestore, pubsub, storagefirenook functions: Loaded functions definitions from source: checkout, sendReceipt, stripeWebhook, nightlyReport.All emulators ready✔ checkout takes an order (173.227708ms)ℹ pass 1ℹ fail 0firenook suite stopped cleanly

exit 01.39 s from start to stop, the test includedA run of the demo project’s test through firenook emulators:exec on firenook 0.2.0, with some lines left out.

Run your tests against it

emulators:exec starts the suite, runs your command once everything is ready, with the emulator variables set, then stops and passes on the exit code.

CI gets plain lines, the same ones the official emulator prints, and there is no Java to set up first. Firenook needs only Node 24.

$npx firenook emulators:exec "npm test"

The console the Firebase emulators should have had

Google’s Emulator UI has no page for your Functions, Pub/Sub, Cloud Tasks or Eventarc, only a log. Firenook’s console covers every service it runs, live, on the Emulator UI’s port.

Every call, with what triggered it, its outcome, its duration and its logs.

Every call, with what triggered it, its outcome, its duration and its logs.

The console’s function calls: every call with its time, function, trigger, summary, outcome and duration, one of them a 500

Every service’s health and recent problems, with snapshots and resets a click away.

The console’s Overview: all nine services running, with their ports and counts

Users and their activity, and an inbox of the codes and links Auth would have sent.

Authentication: a list of users with filters, one open with its profile, security and providers

Browse and edit documents, and read the rules that guard them.

Firestore: collections, a page of orders and one order open for editing

Browse and upload files, and read the rules that guard them.

Storage: a folder of product photos shown as a grid of thumbnails

Light and dark, works offline, sends nothing anywhere. Bookmarks to the official UI’s pages open the matching console page. Every page of the console.

Give your agent the emulator, not production

firenook mcp gives a coding agent 54 tools over the running suite. It reads the log and each function call with its error, asks the Security Rules why a request is denied, and works with your data. Nothing leaves your machine.

$npx firenook mcp add

Sets it up for Claude Code, Cursor and VS Code in the project’s own files. Other agents run npx firenook mcp. How agents use it.

firenook mcpdemo-shop

  1. You

The Stripe webhook answers 500 on my machine. Why? 2. functions_list_calls outcome: "failed"

failed500 stripeWebhook http POST /, 1.15 ms at 13:06:19 3. functions_get_call id: "e72ca3-25"

errorError: No signatures found matching the expected signature for payloadatfunctions/index.js:24:11headershost, connection, content-type, accept, accept-language, sec-fetch-mode, user-agent, accept-encoding, content-lengthbody{"type":"checkout.session.completed"} 4. rules_evaluate service: "storage", method: "create", path: "products/mug.svg"

verdictdeny as unauthenticatedline 9allow read, write: if false;

The question is an example. The tool calls and their answers are from a run of the demo project on firenook 0.2.0, as Firenook gave them.FirestoreRead, query, count, write and delete documentsAuthenticationManage users, read sign-in codes, mint ID tokens, set claimsStorageList, read, upload, copy, move and delete filesFunctions and logsInvoke a function, read each call and the log, replay a call after a fixSecurity RulesAsk why a request is denied, test a draft, list denialsPub/Sub, Tasks, EventarcPublish, peek, run tasks and schedules now, replay events

Questions

Something else? Ask on GitHub, or read the docs.

Do I still need firebase-tools?

Yes, for deploying and everything else the Firebase CLI does. Firenook replaces only the emulators: install it next to firebase-tools and run your emulators with it.

Does Firenook need Java?

No. Its services are native code in one npm package, with an engine for macOS, Linux and Windows, and nothing else is downloaded at install or start. Node 22, 24 or 26 runs your Functions, as it does in production.

Can I go back to the official emulator?

Yes. Firenook imports and exports the official format. While Firenook runs, export with npx firenook emulators:export ./export, then start the official emulator with --import ./export.

Which services does it emulate?

Firestore, Authentication, Cloud Storage, Cloud Functions, Extensions, Pub/Sub, Cloud Tasks and Eventarc. Realtime Database, Hosting, App Hosting and Data Connect are not emulated; a firebase.json that configures them still starts, with a warning.

Is it ready for my team?

0.2.0 is the first release for public use. Every release passes conformance replays against the official emulator and packed installs on all five platforms, and Firenook passed a two-hour benchmark against the official emulator on a real application. Commit your lockfile and upgrade on purpose.

Is it free?

Yes. Firenook is open source under the Apache License 2.0.

Is Firenook made by Google?

No. Firenook is an independent open-source project, not affiliated with or endorsed by Google. Firebase is a trademark of Google LLC.

Switch in three steps

One package, nothing else to install: Node 22, 24 or 26 on macOS, Linux with glibc 2.28 or newer, or Windows x64. Starting a new project instead? npx firenook init sets one up.

  1. 1

Install it next to firebase-tools

Keep firebase-tools for deploying: Firenook has no deploy or login command.

$npm install --save-dev firenook 2. 2

Check your project

This reads firebase.json the way the Firebase CLI does, and changes nothing.

$npx firenook init --adopt --dry-run 3. 3

Swap the command

Same flags and ports, so your app connects as before and your data imports as it is.


作者发帖说明(HN):

Hi HN, we have been developing with Firebase for a long time, and the only way Firebase developers can build apps without directly costing them is using the official Firebase Emulator Suite.

However, the issue with this suite is, it's dependent and running on Java with a old Console UI (not updated in years), that was not built to support tons and millions of data and has pretty bad developer experience. For a long time, we were hitting Out of Memory on even high specs laptop while developing and the worst part is while this happens all the persists data keep getting lost.

We were honestly frustrated with this, and thought what if we built the Firebase Emulator Suite the right way, as it always should have been.

Introducing Firenook, a faster drop-in replacement for Firebase Emulator Suite for Firebase developers. It's 40x faster writes and needs 10x less RAM to run it. We took the right approach of first building it Rust as a single engine, so that there will be no Java dependencies and built from scratch a new Console UI using modern web stacks.

The result is, now we were able to run 2 millions datas loaded to Firenook with only taking around 2GB ram compared to 22GB of the official suite. Things are way faster and rebuilt Console UI gives best developer experience from logging Firebase Functions, to editing Firestore documents in JSON and many more.

We developed this throughly for around 2 months now and ran this internally for a month before we decided it's time to r...