# dhruvasingh12/aushadh-info architecture

> Architecture diagram of the GitHub repository dhruvasingh12/aushadh-info, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhruvasingh12/aushadh-info
- Repository: https://github.com/dhruvasingh12/aushadh-info

## Overview

##### Project type and purpose
- This is a full-stack Next.js 13 application (“app” router) named “AushadhInfo” that provides medicine and manufacturer information pages, search and filtering capabilities, and an on-the-fly translation API endpoint.
- Key features:
- Dynamic medicine and manufacturer pages under `app/medicine/[id]` and `app/manufacturer/[manufacturerName]`
- Search and browse lists of medicines and categories
- A custom Next.js API route for text translation (`app/api/translate/route.ts`)
- Supabase integration for data and authentication (`providers/SupabaseProvider.tsx`)
- Shared UI components and utility libraries for data fetching, caching, and business logic in `lib/`

##### File structure
- Top-level directories:
- `app/` – Next.js routes (server and client components), layouts, global CSS
◦ `app/(site)/` – marketing site pages and shared UI sections
◦ `app/medicine/` & `app/manufacturer/` – dynamic routes and page-specific components
◦ `app/api/translate/` – REST API route for translations
- `components/` – globally shared React UI components (buttons, dialogs, tooltips, pagination, etc.)
- `components/ui/` – low-level design system primitives (Input, Table, Toaster, etc.)
- `lib/` – data-access and business logic (fetching from Supabase, caching, grouping stats, translation helper, etc.)
- `providers/` – React context providers (SupabaseProvider)
- `hooks/` – custom React hooks (debounce)
- `public/` – static assets
- Config files: `next.config.ts`, `tailwind.config.ts`, ESLint, TypeScript, PostCSS.

##### README
- Minimal (“work under progress”), but project name (“AushadhInfo”) implies an information portal for medicines.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Browser"]:::front

    %% Next.js Server Layer
    subgraph "Next.js Server"
        direction TB
        PageRouting["Page Routing & SSR"]:::server
        APITranslate["API Route: /api/translate"]:::server

        subgraph "UI Layer"
            direction TB
            MedPage["Dynamic Medicine Page"]:::front
            click MedPage "https://github.com/dhruvasingh12/aushadh-info/blob/master/app/medicine/[id]/page.tsx"

            ManuPage["Dynamic Manufacturer Page"]:::front
            click ManuPage "https://github.com/dhruvasingh12/aushadh-info/blob/master/app/manufacturer/[manufacturerName]/page.tsx"

            MedListPage["Medicine List/Search Page"]:::front
            click MedListPage "https://github.com/dhruvasingh12/aushadh-info/blob/master/app/medicine/page.tsx"

            MarketingPage["Marketing Site Page"]:::front
            click MarketingPage "https://github.com/dhruvasingh12/aushadh-info/blob/master/app/(site)/page.tsx"

            Layout["Global Layout"]:::front
            click Layout "https://github.com/dhruvasingh12/aushadh-info/blob/master/app/layout.tsx"
        end

        subgraph "Shared UI Components"
            direction TB
            GlobalComps["components/"]:::front
            click GlobalComps "https://github.com/dhruvasingh12/aushadh-info/tree/master/components/"

            DesignPrims["components/ui/"]:::front
            click DesignPrims "https://github.com/dhruvasingh12/aushadh-info/tree/master/components/ui/"
        end

        subgraph "Business Logic / Data Access"
            direction TB
            LibFolder["lib/"]:::service
            click LibFolder "https://github.com/dhruvasingh12/aushadh-info/tree/master/lib/"
        end

        Provider["SupabaseProvider"]:::service
        click Provider "https://github.com/dhruvasingh12/aushadh-info/blob/master/providers/SupabaseProvider.tsx"

        Hook["useDebounce Hook"]:::service
        click Hook "https://github.com/dhruvasingh12/aushadh-info/blob/master/hooks/useDebounce.ts"
    end

    %% External Services
    SupabaseDB[(Supabase DB)]:::db
    ExternalTrans["External Translation API"]:::externalApi

    %% Data Flows
    Browser -->|"GET /medicine/[id] (SSR)"| PageRouting
    PageRouting -->|"getMedicineById() etc."| LibFolder
    LibFolder --> SupabaseDB
    SupabaseDB --> LibFolder
    LibFolder --> PageRouting
    PageRouting --> Browser

    Browser -->|"GET /medicine (Client Navigation)"| PageRouting
    Browser -.->|"POST /api/translate"| APITranslate
    APITranslate -->|"translate.ts" | LibFolder
    APITranslate --> ExternalTrans
    ExternalTrans --> APITranslate
    APITranslate --> Browser

    %% Styles
    classDef front fill:#cce5ff,stroke:#004085,color:#004085;
    classDef server fill:#e2e2e2,stroke:#7a7a7a,color:#41464b;
    classDef service fill:#d1ecf1,stroke:#0c5460,color:#0c5460;
    classDef db fill:#d4edda,stroke:#155724,color:#155724;
    classDef externalApi fill:#fff3cd,stroke:#856404,color:#856404;
```
