# emn90909/emtra architecture

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

- Interactive diagram: https://gitdiagram.com/emn90909/emtra
- Repository: https://github.com/emn90909/emtra

## Overview

#### Purpose and Runtime
This is a Vite-built React/TypeScript single-page application for a public product/marketing site plus authenticated user and administrator dashboards. It is deployable on Vercel and uses Supabase for authentication and application data. Primary browser bootstrap: `src/main.tsx`; application composition and route selection: `src/App.tsx`.

#### Public Site and Route Pages
Public-facing pages cover the landing experience, products, learning content, contact/support, and legal pages. The landing page is assembled from reusable content sections, while standalone pages support deeper product and support flows.
- `src/pages/Index.tsx`
- `src/pages/Products.tsx`
- `src/pages/Support.tsx`

Shared site shell elements are provided by navigation and footer components:
- `src/components/layout/Navbar.tsx`
- `src/components/layout/Footer.tsx`

#### Marketing Content Composition
The public landing experience is componentized into independently maintainable visual/content sections, including hero messaging, capabilities, methodology, testimonials, and calls to action. Animation/reveal behavior is isolated from the content sections.
- `src/components/sections/Hero.tsx`
- `src/components/sections/Capabilities.tsx`
- `src/components/Reveal.tsx`

This boundary lets public-content changes remain separate from authenticated application behavior.

#### Authentication and Session Boundary
Authentication UI supports login, signup-related routing, multi-factor enrollment, and MFA verification. A session context provider establishes authenticated client state for the component tree; protected dashboard/admin behavior should depend on this boundary rather than local page state.
- `src/components/auth/SessionContextProvider.tsx`
- `src/components/auth/LoginForm.tsx`
- `src/components/auth/MFAEnroll.tsx`

Supabase client integration is centralized at:
- `src/integrations/supabase/client.ts`

#### User Dashboard
Authenticated users enter a dashboard page that composes account settings, overview data, community content, and open-issue views. This is the primary post-authentication control flow: session established → dashboard route → selected dashboard content.
- `src/pages/Dashboard.tsx`
- `src/components/dashboard/Overview.tsx`
- `src/components/dashboard/OpenIssues.tsx`

#### Role-Based Administration
Administration is separated into a dedicated route/page, role detection hook, admin dashboard content, and management views for blog and issue records. The authorization boundary is represented by the admin hook and should gate admin page/content access.
- `src/hooks/useAdmin.ts`
- `src/pages/admin/AdminDashboard.tsx`
- `src/components/admin/AdminIssueManagement.tsx`

#### Data, Styling, and Deployment
Supabase migrations define the backend schema/evolution history, while the frontend uses Tailwind-oriented styling plus a local reusable UI component layer. Vite is the development/build runtime; `vercel.json` represents deployment configuration.
- `supabase/migrations/0000_sincere_iguana_trot.sql`
- `src/components/ui`
- `tailwind.config.ts`
- `vercel.json`

