ADR 0001 β Temporary JavaScript in Firebase Functions
Contextβ
The Engineering Handbook mandates TypeScript across apps and packages with strict mode. Our Firebase Functions under apps/functions are currently authored in JavaScript (ESM) to accelerate initial integration work and unblock OAuth/provider flows while the broader repository stabilizes.
Decisionβ
Allow a temporary exception to the "TypeScript everywhere" policy for apps/functions, permitting ESM JavaScript with Node 20 runtime during the bootstrap phase. The exception is narrow: only apps/functions is in scope; all other work remains TypeScript under strict settings.
Consequencesβ
- Pros: Faster iteration for provider OAuth flows and token refresh logic; reduced friction during early integration.
- Cons: We lose compileβtime type safety in Functions; potential drift from TS conventions; slightly higher maintenance cost until migration.
Mitigationsβ
- Keep public handler surfaces small and documented; prefer pure helpers where possible for easy TS migration.
- Maintain ESM and consistent lint/format settings; validate environment variables with runtime checks.
- Add minimal unit tests in a followβup to guard key helpers.
Migration Planβ
- Introduce a
tsconfig.jsonandtsupbuild inapps/functions. - Incrementally convert modules to TypeScript, starting with
configand provider helpers; keep export surfaces stable. - Remove this exception once Functions build successfully as TS and CI passes.
Alternatives Consideredβ
- Immediate TS migration: rejected for schedule risk; provider work is on the critical path.
- Keeping JS permanently: rejected; longβterm policy is TS everywhere.