# aayush599314/demo-auth architecture

> Architecture diagram of the GitHub repository aayush599314/demo-auth, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aayush599314/demo-auth
- Repository: https://github.com/aayush599314/demo-auth

## Overview

This demo combines Firebase authentication with Supabase-backed user records. The main browser workflow is sign-up/sign-in, verification and auth-state-driven dashboard access, followed by record CRUD and sign-out or account deletion. Firebase ID tokens authenticate Supabase requests; custom-claim provisioning supports Supabase’s authenticated role. The graph reflects shown calls and documented behavior; schema details and unsampled modules are not inferred beyond their listed paths.

Main entry points: [`src/main.js`](https://github.com/aayush599314/demo-auth/blob/main/src/main.js) (App workflow), [`src/firebase.js`](https://github.com/aayush599314/demo-auth/blob/main/src/firebase.js) (Firebase client), [`src/records.js`](https://github.com/aayush599314/demo-auth/blob/main/src/records.js) (Record operations), [`src/supabase.js`](https://github.com/aayush599314/demo-auth/blob/main/src/supabase.js) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser application"]
  node_app["App workflow<br/>[main.js]"]
  node_ui["UI helpers<br/>[ui.js]"]
end

subgraph group_identity["Identity and claims"]
  node_firebase["Firebase client<br/>[firebase.js]"]
  node_firebase_auth["Firebase Auth"]
  node_claim_endpoint["Claim endpoint<br/>[vite.config.js]"]
  node_claim_script["Claim provisioning"]
  node_firebase_admin["Firebase Admin"]
end

subgraph group_data["Supabase data"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_records["Record operations<br/>[records.js]"]
  node_supabase["Supabase service"]
  node_database[("Supabase tables<br/>[schema.sql]")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"authenticates"| node_firebase
node_firebase -->|"auth calls"| node_firebase_auth
node_firebase -->|"provides token"| node_supabase_client
node_app -->|"manages records"| node_records
node_records -->|"uses client"| node_supabase_client
node_supabase_client -->|"sends requests"| node_supabase
node_records -->|"CRUD"| node_database
node_app -->|"deletes account data"| node_database
node_app -->|"updates interface"| node_ui
node_app -->|"requests claim"| node_claim_endpoint
node_claim_endpoint -->|"sets claim"| node_firebase_admin
node_claim_script -->|"provisions claims"| node_firebase_admin

click node_app "https://github.com/aayush599314/demo-auth/blob/main/src/main.js"
click node_ui "https://github.com/aayush599314/demo-auth/blob/main/src/ui.js"
click node_firebase "https://github.com/aayush599314/demo-auth/blob/main/src/firebase.js"
click node_claim_endpoint "https://github.com/aayush599314/demo-auth/blob/main/vite.config.js"
click node_claim_script "https://github.com/aayush599314/demo-auth/blob/main/scripts/provision-claims.mjs"
click node_supabase_client "https://github.com/aayush599314/demo-auth/blob/main/src/supabase.js"
click node_records "https://github.com/aayush599314/demo-auth/blob/main/src/records.js"
click node_database "https://github.com/aayush599314/demo-auth/blob/main/schema.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_ui,node_user toneBlue
class node_firebase,node_firebase_auth,node_claim_endpoint,node_claim_script,node_firebase_admin toneAmber
class node_supabase_client,node_records,node_supabase,node_database toneMint
```

## Components

### Browser application

- [App workflow](https://github.com/aayush599314/demo-auth/blob/main/src/main.js): `src/main.js`
- [UI helpers](https://github.com/aayush599314/demo-auth/blob/main/src/ui.js): `src/ui.js`

### Identity and claims

- [Firebase client](https://github.com/aayush599314/demo-auth/blob/main/src/firebase.js): `src/firebase.js`
- **Firebase Auth**
- [Claim endpoint](https://github.com/aayush599314/demo-auth/blob/main/vite.config.js): `vite.config.js`
- [Claim provisioning](https://github.com/aayush599314/demo-auth/blob/main/scripts/provision-claims.mjs): `scripts/provision-claims.mjs`
- **Firebase Admin**

### Supabase data

- [Supabase client](https://github.com/aayush599314/demo-auth/blob/main/src/supabase.js): `src/supabase.js`
- [Record operations](https://github.com/aayush599314/demo-auth/blob/main/src/records.js): `src/records.js`
- **Supabase service**
- [Supabase tables](https://github.com/aayush599314/demo-auth/blob/main/schema.sql): `schema.sql`

### Other components

- **User**

## Connections

- User → App workflow: uses
- App workflow → Firebase client: authenticates (evidence: `src/main.js`)
- Firebase client → Firebase Auth: auth calls (evidence: `src/firebase.js`)
- Firebase client → Supabase client: provides token (evidence: `src/supabase.js`)
- App workflow → Record operations: manages records (evidence: `src/main.js`)
- Record operations → Supabase client: uses client (evidence: `src/records.js`)
- Supabase client → Supabase service: sends requests (evidence: `src/supabase.js`)
- Record operations → Supabase tables: CRUD (evidence: `src/records.js`)
- App workflow → Supabase tables: deletes account data (evidence: `src/main.js`)
- App workflow → UI helpers: updates interface (evidence: `src/main.js`)
- App workflow → Claim endpoint: requests claim (evidence: `src/main.js`)
- Claim endpoint → Firebase Admin: sets claim (evidence: `vite.config.js`)
- Claim provisioning → Firebase Admin: provisions claims (evidence: `scripts/provision-claims.mjs`)
