# nihaldr/lingam_aabharanam architecture

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

- Interactive diagram: https://gitdiagram.com/nihaldr/lingam_aabharanam
- Repository: https://github.com/nihaldr/lingam_aabharanam

## Overview

1. **Overall shape**
   - This is a **React + TypeScript single-page application** built with **Vite**.
   - It has a clear split between **public customer-facing pages** and a **protected admin area**, both sharing the same component library and data layer.
   - **Supabase** is the backend boundary for authentication and application data.

2. **Top-level presentation shell**
   - The app is composed from reusable layout pieces in `src/components/`: `Navbar`, `Footer`, `Layout`, and `AdminLayout`.
   - These are the outer shells that frame page content and separate public UX from admin UX.
   - `App.tsx` and `main.tsx` likely wire routing, global providers, and app-wide styling.

3. **Routing and page boundaries**
   - `src/pages/` contains the main route-level screens:
     - Public site: `HomePage`, `AboutPage`, `ProductsPage`, `ProductDetailPage`, `CartPage`, `WishlistPage`, `AppointmentPage`, `ContactPage`, `LoginPage`, `SignupPage`, `PrivacyPolicyPage`, `TermsOfServicePage`.
     - Admin site: `src/pages/admin/*` such as `Dashboard`, `Products`, `Appointments`, `Customers`, `Testimonials`, `HomePageEditor`, `Settings`.
   - `Index.tsx` and `NotFound.tsx` likely handle landing/default routing and fallback handling.
   - This structure suggests a route-driven architecture rather than a nested feature-module architecture.

4. **Authentication and authorization boundary**
   - Auth is centralized in `src/contexts/AuthContext.tsx` and `src/contexts/auth/*`.
   - `AuthProvider`, `useAuth`, and `ProtectedRoute` form the main access-control boundary.
   - The admin pages are not just hidden UI; they are expected to be **gated by route protection** and authenticated user state.
   - `userUtils.ts` and `types.ts` indicate user-role or profile shaping beyond raw Supabase auth objects.

5. **Data access layer**
   - Business data access is isolated in `src/services/`.
   - Separate service modules exist for `adminService`, `appointmentService`, `customerService`, `productService`, and `testimonialService`.
   - This implies pages call service functions rather than talking to Supabase directly, keeping route components thinner and making backend access easier to swap or test.

6. **Supabase integration**
   - `src/integrations/supabase/client.ts` is the single client entry point for backend communication.
   - `src/integrations/supabase/types.ts` suggests generated database typings, so the frontend is likely typed against Supabase tables/views.
   - The `supabase/` folder with `migrations/` and `config.toml` shows backend schema management is versioned alongside the app.
   - The application likely uses Supabase for **auth, database queries, and possibly storage**.

7. **Public customer flows**
   - The customer-facing side appears to cover browsing products, viewing details, managing a cart/wishlist, and booking appointments.
   - Components like `Testimonials`, `TestimonialsSection`, and `StoreLocationMap` support marketing and store-discovery experiences.
   - `utils/storeInfo.ts` likely holds static business metadata used across contact/footer/map-related areas.

8. **Admin subsystem**
   - Admin functionality is concentrated under `src/pages/admin/`.
   - `Dashboard` and `AdminDashboardCharts` indicate a metrics/summary screen with data visualization.
   - `Products`, `Appointments`, `Customers`, `Testimonials`, and `HomePageEditor` suggest CRUD and content-management workflows.
   - `AdminLayout` provides the admin navigation and frame, separating operational tooling from the public storefront.

9. **UI system and reusable primitives**
   - The repo uses a large `src/components/ui/` set, which is characteristic of **shadcn/ui**.
   - These are low-level primitives for dialogs, forms, tables, tabs, charts, menus, sheets, toasts, etc.
   - Higher-level feature components in `src/components/` compose these primitives into actual screens.
   - This keeps styling and interaction patterns consistent across both admin and public areas.

