# rahat-karim5452/bazar-dor-web-app architecture

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

- Interactive diagram: https://gitdiagram.com/rahat-karim5452/bazar-dor-web-app
- Repository: https://github.com/rahat-karim5452/bazar-dor-web-app

## Overview

BazarDor is a daily essential-goods price browser: visitors scan headline price movements, browse and sort category listings, then open market-level price details. Detailed product prices require sign-in; users can create accounts, authenticate with email or social providers, view and update their profile, and sign out. Price data is fetched from the documented external API, while BetterAuth handles account flows. The sampled files show the product-data and authentication call sites; other feature links below rely on README statements where noted.

Main entry points: [`src/lib/auth-client.ts`](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/auth-client.ts) (Auth client), [`src/lib/api.ts`](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/api.ts) (Price data client), [`src/lib/use-require-auth.ts`](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/use-require-auth.ts) (Session guard), [`src/app/profile/page.tsx`](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/profile/page.tsx) (Profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Price discovery"]
  node_home["Home page<br/>[page.tsx]"]
  node_hero["Hero section<br/>[HeroSection.tsx]"]
  node_ticker["Price ticker<br/>[Marquee.tsx]"]
  node_navigation["Category navigation<br/>[Navbar.tsx]"]
  node_productcards["Price movers<br/>[ProductCards.tsx]"]
  node_category["Category browser<br/>[page.tsx]"]
  node_siteframe["Shared site layout<br/>[layout.tsx]"]
end

subgraph group_details["Product details"]
  node_productdetail["Product detail<br/>[page.tsx]"]
end

subgraph group_accounts["Accounts"]
  node_authgate["Session guard"]
  node_signin["Sign in<br/>[page.tsx]"]
  node_signup["Sign up<br/>[page.tsx]"]
  node_social["Social sign-in"]
  node_authclient["Auth client<br/>[auth-client.ts]"]
  node_authroute["Auth endpoint<br/>[route.ts]"]
  node_authserver["Auth server<br/>[auth.ts]"]
  node_profile["Profile<br/>[page.tsx]"]
  node_profileupdate["Profile update<br/>[page.tsx]"]
  node_profilemenu["Profile menu"]
end

subgraph group_services["External services"]
  node_priceapi["Price data client<br/>[api.ts]"]
  node_marketapi{{"BazarDor API"}}
  node_identityproviders{{"Google and GitHub"}}
  node_mongodb[("MongoDB Atlas")]
end

node_visitor(("Market visitor"))

node_visitor -->|"browses"| node_home
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_productcards
node_siteframe -->|"renders"| node_navigation
node_siteframe -->|"renders"| node_ticker
node_siteframe -.->|"wraps"| node_home
node_ticker -->|"loads prices"| node_priceapi
node_productcards -->|"loads products"| node_priceapi
node_navigation -->|"loads categories"| node_priceapi
node_visitor -->|"browses category"| node_category
node_category -->|"loads listings"| node_priceapi
node_category -.->|"opens product"| node_productdetail
node_visitor -->|"requests details"| node_productdetail
node_productdetail -->|"checks session"| node_authgate
node_productdetail -->|"loads product data"| node_priceapi
node_priceapi -->|"fetches prices"| node_marketapi
node_visitor -->|"signs in"| node_signin
node_visitor -->|"creates account"| node_signup
node_signup -->|"registers email"| node_authclient
node_signin -->|"authenticates email"| node_authclient
node_signin -->|"offers providers"| node_social
node_signup -->|"offers providers"| node_social
node_social -->|"starts social sign-in"| node_authclient
node_authclient -.->|"calls auth API"| node_authroute
node_authroute -->|"dispatches requests"| node_authserver
node_authclient -.->|"uses OAuth"| node_identityproviders
node_visitor -->|"views account"| node_profile
node_profile -->|"checks session"| node_authgate
node_profile -->|"signs out"| node_authclient
node_profile -->|"opens update"| node_profileupdate
node_profileupdate -->|"checks session"| node_authgate
node_profileupdate -->|"updates account"| node_authclient
node_profilemenu -->|"reads session"| node_authclient
node_profilemenu -->|"uses guard"| node_authgate
node_authgate -->|"reads session"| node_authclient
node_authserver -.->|"persists accounts"| node_mongodb

click node_home "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/page.tsx"
click node_hero "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/HeroSection.tsx"
click node_ticker "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/Marquee.tsx"
click node_navigation "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/Navbar.tsx"
click node_productcards "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/ProductCards.tsx"
click node_category "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/category/%5Bslug%5D/page.tsx"
click node_priceapi "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/api.ts"
click node_productdetail "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/product/%5Bslug%5D/page.tsx"
click node_authgate "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/use-require-auth.ts"
click node_signin "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/signin/page.tsx"
click node_signup "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/signup/page.tsx"
click node_social "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/SocialAuthButtons.tsx"
click node_authclient "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/auth-client.ts"
click node_authroute "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/api/auth/%5B...all%5D/route.ts"
click node_authserver "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/auth.ts"
click node_profile "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/profile/page.tsx"
click node_profileupdate "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/profile/update/page.tsx"
click node_profilemenu "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/UserProfileMenu.tsx"
click node_siteframe "https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/layout.tsx"

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_home,node_hero,node_ticker,node_navigation,node_productcards,node_category,node_siteframe toneBlue
class node_productdetail toneAmber
class node_authgate,node_signin,node_signup,node_social,node_authclient,node_authroute,node_authserver,node_profile,node_profileupdate,node_profilemenu toneMint
class node_priceapi,node_marketapi,node_identityproviders,node_mongodb toneRose
class node_visitor toneIndigo
```

## Components

### Price discovery

- [Home page](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Hero section](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/HeroSection.tsx): `src/app/components/HeroSection.tsx`
- [Price ticker](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/Marquee.tsx): `src/app/components/Marquee.tsx`
- [Category navigation](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/Navbar.tsx): `src/app/components/Navbar.tsx`
- [Price movers](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/ProductCards.tsx): `src/app/components/ProductCards.tsx`
- [Category browser](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/category/%5Bslug%5D/page.tsx): `src/app/category/[slug]/page.tsx`
- [Shared site layout](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/layout.tsx): `src/app/layout.tsx`

### Product details

- [Product detail](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/product/%5Bslug%5D/page.tsx): `src/app/product/[slug]/page.tsx`

### Accounts

- [Session guard](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/use-require-auth.ts): `src/lib/use-require-auth.ts`
- [Sign in](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/signin/page.tsx): `src/app/signin/page.tsx`
- [Sign up](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/signup/page.tsx): `src/app/signup/page.tsx`
- [Social sign-in](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/SocialAuthButtons.tsx): `src/app/components/SocialAuthButtons.tsx`
- [Auth client](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/auth-client.ts): `src/lib/auth-client.ts`
- [Auth endpoint](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/api/auth/%5B...all%5D/route.ts): `src/app/api/auth/[...all]/route.ts`
- [Auth server](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Profile](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/profile/page.tsx): `src/app/profile/page.tsx`
- [Profile update](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/profile/update/page.tsx): `src/app/profile/update/page.tsx`
- [Profile menu](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/app/components/UserProfileMenu.tsx): `src/app/components/UserProfileMenu.tsx`

### External services

- [Price data client](https://github.com/rahat-karim5452/bazar-dor-web-app/blob/main/src/lib/api.ts): `src/lib/api.ts`
- **BazarDor API**
- **Google and GitHub**
- **MongoDB Atlas**

### Other components

- **Market visitor**

## Connections

- Market visitor → Home page: browses (evidence: `README.md`)
- Home page → Hero section: renders (evidence: `src/app/page.tsx`)
- Home page → Price movers: renders (evidence: `src/app/page.tsx`)
- Shared site layout → Category navigation: renders (evidence: `src/app/layout.tsx`)
- Shared site layout → Price ticker: renders (evidence: `src/app/layout.tsx`)
- Shared site layout → Home page: wraps
- Price ticker → Price data client: loads prices (evidence: `src/app/components/Marquee.tsx`)
- Price movers → Price data client: loads products (evidence: `src/app/components/ProductCards.tsx`)
- Category navigation → Price data client: loads categories (evidence: `src/app/components/Navbar.tsx`)
- Market visitor → Category browser: browses category (evidence: `README.md`)
- Category browser → Price data client: loads listings (evidence: `src/app/category/[slug]/page.tsx`)
- Category browser → Product detail: opens product
- Market visitor → Product detail: requests details (evidence: `README.md`)
- Product detail → Session guard: checks session (evidence: `src/app/product/[slug]/page.tsx`)
- Product detail → Price data client: loads product data (evidence: `src/app/product/[slug]/page.tsx`)
- Price data client → BazarDor API: fetches prices (evidence: `src/lib/api.ts`)
- Market visitor → Sign in: signs in (evidence: `README.md`)
- Market visitor → Sign up: creates account (evidence: `README.md`)
- Sign up → Auth client: registers email (evidence: `src/app/signup/page.tsx`)
- Sign in → Auth client: authenticates email (evidence: `src/app/signin/page.tsx`)
- Sign in → Social sign-in: offers providers (evidence: `src/app/signin/page.tsx`)
- Sign up → Social sign-in: offers providers (evidence: `src/app/signup/page.tsx`)
- Social sign-in → Auth client: starts social sign-in (evidence: `src/app/components/SocialAuthButtons.tsx`)
- Auth client → Auth endpoint: calls auth API
- Auth endpoint → Auth server: dispatches requests (evidence: `src/app/api/auth/[...all]/route.ts`)
- Auth client → Google and GitHub: uses OAuth (evidence: `README.md`)
- Market visitor → Profile: views account (evidence: `README.md`)
- Profile → Session guard: checks session (evidence: `src/app/profile/page.tsx`)
- Profile → Auth client: signs out (evidence: `src/app/profile/page.tsx`)
- Profile → Profile update: opens update (evidence: `src/app/profile/page.tsx`)
- Profile update → Session guard: checks session (evidence: `src/app/profile/update/page.tsx`)
- Profile update → Auth client: updates account (evidence: `src/app/profile/update/page.tsx`)
- Profile menu → Auth client: reads session (evidence: `src/app/components/UserProfileMenu.tsx`)
- Profile menu → Session guard: uses guard (evidence: `src/app/components/UserProfileMenu.tsx`)
- Session guard → Auth client: reads session (evidence: `src/lib/use-require-auth.ts`)
- Auth server → MongoDB Atlas: persists accounts (evidence: `README.md`)
