-
Notifications
You must be signed in to change notification settings - Fork 0
Auth and Firebase
Cloud Functions require the Blaze plan. AnyLM stays on Spark: Auth + Firestore + Hosting only. Service logic that used to live in NestJS now runs in app/src/main/api/ using the signed-in user’s ID token. firestore.rules is authorization.
Implications (from firebase/README.md):
- Usage limits are cooperative (a patched client can skip reporting).
- Domain auto-join / SSO enforcement were removed (would require reading foreign orgs).
- Google Calendar connector disabled (token endpoint wants a client secret).
- Log TTL is swept when admins open compliance views (no billing TTL policies).
Main process → Identity Toolkit directly → tokens into OS keystore (token-store.ts).
- App opens a loopback port and launches the system browser to the Hosting page:
https://<project>.web.app/?provider=…&port=…. - Page runs
signInWithPopupwith Firebase web SDK; provider secrets stay inside Firebase. - Redirect to
http://127.0.0.1:<port>/callback?refreshToken=…. - App stores refresh/session via keystore.
Loopback (not custom URL scheme) follows RFC 8252 for native apps.
In app/.env (public, baked in):
ANYLM_FIREBASE_PROJECTANYLM_FIREBASE_API_KEY- Optional
ANYLM_SITE_URL - Outlook:
ANYLM_MS_CLIENT_ID
Build refuses secret-like keys — see Configuration.
| Collection | Doc id pattern | Notes |
|---|---|---|
users |
uid | Email lookup mirror |
orgs |
auto |
createdBy seeds owner |
members |
<orgId>__<userId> |
Point-read role checks |
teams |
auto | |
invites |
auto | Includes orgName for invitees |
policies |
auto |
config JSON string |
usage |
auto | Append-only |
interactionLogs |
auto | Soft TTL via expiresAt
|
audit |
auto | Append-only |
apiKeys |
sha256(key) | Possession authorizes |
connectors |
<userId>__<provider> |
Owner-only |
Id conventions matter: rules cannot query arbitrarily for membership.
- Entry:
auth.request(method, path, body) - Dispatch:
app/src/main/api/index.ts - Firestore access:
app/src/main/data/*
REST shapes are intentional so a future hosted server can take over by changing only request() to HTTPS.
Host the same router (Cloudflare Workers, Deno Deploy, Render, etc.), keep Auth + Firestore, flip request() to remote. See firebase/README.md.
- Create project; set
.firebaserc. - Enable Email/Password, Google, GitHub sign-in methods.
- Create Firestore (Native mode).
- Register a Web app (Hosting needs
/__/firebase/init.js). - Fill
app/.env. -
firebase deploy(rules, indexes, hosting).
./scripts/dev.sh --emulator — use for local rules iteration. Treat emulator rules tests plus a careful first production deploy as the real gate; live rules coverage is historically thin.
- Read
firestore.rulesbefore changingapi/. - Never assume the client is honest about usage.
- Don’t reintroduce NestJS as a required dependency.
- Keep connector tokens out of the renderer.
- Prefer invitations over cross-org reads.
| Page | Description |
|---|---|
| Home | Overview and navigation |
| Getting-Started | Local setup |
| Architecture | System design |
| Code-Structure | Directory map |
| Features | Feature inventory |
| Contributing | PR workflow |
| How-to-Change | Common change recipes |
| Gotchas | Footguns |
| Chat-Pipeline | Turn lifecycle |
| IPC-Contract | window.api |
| Auth-and-Firebase | Identity + rules |
| RAG-and-Knowledge | Vectors + graph |
| Agents | Multi-agent |
| Proxy-and-Governance | :3227 + policies |
| Configuration | Env + settings |
| Testing | bun test |
| Build-and-Release | Packaging |
| Skills | Build skills |
| Tools | Build tools |
| MCP-and-Extensions | MCP status + options |