Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#787 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
firebase, github-actions, typescript, vite

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
1
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jcollard/LuaInTheWeb

Tutte le issue di jcollard/LuaInTheWeb

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.