10. **State, feedback, and responsive behavior**
   - `src/hooks/use-toast.ts`, `src/components/ui/toaster.tsx`, and `sonner`/toast-related components indicate a global notification channel for async actions and errors.
   - `use-mobile.tsx` suggests responsive behavior is handled in the app layer, not only by CSS.
   - Shared utility code in `src/lib/utils.ts` likely contains class-name or component helpers used across the UI.

11. **Static assets and public delivery**
   - `public/lingam-uploads` is a notable asset directory, likely used for uploaded product/media content that must be served directly.
   - `public/robots.txt` indicates the app is intended for public indexing and production web deployment.
   - `index.html` and Vite config files show the app is served as a standard browser SPA.

12. **Build/tooling boundaries**
   - The project uses **npm**, **TypeScript**, **Tailwind CSS**, and **PostCSS** for styling and build-time transformation.
   - `eslint.config.js`, `tsconfig*.json`, and `vite.config.ts` define code quality, type checking, and bundling behavior.
   - `components.json` confirms a component-generation workflow typical of shadcn-based projects.
   - The runtime is entirely browser-side for the frontend, with Supabase as the external application backend.

Main entry points: [`src/App.tsx`](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/App.tsx) (App.tsx), [`src/components/Layout.tsx`](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Layout.tsx) (Layout), [`src/services/index.ts`](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/services/index.ts) (Services), [`src/components/AdminLayout.tsx`](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/AdminLayout.tsx) (AdminLayout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_app_shell["App shell"]
  node_node_main["main.tsx<br/>bootstrap<br/>[main.tsx]"]
  node_node_app["App.tsx<br/>router shell<br/>[App.tsx]"]
  node_node_layout["Layout<br/>public shell<br/>[Layout.tsx]"]
end

subgraph group_grp_public["Public site"]
  node_node_index["Index<br/>landing route<br/>[Index.tsx]"]
  node_node_public_pages["Public pages<br/>routes<br/>[HomePage.tsx]"]
  node_node_public_detail["Product detail<br/>route page"]
  node_node_navbar["Navbar<br/>navigation<br/>[Navbar.tsx]"]
  node_node_footer["Footer<br/>[Footer.tsx]"]
  node_node_home["HomePage<br/>public screen<br/>[HomePage.tsx]"]
  node_node_catalog["Catalog pages<br/>browse flows<br/>[ProductsPage.tsx]"]
end

subgraph group_grp_admin["Admin area"]
  node_node_admin_pages["Admin pages<br/>protected routes<br/>[Dashboard.tsx]"]
  node_node_admin_layout["AdminLayout<br/>admin shell<br/>[AdminLayout.tsx]"]
end

subgraph group_grp_data["Data boundary"]
  node_node_protected["ProtectedRoute<br/>access guard<br/>[ProtectedRoute.tsx]"]
  node_node_auth["AuthContext<br/>auth state<br/>[AuthContext.tsx]"]
  node_node_services["Services<br/>domain APIs<br/>[index.ts]"]
  node_node_supabase[("Supabase client<br/>backend client<br/>[client.ts]")]
  node_node_utils["Shared utils<br/>helpers<br/>[utils.ts]"]
end

subgraph group_grp_ui["UI system"]
  node_node_feature_ui["Feature UI<br/>shared components<br/>[Testimonials.tsx]"]
  node_node_primitives["UI primitives<br/>shadcn ui<br/>[button.tsx]"]
end

subgraph group_grp_platform["Platform"]
  node_node_supabase_schema["Supabase schema<br/>migrations"]
end

node_node_main -->|"mounts"| node_node_app
node_node_app -->|"wraps public"| node_node_layout
node_node_app -->|"wraps admin"| node_node_admin_layout
node_node_app -->|"routes to"| node_node_index
node_node_app -->|"routes to"| node_node_public_pages
node_node_app -->|"routes to"| node_node_public_detail
node_node_app -->|"routes to"| node_node_admin_pages
node_node_layout -->|"includes"| node_node_navbar
node_node_layout -->|"includes"| node_node_footer
node_node_admin_layout -->|"depends on"| node_node_protected
node_node_protected -->|"checks"| node_node_auth
node_node_auth -->|"auth via"| node_node_supabase
node_node_public_pages -->|"reads data"| node_node_services
node_node_admin_pages -->|"manages data"| node_node_services
node_node_services -->|"queries"| node_node_supabase
node_node_supabase -.->|"typed by"| node_node_supabase_schema
node_node_home -->|"composes"| node_node_feature_ui
node_node_catalog -->|"composes"| node_node_feature_ui
node_node_feature_ui -->|"built on"| node_node_primitives
node_node_layout -->|"uses"| node_node_primitives
node_node_admin_layout -->|"uses"| node_node_primitives
node_node_auth -->|"uses"| node_node_utils
node_node_services -->|"uses"| node_node_utils

click node_node_main "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/main.tsx"
click node_node_app "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/App.tsx"
click node_node_index "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/Index.tsx"
click node_node_public_pages "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/HomePage.tsx"
click node_node_public_detail "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/ProductDetailPage.tsx"
click node_node_admin_pages "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/admin/Dashboard.tsx"
click node_node_layout "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Layout.tsx"
click node_node_admin_layout "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/AdminLayout.tsx"
click node_node_navbar "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Navbar.tsx"
click node_node_footer "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Footer.tsx"
click node_node_protected "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/ProtectedRoute.tsx"
click node_node_auth "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/contexts/AuthContext.tsx"
click node_node_services "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/services/index.ts"
click node_node_supabase "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/integrations/supabase/client.ts"
click node_node_supabase_schema "https://github.com/nihaldr/lingam_aabharanam/blob/main/supabase/migrations/20250614082944-29708651-989c-4d65-9dfb-96549351e274.sql"
click node_node_home "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/HomePage.tsx"
click node_node_catalog "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/ProductsPage.tsx"
click node_node_feature_ui "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Testimonials.tsx"
click node_node_primitives "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/ui/button.tsx"
click node_node_utils "https://github.com/nihaldr/lingam_aabharanam/blob/main/src/lib/utils.ts"

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_node_main,node_node_app,node_node_layout toneBlue
class node_node_index,node_node_public_pages,node_node_public_detail,node_node_navbar,node_node_footer,node_node_home,node_node_catalog toneAmber
class node_node_admin_pages,node_node_admin_layout toneMint
class node_node_protected,node_node_auth,node_node_services,node_node_supabase,node_node_utils toneRose
class node_node_feature_ui,node_node_primitives toneIndigo
class node_node_supabase_schema toneTeal
```

## Components

### App shell

Application bootstrap, routing, and shared layouts.

- [main.tsx](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/main.tsx): bootstrap · Browser entrypoint that mounts the app and global providers. · `src/main.tsx`
- [App.tsx](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/App.tsx): router shell · Top-level route composition and app-wide wiring. · `src/App.tsx`
- [Layout](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Layout.tsx): public shell · Shared storefront frame used by public pages. · `src/components/Layout.tsx`

### Public site

Customer-facing pages and storefront flows.

- [Index](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/Index.tsx): landing route · Default landing/route dispatch for the public site. · `src/pages/Index.tsx`
- [Public pages](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/HomePage.tsx): routes · Customer-facing screens for browsing, accounts, and policy pages. · `src/pages/HomePage.tsx`
- [Product detail](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/ProductDetailPage.tsx): route page · Dedicated product detail view for catalog browsing. · `src/pages/ProductDetailPage.tsx`
- [Navbar](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Navbar.tsx): navigation · Primary public navigation component. · `src/components/Navbar.tsx`
- [Footer](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Footer.tsx): site footer · Shared bottom-of-page site chrome and links. · `src/components/Footer.tsx`
- [HomePage](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/HomePage.tsx): public screen · Main storefront landing page. · `src/pages/HomePage.tsx`
- [Catalog pages](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/ProductsPage.tsx): browse flows · Products, cart, wishlist, appointments, contact, login, signup, and policy pages. · `src/pages/ProductsPage.tsx`

### Admin area

Protected back-office screens and operational workflows.

- [Admin pages](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/pages/admin/Dashboard.tsx): protected routes · Back-office screens for dashboards, CRUD, and settings. · `src/pages/admin/Dashboard.tsx`
- [AdminLayout](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/AdminLayout.tsx): admin shell · Protected admin frame and navigation chrome. · `src/components/AdminLayout.tsx`

### Data boundary

Authentication, backend access, and domain services.

- [ProtectedRoute](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/ProtectedRoute.tsx): access guard · Route guard that gates admin access on auth state. · `src/components/ProtectedRoute.tsx`
- [AuthContext](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/contexts/AuthContext.tsx): auth state · Central auth provider, hooks, and user-role helpers. · `src/contexts/AuthContext.tsx`
- [Services](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/services/index.ts): domain APIs · Typed service layer for products, appointments, customers, testimonials, and admin actions. · `src/services/index.ts`
- [Supabase client](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/integrations/supabase/client.ts): backend client · Single client entrypoint and generated database types for Supabase. · `src/integrations/supabase/client.ts`
- [Shared utils](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/lib/utils.ts): helpers · Cross-cutting helpers, responsive hooks, toast utilities, and store metadata. · `src/lib/utils.ts`

### UI system

Reusable component library and shared UI primitives.

- [Feature UI](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/Testimonials.tsx): shared components · Higher-level reusable storefront components like testimonials, map, and dashboard charts. · `src/components/Testimonials.tsx`
- [UI primitives](https://github.com/nihaldr/lingam_aabharanam/blob/main/src/components/ui/button.tsx): shadcn ui · Low-level component library for forms, dialogs, tables, navigation, feedback, and layout controls. · `src/components/ui/button.tsx`

### Platform

Vite entrypoints, static delivery, and Supabase schema management.

- [Supabase schema](https://github.com/nihaldr/lingam_aabharanam/blob/main/supabase/migrations/20250614082944-29708651-989c-4d65-9dfb-96549351e274.sql): migrations · Versioned backend schema and configuration managed alongside the app. · `supabase/migrations/20250614082944-29708651-989c-4d65-9dfb-96549351e274.sql`

## Connections

- main.tsx → App.tsx: mounts · Bootstraps the application shell.
- App.tsx → Layout: wraps public · Uses the public site shell for storefront routes.
- App.tsx → AdminLayout: wraps admin · Uses the admin shell for protected back-office routes.
- App.tsx → Index: routes to · Dispatches landing/default navigation.
- App.tsx → Public pages: routes to · Dispatches public customer-facing pages.
- App.tsx → Product detail: routes to · Dispatches product detail screens.
- App.tsx → Admin pages: routes to · Dispatches admin screens behind auth.
- Layout → Navbar: includes · Public shell includes top navigation.
- Layout → Footer: includes · Public shell includes page footer.
- AdminLayout → ProtectedRoute: depends on · Admin shell relies on route protection.
- ProtectedRoute → AuthContext: checks · Uses auth state to allow or deny access.
- AuthContext → Supabase client: auth via · Auth state is backed by Supabase.
- Public pages → Services: reads data · Public screens use domain services instead of direct backend calls.
- Admin pages → Services: manages data · Admin workflows call domain services for CRUD and summaries.
- Services → Supabase client: queries · Services use the shared Supabase client.
- Supabase client → Supabase schema: typed by · Client follows the versioned database schema.
- HomePage → Feature UI: composes · Homepage is built from reusable feature components.
- Catalog pages → Feature UI: composes · Catalog and support flows reuse shared feature components.
- Feature UI → UI primitives: built on · Feature components are assembled from low-level UI primitives.
- Layout → UI primitives: uses · Shared shell styling and controls come from the UI library.
- AdminLayout → UI primitives: uses · Admin chrome and controls are built from the UI library.
- AuthContext → Shared utils: uses · Auth helpers and shared utilities shape user state and feedback.
- Services → Shared utils: uses · Services share common helpers and store metadata.