Main entry points: [`src/App.tsx`](https://github.com/emn90909/emtra/blob/main/src/App.tsx) (App Composition & Routes), [`src/integrations/supabase/client.ts`](https://github.com/emn90909/emtra/blob/main/src/integrations/supabase/client.ts) (Supabase Client), [`src/pages/Dashboard.tsx`](https://github.com/emn90909/emtra/blob/main/src/pages/Dashboard.tsx) (User Dashboard), [`src/pages/Index.tsx`](https://github.com/emn90909/emtra/blob/main/src/pages/Index.tsx) (Landing Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Site"]
  node_index["Landing Page<br/>public page<br/>[Index.tsx]"]
  node_products["Products Page<br/>public page<br/>[Products.tsx]"]
  node_support["Support Page<br/>public page<br/>[Support.tsx]"]
  node_site_shell["Navigation &amp; Footer<br/>shared layout<br/>[Navbar.tsx]"]
  node_sections["Marketing Sections<br/>content components<br/>[Hero.tsx]"]
  node_reveal["Reveal Animation<br/>presentation behavior<br/>[Reveal.tsx]"]
end

subgraph group_auth["Authentication"]
  node_session["Session Provider<br/>auth context"]
  node_login["Login UI<br/>auth form<br/>[LoginForm.tsx]"]
  node_mfa["MFA Enrollment<br/>auth flow<br/>[MFAEnroll.tsx]"]
end

subgraph group_dashboard["Authenticated App"]
  node_dashboard["User Dashboard<br/>protected page<br/>[Dashboard.tsx]"]
  node_overview["Dashboard Overview<br/>dashboard content<br/>[Overview.tsx]"]
  node_open_issues["Open Issues<br/>dashboard content<br/>[OpenIssues.tsx]"]
end

subgraph group_admin["Administration"]
  node_use_admin{{"Admin Role Check<br/>authorization hook<br/>[useAdmin.ts]"}}
  node_admin_dashboard["Admin Dashboard<br/>protected admin page<br/>[AdminDashboard.tsx]"]
  node_issue_management["Issue Management<br/>admin management view"]
end

subgraph group_platform["Platform"]
  node_supabase[("Supabase Client<br/>backend integration<br/>[client.ts]")]
  node_migrations["Database Migrations<br/>schema history"]
  node_ui["Reusable UI Layer<br/>component library"]
  node_tailwind["Tailwind Styling<br/>styling system<br/>[tailwind.config.ts]"]
  node_vercel["Vercel Deployment<br/>deployment config<br/>[vercel.json]"]
end

node_main(("Browser Bootstrap<br/>React entry<br/>[main.tsx]"))
node_app["App Composition &amp; Routes<br/>route shell<br/>[App.tsx]"]

node_main -->|"mounts"| node_app
node_main -->|"provides session"| node_session
node_app -->|"public route"| node_index
node_app -->|"public route"| node_products
node_app -->|"public route"| node_support
node_app -->|"auth route"| node_login
node_app -->|"MFA route"| node_mfa
node_app -->|"protected route"| node_dashboard
node_app -->|"admin route"| node_admin_dashboard
node_index -->|"uses"| node_site_shell
node_index -->|"composes"| node_sections
node_sections -->|"animates with"| node_reveal
node_session -->|"auth session"| node_supabase
node_login -->|"authenticates via"| node_supabase
node_mfa -->|"verifies via"| node_supabase
node_session -->|"authorizes access"| node_dashboard
node_dashboard -->|"composes"| node_overview
node_dashboard -->|"composes"| node_open_issues
node_dashboard -->|"reads application data"| node_supabase
node_admin_dashboard -->|"checks role"| node_use_admin
node_use_admin -->|"reads role"| node_supabase
node_admin_dashboard -->|"composes"| node_issue_management
node_issue_management -->|"manages records"| node_supabase
node_migrations -->|"evolves schema"| node_supabase
node_app -.->|"uses components"| node_ui
node_ui -.->|"styled by"| node_tailwind
node_vercel -.->|"deploys built app"| node_main

click node_main "https://github.com/emn90909/emtra/blob/main/src/main.tsx"
click node_app "https://github.com/emn90909/emtra/blob/main/src/App.tsx"
click node_index "https://github.com/emn90909/emtra/blob/main/src/pages/Index.tsx"
click node_products "https://github.com/emn90909/emtra/blob/main/src/pages/Products.tsx"
click node_support "https://github.com/emn90909/emtra/blob/main/src/pages/Support.tsx"
click node_site_shell "https://github.com/emn90909/emtra/blob/main/src/components/layout/Navbar.tsx"
click node_sections "https://github.com/emn90909/emtra/blob/main/src/components/sections/Hero.tsx"
click node_reveal "https://github.com/emn90909/emtra/blob/main/src/components/Reveal.tsx"
click node_session "https://github.com/emn90909/emtra/blob/main/src/components/auth/SessionContextProvider.tsx"
click node_login "https://github.com/emn90909/emtra/blob/main/src/components/auth/LoginForm.tsx"
click node_mfa "https://github.com/emn90909/emtra/blob/main/src/components/auth/MFAEnroll.tsx"
click node_dashboard "https://github.com/emn90909/emtra/blob/main/src/pages/Dashboard.tsx"
click node_overview "https://github.com/emn90909/emtra/blob/main/src/components/dashboard/Overview.tsx"
click node_open_issues "https://github.com/emn90909/emtra/blob/main/src/components/dashboard/OpenIssues.tsx"
click node_use_admin "https://github.com/emn90909/emtra/blob/main/src/hooks/useAdmin.ts"
click node_admin_dashboard "https://github.com/emn90909/emtra/blob/main/src/pages/admin/AdminDashboard.tsx"
click node_issue_management "https://github.com/emn90909/emtra/blob/main/src/components/admin/AdminIssueManagement.tsx"
click node_supabase "https://github.com/emn90909/emtra/blob/main/src/integrations/supabase/client.ts"
click node_migrations "https://github.com/emn90909/emtra/blob/main/supabase/migrations/0000_sincere_iguana_trot.sql"
click node_ui "https://github.com/emn90909/emtra/tree/main/src/components/ui"
click node_tailwind "https://github.com/emn90909/emtra/blob/main/tailwind.config.ts"
click node_vercel "https://github.com/emn90909/emtra/blob/main/vercel.json"

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_index,node_products,node_support,node_site_shell,node_sections,node_reveal toneBlue
class node_session,node_login,node_mfa toneAmber
class node_dashboard,node_overview,node_open_issues toneMint
class node_use_admin,node_admin_dashboard,node_issue_management toneRose
class node_supabase,node_migrations,node_ui,node_tailwind,node_vercel toneIndigo
class node_main,node_app toneNeutral
```

## Components

### Public Site

- [Landing Page](https://github.com/emn90909/emtra/blob/main/src/pages/Index.tsx): public page · `src/pages/Index.tsx`
- [Products Page](https://github.com/emn90909/emtra/blob/main/src/pages/Products.tsx): public page · `src/pages/Products.tsx`
- [Support Page](https://github.com/emn90909/emtra/blob/main/src/pages/Support.tsx): public page · `src/pages/Support.tsx`
- [Navigation & Footer](https://github.com/emn90909/emtra/blob/main/src/components/layout/Navbar.tsx): shared layout · `src/components/layout/Navbar.tsx`
- [Marketing Sections](https://github.com/emn90909/emtra/blob/main/src/components/sections/Hero.tsx): content components · Hero and capabilities compose the landing experience. · `src/components/sections/Hero.tsx`
- [Reveal Animation](https://github.com/emn90909/emtra/blob/main/src/components/Reveal.tsx): presentation behavior · `src/components/Reveal.tsx`

### Authentication

- [Session Provider](https://github.com/emn90909/emtra/blob/main/src/components/auth/SessionContextProvider.tsx): auth context · Establishes authenticated client state for the application tree. · `src/components/auth/SessionContextProvider.tsx`
- [Login UI](https://github.com/emn90909/emtra/blob/main/src/components/auth/LoginForm.tsx): auth form · `src/components/auth/LoginForm.tsx`
- [MFA Enrollment](https://github.com/emn90909/emtra/blob/main/src/components/auth/MFAEnroll.tsx): auth flow · `src/components/auth/MFAEnroll.tsx`

### Authenticated App

- [User Dashboard](https://github.com/emn90909/emtra/blob/main/src/pages/Dashboard.tsx): protected page · `src/pages/Dashboard.tsx`
- [Dashboard Overview](https://github.com/emn90909/emtra/blob/main/src/components/dashboard/Overview.tsx): dashboard content · `src/components/dashboard/Overview.tsx`
- [Open Issues](https://github.com/emn90909/emtra/blob/main/src/components/dashboard/OpenIssues.tsx): dashboard content · `src/components/dashboard/OpenIssues.tsx`

### Administration

- [Admin Role Check](https://github.com/emn90909/emtra/blob/main/src/hooks/useAdmin.ts): authorization hook · Gates administrator route and content access. · `src/hooks/useAdmin.ts`
- [Admin Dashboard](https://github.com/emn90909/emtra/blob/main/src/pages/admin/AdminDashboard.tsx): protected admin page · `src/pages/admin/AdminDashboard.tsx`
- [Issue Management](https://github.com/emn90909/emtra/blob/main/src/components/admin/AdminIssueManagement.tsx): admin management view · `src/components/admin/AdminIssueManagement.tsx`

### Platform

- [Supabase Client](https://github.com/emn90909/emtra/blob/main/src/integrations/supabase/client.ts): backend integration · Central client for authentication and application data. · `src/integrations/supabase/client.ts`
- [Database Migrations](https://github.com/emn90909/emtra/blob/main/supabase/migrations/0000_sincere_iguana_trot.sql): schema history · `supabase/migrations/0000_sincere_iguana_trot.sql`
- [Reusable UI Layer](https://github.com/emn90909/emtra/tree/main/src/components/ui): component library · `src/components/ui`
- [Tailwind Styling](https://github.com/emn90909/emtra/blob/main/tailwind.config.ts): styling system · `tailwind.config.ts`
- [Vercel Deployment](https://github.com/emn90909/emtra/blob/main/vercel.json): deployment config · `vercel.json`

### Other components

- [Browser Bootstrap](https://github.com/emn90909/emtra/blob/main/src/main.tsx): React entry · `src/main.tsx`
- [App Composition & Routes](https://github.com/emn90909/emtra/blob/main/src/App.tsx): route shell · `src/App.tsx`

## Connections

- Browser Bootstrap → App Composition & Routes: mounts
- Browser Bootstrap → Session Provider: provides session
- App Composition & Routes → Landing Page: public route
- App Composition & Routes → Products Page: public route
- App Composition & Routes → Support Page: public route
- App Composition & Routes → Login UI: auth route
- App Composition & Routes → MFA Enrollment: MFA route
- App Composition & Routes → User Dashboard: protected route
- App Composition & Routes → Admin Dashboard: admin route
- Landing Page → Navigation & Footer: uses
- Landing Page → Marketing Sections: composes
- Marketing Sections → Reveal Animation: animates with
- Session Provider → Supabase Client: auth session
- Login UI → Supabase Client: authenticates via
- MFA Enrollment → Supabase Client: verifies via
- Session Provider → User Dashboard: authorizes access
- User Dashboard → Dashboard Overview: composes
- User Dashboard → Open Issues: composes
- User Dashboard → Supabase Client: reads application data
- Admin Dashboard → Admin Role Check: checks role
- Admin Role Check → Supabase Client: reads role
- Admin Dashboard → Issue Management: composes
- Issue Management → Supabase Client: manages records
- Database Migrations → Supabase Client: evolves schema
- App Composition & Routes → Reusable UI Layer: uses components
- Reusable UI Layer → Tailwind Styling: styled by
- Vercel Deployment → Browser Bootstrap: deploys built app
