# bla573/betview architecture

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

- Interactive diagram: https://gitdiagram.com/bla573/betview
- Repository: https://github.com/bla573/betview

## Overview

BetView is a real-estate application whose public workflow presents listings for browsing, map viewing, comparison, and agent contact; its admin workflow manages listings and other operational areas. The frontend uses Supabase directly, while the tree also contains a separate Express authentication API. README-described password-reset and EmailJS capabilities are retained, but their detailed frontend implementation is not sampled, so those connections are documented rather than inferred from unseen code.

Main entry points: [`src/App.tsx`](https://github.com/bla573/betview/blob/main/src/App.tsx) (Route application), [`src/components/landing/BrowseSection.tsx`](https://github.com/bla573/betview/blob/main/src/components/landing/BrowseSection.tsx) (Listing discovery), [`src/components/admin/AdminLayout.tsx`](https://github.com/bla573/betview/blob/main/src/components/admin/AdminLayout.tsx) (Admin shell), [`src/integrations/supabase/client.ts`](https://github.com/bla573/betview/blob/main/src/integrations/supabase/client.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_app["Route application<br/>[App.tsx]"]
  node_landing["Landing page<br/>[Index.tsx]"]
  node_landing_sections["Landing sections<br/>[BookingForm.tsx]"]
  node_browse_page["Browse page<br/>[Browse.tsx]"]
  node_browse["Listing discovery<br/>[BrowseSection.tsx]"]
  node_property_data["Property data<br/>[propertyData.ts]"]
  node_property_card["Listing cards<br/>[PropertyCard.tsx]"]
  node_property_map["Property map<br/>[PropertyMap.tsx]"]
  node_property_modal["Listing details<br/>[PropertyModal.tsx]"]
  node_compare["Compare listings<br/>[CompareDrawer.tsx]"]
  node_contact["Contact agent"]
  node_booking["Demo requests<br/>[BookingForm.tsx]"]
end

subgraph group_identity["Identity"]
  node_auth_page["Sign in and signup<br/>[Auth.tsx]"]
  node_auth_context["Session and roles<br/>[AuthContext.tsx]"]
  node_route_guard["Admin route guard"]
end

subgraph group_admin["Admin operations"]
  node_admin_layout["Admin shell<br/>[AdminLayout.tsx]"]
  node_admin_listings["Listing management<br/>[AdminListings.tsx]"]
  node_property_form["Listing editor"]
  node_admin_inquiries["Inquiry management"]
  node_admin_reports["Reports<br/>[AdminReports.tsx]"]
  node_admin_users["User management<br/>[AdminUsers.tsx]"]
  node_admin_overview["Admin overview<br/>[AdminOverview.tsx]"]
  node_admin_activity["Activity logs"]
  node_admin_settings["Admin settings<br/>[AdminSettings.tsx]"]
end

subgraph group_data["Data services"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
  node_supabase[("Supabase Auth and database")]
end

subgraph group_server["Server authentication"]
  node_express["Express API<br/>[index.js]"]
  node_auth_routes["Auth endpoints<br/>[auth.js]"]
  node_server_middleware["Session middleware<br/>[auth.js]"]
  node_server_supabase["Server Supabase clients<br/>[supabase.js]"]
  node_cookies["Auth cookies<br/>[cookies.js]"]
end

node_visitor(("Visitor"))
node_emailjs{{"EmailJS"}}

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_browse_page
node_app -->|"routes to"| node_auth_page
node_app -->|"guards admin"| node_route_guard
node_app -->|"routes to"| node_admin_overview
node_app -->|"routes to"| node_admin_listings
node_app -->|"routes to"| node_admin_users
node_app -->|"routes to"| node_admin_inquiries
node_app -->|"routes to"| node_admin_reports
node_app -->|"routes to"| node_admin_activity
node_app -->|"routes to"| node_admin_settings
node_landing -->|"renders"| node_landing_sections
node_landing -->|"renders"| node_browse
node_landing -->|"renders"| node_booking
node_browse_page -->|"renders"| node_browse
node_browse -->|"uses"| node_property_data
node_browse -->|"renders"| node_property_card
node_browse -->|"renders"| node_property_map
node_browse -->|"opens"| node_property_modal
node_browse -->|"opens"| node_compare
node_property_modal -->|"opens"| node_contact
node_browse -->|"queries listings"| node_supabase_client
node_property_form -->|"reads and writes"| node_supabase_client
node_admin_listings -->|"uses shell"| node_admin_layout
node_admin_listings -->|"opens editor"| node_property_form
node_admin_inquiries -->|"uses shell"| node_admin_layout
node_admin_reports -->|"uses shell"| node_admin_layout
node_admin_users -->|"uses shell"| node_admin_layout
node_auth_page -->|"authenticates"| node_supabase_client
node_auth_context -->|"tracks session"| node_supabase_client
node_route_guard -->|"checks access"| node_auth_context
node_admin_layout -->|"checks role"| node_auth_context
node_supabase_client -->|"connects"| node_supabase
node_booking -.->|"sends requests"| node_emailjs
node_app -.->|"may use API"| node_express
node_express -->|"mounts routes"| node_auth_routes
node_auth_routes -->|"auth operations"| node_server_supabase
node_auth_routes -->|"requires session"| node_server_middleware
node_server_middleware -->|"validates session"| node_server_supabase
node_auth_routes -->|"sets and clears"| node_cookies
node_server_middleware -->|"reads cookies"| node_cookies
node_server_supabase -.->|"connects"| node_supabase

click node_app "https://github.com/bla573/betview/blob/main/src/App.tsx"
click node_landing "https://github.com/bla573/betview/blob/main/src/pages/Index.tsx"
click node_landing_sections "https://github.com/bla573/betview/blob/main/src/components/landing/BookingForm.tsx"
click node_browse_page "https://github.com/bla573/betview/blob/main/src/pages/Browse.tsx"
click node_browse "https://github.com/bla573/betview/blob/main/src/components/landing/BrowseSection.tsx"
click node_property_data "https://github.com/bla573/betview/blob/main/src/components/browse/propertyData.ts"
click node_property_card "https://github.com/bla573/betview/blob/main/src/components/browse/PropertyCard.tsx"
click node_property_map "https://github.com/bla573/betview/blob/main/src/components/browse/PropertyMap.tsx"
click node_property_modal "https://github.com/bla573/betview/blob/main/src/components/browse/PropertyModal.tsx"
click node_compare "https://github.com/bla573/betview/blob/main/src/components/browse/CompareDrawer.tsx"
click node_contact "https://github.com/bla573/betview/blob/main/src/components/browse/ContactAgentModal.tsx"
click node_booking "https://github.com/bla573/betview/blob/main/src/components/landing/BookingForm.tsx"
click node_auth_page "https://github.com/bla573/betview/blob/main/src/pages/Auth.tsx"
click node_auth_context "https://github.com/bla573/betview/blob/main/src/contexts/AuthContext.tsx"
click node_route_guard "https://github.com/bla573/betview/blob/main/src/components/auth/AdminRouteGuard.tsx"
click node_admin_layout "https://github.com/bla573/betview/blob/main/src/components/admin/AdminLayout.tsx"
click node_admin_listings "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminListings.tsx"
click node_property_form "https://github.com/bla573/betview/blob/main/src/components/admin/PropertyFormModal.tsx"
click node_admin_inquiries "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminInquiriesPage.tsx"
click node_admin_reports "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminReports.tsx"
click node_admin_users "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminUsers.tsx"
click node_admin_overview "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminOverview.tsx"
click node_admin_activity "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminActivityLogs.tsx"
click node_admin_settings "https://github.com/bla573/betview/blob/main/src/pages/admin/AdminSettings.tsx"
click node_supabase_client "https://github.com/bla573/betview/blob/main/src/integrations/supabase/client.ts"
click node_express "https://github.com/bla573/betview/blob/main/server/src/index.js"
click node_auth_routes "https://github.com/bla573/betview/blob/main/server/src/routes/auth.js"
click node_server_middleware "https://github.com/bla573/betview/blob/main/server/src/middleware/auth.js"
click node_server_supabase "https://github.com/bla573/betview/blob/main/server/src/lib/supabase.js"
click node_cookies "https://github.com/bla573/betview/blob/main/server/src/lib/cookies.js"

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_landing,node_landing_sections,node_browse_page,node_browse,node_property_data,node_property_card,node_property_map,node_property_modal,node_compare,node_contact,node_booking toneBlue
class node_auth_page,node_auth_context,node_route_guard toneAmber
class node_admin_layout,node_admin_listings,node_property_form,node_admin_inquiries,node_admin_reports,node_admin_users,node_admin_overview,node_admin_activity,node_admin_settings toneMint
class node_supabase_client,node_supabase toneRose
class node_express,node_auth_routes,node_server_middleware,node_server_supabase,node_cookies,node_visitor,node_emailjs toneIndigo
```

## Components

### Public experience

- [Route application](https://github.com/bla573/betview/blob/main/src/App.tsx): `src/App.tsx`
- [Landing page](https://github.com/bla573/betview/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Landing sections](https://github.com/bla573/betview/blob/main/src/components/landing/BookingForm.tsx): `src/components/landing/BookingForm.tsx`
- [Browse page](https://github.com/bla573/betview/blob/main/src/pages/Browse.tsx): `src/pages/Browse.tsx`
- [Listing discovery](https://github.com/bla573/betview/blob/main/src/components/landing/BrowseSection.tsx): `src/components/landing/BrowseSection.tsx`
- [Property data](https://github.com/bla573/betview/blob/main/src/components/browse/propertyData.ts): `src/components/browse/propertyData.ts`
- [Listing cards](https://github.com/bla573/betview/blob/main/src/components/browse/PropertyCard.tsx): `src/components/browse/PropertyCard.tsx`
- [Property map](https://github.com/bla573/betview/blob/main/src/components/browse/PropertyMap.tsx): `src/components/browse/PropertyMap.tsx`
- [Listing details](https://github.com/bla573/betview/blob/main/src/components/browse/PropertyModal.tsx): `src/components/browse/PropertyModal.tsx`
- [Compare listings](https://github.com/bla573/betview/blob/main/src/components/browse/CompareDrawer.tsx): `src/components/browse/CompareDrawer.tsx`
- [Contact agent](https://github.com/bla573/betview/blob/main/src/components/browse/ContactAgentModal.tsx): `src/components/browse/ContactAgentModal.tsx`
- [Demo requests](https://github.com/bla573/betview/blob/main/src/components/landing/BookingForm.tsx): `src/components/landing/BookingForm.tsx`

### Identity

- [Sign in and signup](https://github.com/bla573/betview/blob/main/src/pages/Auth.tsx): `src/pages/Auth.tsx`
- [Session and roles](https://github.com/bla573/betview/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Admin route guard](https://github.com/bla573/betview/blob/main/src/components/auth/AdminRouteGuard.tsx): `src/components/auth/AdminRouteGuard.tsx`

### Admin operations

- [Admin shell](https://github.com/bla573/betview/blob/main/src/components/admin/AdminLayout.tsx): `src/components/admin/AdminLayout.tsx`
- [Listing management](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminListings.tsx): `src/pages/admin/AdminListings.tsx`
- [Listing editor](https://github.com/bla573/betview/blob/main/src/components/admin/PropertyFormModal.tsx): `src/components/admin/PropertyFormModal.tsx`
- [Inquiry management](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminInquiriesPage.tsx): `src/pages/admin/AdminInquiriesPage.tsx`
- [Reports](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminReports.tsx): `src/pages/admin/AdminReports.tsx`
- [User management](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminUsers.tsx): `src/pages/admin/AdminUsers.tsx`
- [Admin overview](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminOverview.tsx): `src/pages/admin/AdminOverview.tsx`
- [Activity logs](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminActivityLogs.tsx): `src/pages/admin/AdminActivityLogs.tsx`
- [Admin settings](https://github.com/bla573/betview/blob/main/src/pages/admin/AdminSettings.tsx): `src/pages/admin/AdminSettings.tsx`

### Data services

- [Supabase client](https://github.com/bla573/betview/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase Auth and database**

### Server authentication

- [Express API](https://github.com/bla573/betview/blob/main/server/src/index.js): `server/src/index.js`
- [Auth endpoints](https://github.com/bla573/betview/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [Session middleware](https://github.com/bla573/betview/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Server Supabase clients](https://github.com/bla573/betview/blob/main/server/src/lib/supabase.js): `server/src/lib/supabase.js`
- [Auth cookies](https://github.com/bla573/betview/blob/main/server/src/lib/cookies.js): `server/src/lib/cookies.js`

### Other components

- **Visitor**
- **EmailJS**

## Connections

- Visitor → Route application: opens (evidence: `src/App.tsx`)
- Route application → Landing page: routes to (evidence: `src/App.tsx`)
- Route application → Browse page: routes to (evidence: `src/App.tsx`)
- Route application → Sign in and signup: routes to (evidence: `src/App.tsx`)
- Route application → Admin route guard: guards admin (evidence: `src/App.tsx`)
- Route application → Admin overview: routes to (evidence: `src/App.tsx`)
- Route application → Listing management: routes to (evidence: `src/App.tsx`)
- Route application → User management: routes to (evidence: `src/App.tsx`)
- Route application → Inquiry management: routes to (evidence: `src/App.tsx`)
- Route application → Reports: routes to (evidence: `src/App.tsx`)
- Route application → Activity logs: routes to (evidence: `src/App.tsx`)
- Route application → Admin settings: routes to (evidence: `src/App.tsx`)
- Landing page → Landing sections: renders (evidence: `src/pages/Index.tsx`)
- Landing page → Listing discovery: renders (evidence: `src/pages/Index.tsx`)
- Landing page → Demo requests: renders (evidence: `src/pages/Index.tsx`)
- Browse page → Listing discovery: renders (evidence: `src/pages/Browse.tsx`)
- Listing discovery → Property data: uses (evidence: `src/components/landing/BrowseSection.tsx`)
- Listing discovery → Listing cards: renders (evidence: `src/components/landing/BrowseSection.tsx`)
- Listing discovery → Property map: renders (evidence: `src/components/landing/BrowseSection.tsx`)
- Listing discovery → Listing details: opens (evidence: `src/components/landing/BrowseSection.tsx`)
- Listing discovery → Compare listings: opens (evidence: `src/components/landing/BrowseSection.tsx`)
- Listing details → Contact agent: opens (evidence: `src/components/browse/PropertyModal.tsx`)
- Listing discovery → Supabase client: queries listings (evidence: `src/components/landing/BrowseSection.tsx`)
- Listing editor → Supabase client: reads and writes (evidence: `src/components/admin/PropertyFormModal.tsx`)
- Listing management → Admin shell: uses shell (evidence: `src/pages/admin/AdminListings.tsx`)
- Listing management → Listing editor: opens editor (evidence: `src/pages/admin/AdminListings.tsx`)
- Inquiry management → Admin shell: uses shell (evidence: `src/pages/admin/AdminInquiriesPage.tsx`)
- Reports → Admin shell: uses shell (evidence: `src/pages/admin/AdminReports.tsx`)
- User management → Admin shell: uses shell (evidence: `src/pages/admin/AdminUsers.tsx`)
- Sign in and signup → Supabase client: authenticates (evidence: `src/pages/Auth.tsx`)
- Session and roles → Supabase client: tracks session (evidence: `src/contexts/AuthContext.tsx`)
- Admin route guard → Session and roles: checks access (evidence: `src/components/auth/AdminRouteGuard.tsx`)
- Admin shell → Session and roles: checks role (evidence: `src/components/admin/AdminLayout.tsx`)
- Supabase client → Supabase Auth and database: connects (evidence: `src/integrations/supabase/client.ts`)
- Demo requests → EmailJS: sends requests (evidence: `README.md`)
- Route application → Express API: may use API
- Express API → Auth endpoints: mounts routes (evidence: `server/src/index.js`)
- Auth endpoints → Server Supabase clients: auth operations (evidence: `server/src/routes/auth.js`)
- Auth endpoints → Session middleware: requires session (evidence: `server/src/routes/auth.js`)
- Session middleware → Server Supabase clients: validates session (evidence: `server/src/middleware/auth.js`)
- Auth endpoints → Auth cookies: sets and clears (evidence: `server/src/routes/auth.js`)
- Session middleware → Auth cookies: reads cookies (evidence: `server/src/middleware/auth.js`)
- Server Supabase clients → Supabase Auth and database: connects
