How nihaldr/lingam_aabharanam works
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: App.tsx App.tsx · Layout.tsx Layout · index.ts Services · AdminLayout.tsx AdminLayout
Components 20
App shell
Application bootstrap, routing, and shared layouts.
Public site
Customer-facing pages and storefront flows.
- Index · Default landing/route dispatch for the public site.
src/pages/Index.tsx - Public pages · Customer-facing screens for browsing, accounts, and policy pages.
src/pages/HomePage.tsx - Product detail · Dedicated product detail view for catalog browsing.
src/pages/ProductDetailPage.tsx - Navbar · Primary public navigation component.
src/components/Navbar.tsx - Footer · Shared bottom-of-page site chrome and links.
src/components/Footer.tsx - HomePage · Main storefront landing page.
src/pages/HomePage.tsx - Catalog pages · 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 · Back-office screens for dashboards, CRUD, and settings.
src/pages/admin/Dashboard.tsx - AdminLayout · Protected admin frame and navigation chrome.
src/components/AdminLayout.tsx
Data boundary
Authentication, backend access, and domain services.
- ProtectedRoute · Route guard that gates admin access on auth state.
src/components/ProtectedRoute.tsx - AuthContext · Central auth provider, hooks, and user-role helpers.
src/contexts/AuthContext.tsx - Services · Typed service layer for products, appointments, customers, testimonials, and admin actions.
src/services/index.ts - Supabase client · Single client entrypoint and generated database types for Supabase.
src/integrations/supabase/client.ts - Shared utils · 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 · Higher-level reusable storefront components like testimonials, map, and dashboard charts.
src/components/Testimonials.tsx - UI primitives · 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 · Versioned backend schema and configuration managed alongside the app.
supabase/migrations/20250614082944-29708651-989c-4d65-9dfb-96549351e274.sql
Connections 23
- 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.