Cloud: Firebase SDK foundation, emulator suite, and cost guardrails
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- firebase, github-actions, typescript, vite
Hướng nghiên cứu
Start by reading vite.config.ts, vitest.config.ts, src/test/setup.ts, and the existing firebase.json to understand current build, test, and Hosting configuration. Then map the requested src/firebase/ module, rules files, emulator settings, environment example, and docs/cloud-storage.md against the acceptance criteria. Done means the typed Firebase plumbing, emulator isolation, deny-all rules, CI configuration, documentation, typecheck, and coverage requirements are all verified.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Foundation issue for the Cloud Accounts & Storage milestone. Adds the Firebase SDK, client
configuration, security-rule files, the Emulator Suite for testing, and the cost guardrails that
must be in place before anything writes to a live project.
This is the first code in the repo to use runtime environment variables. Today vite.config.ts
only injects build-time constants via define (__BUILD_COMMIT__ etc., typed in
src/build-info.d.ts) and there is no .env anywhere.
Scope
- Add the
firebasedependency tolua-learning-website. - New
src/firebase/module exporting lazily-initialisedapp,auth,db,storage
singletons, readingVITE_FIREBASE_*config. Configure Firestore with
persistentLocalCache— this gives offline reads and offline write queuing for free and is
what makes repeat page loads cost zero Firestore reads. - Set
authDomainto the app's own origin (adventuresinlua.web.app), not the default
*.firebaseapp.com. See #788 for why this is load-bearing. - Add
firestore.rules,storage.rules,firestore.indexes.json, andfirestore/storage/
emulatorssections tolua-learning-website/firebase.json(currentlyhostingonly). - Wire the Emulator Suite into vitest so no test can touch a live project. Emulator host/port
detection must be automatic in dev/test and inert in production builds. - Add
.env.example, add.env*to.gitignore(not currently ignored), and add the
VITE_FIREBASE_*values as GitHub Actions secrets for the Hosting deploy workflows. - Document the Blaze upgrade and configure a GCP billing budget alert. Optionally wire the
alert to a Pub/Sub function that disables billing as a runaway kill switch.
Non-goals
- No auth UI (#788), no data model or real rules content (#789) — this issue lands the
plumbing and a deny-all default ruleset.
Acceptance criteria
-
firebaseadded as a dependency;src/firebase/exports typedauth/db/storage - Firestore configured with
persistentLocalCache -
authDomainpoints at the app's own origin -
firebase.jsondeclaresfirestore,storage, andemulatorsalongsidehosting - COOP/COEP headers in
firebase.jsonare unchanged (same-origin/require-corp) -
firestore.rulesandstorage.rulesexist and default to deny-all - Emulators start for tests; a test asserts the SDK is pointed at the emulator, not production
-
.env.examplecommitted,.env*gitignored, CI secrets documented -
docs/cloud-storage.mdstubbed with the Blaze prerequisite and console setup steps - Billing budget alert configured (manual console step, documented)
-
npx tsc -p lua-learning-website/tsconfig.app.json --noEmitclean - Scoped mutation coverage >= 80% for new code
Implementation notes
- Config module belongs in
lua-learning-website/src/firebase/. Keep it side-effect-light so
importing it in a test does not open network connections. - The Firebase client config is not a secret (it ships in client JS), but keeping it in env
vars still lets preview/prod point at different projects. Real protection comes from security
rules and App Check (#798). vitest.config.tsalready aliases mocks forstylua-wasm; follow that pattern if a
Firebase mock is needed for pure unit tests that should not spin up emulators.src/test/setup.tsis currently minimal (jest-dom + a ResizeObserver stub) — emulator wiring
goes here or in a dedicated setup file.
Blaze plan prerequisite
Cloud Functions require the Blaze plan, and Cloud Storage requires it for projects created after
approximately October 2024. Verify whether adventuresinlua already has a Storage bucket before
assuming an upgrade is needed. Set the budget alert in the same sitting as the upgrade.
Branching
This issue is part of the Cloud Accounts & Storage
milestone, which uses feat/cloud as its integration branch.
Branch from feat/cloud, and open the PR against feat/cloud. Never against main.
Create the branch (the --base flag also sets the default PR target for this branch):
gh issue develop <number> --base feat/cloud --checkout
Open the PR:
python3 scripts/issue-review.py <number> --base feat/cloud \
--summary "<summary>" --test-plan "<test-plan>"
feat/cloud merges to main in a single PR once the milestone is complete.
Why both flags are required: gh issue develop without --base branches from the repository
default branch (main), and scripts/issue-review.py falls back to main when --base is
omitted — both for the gh pr create target and for the changed-file list in the PR body.
- Ngôn ngữ chính
- TypeScript
- Star
- 1
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của jcollard/LuaInTheWeb
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
jcollard/LuaInTheWeb#752 ·
-
tech-debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
jcollard/LuaInTheWeb#690 ·
-
tech-debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
jcollard/LuaInTheWeb#590 ·
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jcollard/LuaInTheWeb#518 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
jcollard/LuaInTheWeb#235 ·
Tất cả issue của jcollard/LuaInTheWeb
Issue tương tự
-
Sequências em espanhol: «Atualizado em», a aba «Fila» e o valor 'pause' ainda saem em portuguêsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
melgarafael/DeskcommCRM#3104 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 [Bug] Mobile: on the login and registration pages the footer sits below the visible screenĐang mởbug service: webapp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Ocelot-Social-Community/Ocelot-Social#10684 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nicobailon/pi-subagents#2978 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
getsentry/sentry-conventions#732 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày