Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Cloud: Firebase SDK foundation, emulator suite, and cost guardrails

Đang mở
#787 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ả

enhancement

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

  1. Add the firebase dependency to lua-learning-website.
  2. New src/firebase/ module exporting lazily-initialised app, auth, db, storage
    singletons, reading VITE_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.
  3. Set authDomain to the app's own origin (adventuresinlua.web.app), not the default
    *.firebaseapp.com. See #788 for why this is load-bearing.
  4. Add firestore.rules, storage.rules, firestore.indexes.json, and firestore / storage /
    emulators sections to lua-learning-website/firebase.json (currently hosting only).
  5. 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.
  6. 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.
  7. 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

  • firebase added as a dependency; src/firebase/ exports typed auth / db / storage
  • Firestore configured with persistentLocalCache
  • authDomain points at the app's own origin
  • firebase.json declares firestore, storage, and emulators alongside hosting
  • COOP/COEP headers in firebase.json are unchanged (same-origin / require-corp)
  • firestore.rules and storage.rules exist and default to deny-all
  • Emulators start for tests; a test asserts the SDK is pointed at the emulator, not production
  • .env.example committed, .env* gitignored, CI secrets documented
  • docs/cloud-storage.md stubbed 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 --noEmit clean
  • 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.ts already aliases mocks for stylua-wasm; follow that pattern if a
    Firebase mock is needed for pure unit tests that should not spin up emulators.
  • src/test/setup.ts is 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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jcollard/LuaInTheWeb

Tất cả issue của jcollard/LuaInTheWeb

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.