# rs9313399-dot/saatvik-cars architecture

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

- Interactive diagram: https://gitdiagram.com/rs9313399-dot/saatvik-cars
- Repository: https://github.com/rs9313399-dot/saatvik-cars

## Overview

Saatvik Cars is a used-car marketplace and dealership site. Customers browse and filter inventory, inspect listings, and contact the dealership through test-drive, callback, service, or sell-car inquiries; administrators manage listings and review submissions. The graph also preserves documented content, trust, chat, newsletter, and SEO capabilities. Source excerpts show selected API-to-database and valuation/authentication calls; other links are limited to README-documented relationships because those implementation files were not sampled.

Main entry points: [`src/lib/db.ts`](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/db.ts) (Neon database), [`src/app`](https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/app) (Site pages), [`src/components/cars/FeaturedCars.tsx`](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/FeaturedCars.tsx) (Inventory browsing), [`src/app/api/cars`](https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/app/api/cars) (Inventory API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_marketplace["Marketplace experience"]
  node_site["Site pages"]
  node_inventory_ui["Inventory browsing<br/>[FeaturedCars.tsx]"]
  node_filters["Inventory filters<br/>[FilterSidebar.tsx]"]
  node_fitness["Fitness pages"]
end

subgraph group_operations["Dealership operations"]
  node_admin_ui["Admin panel<br/>[AdminPanel.tsx]"]
  node_leads["Test drive leads<br/>[route.ts]"]
  node_sell["Sell-car inquiry<br/>[route.ts]"]
  node_service["Service inquiries<br/>[route.ts]"]
  node_uploads["Image uploads<br/>[route.ts]"]
end

subgraph group_content["Content and trust"]
  node_reviews_ui["Customer reviews"]
  node_testimonials["Testimonials API<br/>[route.ts]"]
  node_blog["Blog content<br/>[route.ts]"]
  node_chat["Live chat<br/>[route.ts]"]
  node_newsletter["Newsletter<br/>[route.ts]"]
  node_seo["SEO sitemap<br/>[sitemap.ts]"]
end

subgraph group_platform["Application services"]
  node_car_api["Inventory API"]
  node_auth["Admin authentication<br/>[auth.ts]"]
  node_valuation["Car valuation<br/>[valuation.ts]"]
  node_storage["Object storage<br/>[storage.ts]"]
  node_database[("Neon database<br/>[db.ts]")]
  node_business["Dealership details<br/>[business.ts]"]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"visits"| node_site
node_site -.->|"presents"| node_inventory_ui
node_customer -->|"browses"| node_inventory_ui
node_inventory_ui -->|"uses"| node_filters
node_inventory_ui -->|"fetches listings"| node_car_api
node_car_api -->|"reads and writes"| node_database
node_admin -->|"manages inventory"| node_admin_ui
node_admin_ui -.->|"manages listings"| node_car_api
node_car_api -->|"checks access"| node_auth
node_auth -->|"checks admin"| node_database
node_customer -->|"requests test drive"| node_leads
node_leads -->|"stores leads"| node_database
node_customer -->|"requests valuation"| node_sell
node_sell -->|"estimates value"| node_valuation
node_sell -->|"stores inquiry"| node_database
node_customer -->|"requests service"| node_service
node_service -->|"stores inquiry"| node_database
node_admin -->|"reviews inquiries"| node_service
node_admin -->|"uploads images"| node_uploads
node_uploads -->|"authorizes uploads"| node_storage
node_customer -->|"submits review"| node_reviews_ui
node_reviews_ui -.->|"loads and submits"| node_testimonials
node_testimonials -->|"reads and writes"| node_database
node_customer -->|"reads posts"| node_blog
node_customer -->|"chats"| node_chat
node_chat -->|"persists messages"| node_database
node_customer -->|"subscribes"| node_newsletter
node_newsletter -->|"stores subscribers"| node_database
node_site -->|"provides sitemap"| node_seo
node_site -.->|"uses details"| node_business
node_customer -.->|"visits"| node_fitness

click node_site "https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/app"
click node_inventory_ui "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/FeaturedCars.tsx"
click node_filters "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/FilterSidebar.tsx"
click node_car_api "https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/app/api/cars"
click node_admin_ui "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/AdminPanel.tsx"
click node_auth "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/auth.ts"
click node_leads "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/leads/route.ts"
click node_sell "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/sell-inquiry/route.ts"
click node_valuation "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/valuation.ts"
click node_service "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/service-inquiry/route.ts"
click node_uploads "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/upload/route.ts"
click node_storage "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/storage.ts"
click node_reviews_ui "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/CustomerReviews.tsx"
click node_testimonials "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/testimonials/route.ts"
click node_blog "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/blog/route.ts"
click node_chat "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/chat/route.ts"
click node_newsletter "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/newsletter/route.ts"
click node_seo "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/sitemap.ts"
click node_database "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/db.ts"
click node_business "https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/business.ts"
click node_fitness "https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/components/fitness"

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_site,node_inventory_ui,node_filters,node_fitness toneBlue
class node_admin_ui,node_leads,node_sell,node_service,node_uploads toneAmber
class node_reviews_ui,node_testimonials,node_blog,node_chat,node_newsletter,node_seo toneMint
class node_car_api,node_auth,node_valuation,node_storage,node_database,node_business toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Marketplace experience

- [Site pages](https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/app): `src/app`
- [Inventory browsing](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/FeaturedCars.tsx): `src/components/cars/FeaturedCars.tsx`
- [Inventory filters](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/FilterSidebar.tsx): `src/components/cars/FilterSidebar.tsx`
- [Fitness pages](https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/components/fitness): `src/components/fitness`

### Dealership operations

- [Admin panel](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/AdminPanel.tsx): `src/components/cars/AdminPanel.tsx`
- [Test drive leads](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/leads/route.ts): `src/app/api/leads/route.ts`
- [Sell-car inquiry](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/sell-inquiry/route.ts): `src/app/api/sell-inquiry/route.ts`
- [Service inquiries](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/service-inquiry/route.ts): `src/app/api/service-inquiry/route.ts`
- [Image uploads](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/upload/route.ts): `src/app/api/upload/route.ts`

### Content and trust

- [Customer reviews](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/components/cars/CustomerReviews.tsx): `src/components/cars/CustomerReviews.tsx`
- [Testimonials API](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/testimonials/route.ts): `src/app/api/testimonials/route.ts`
- [Blog content](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/blog/route.ts): `src/app/api/blog/route.ts`
- [Live chat](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [Newsletter](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/api/newsletter/route.ts): `src/app/api/newsletter/route.ts`
- [SEO sitemap](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/app/sitemap.ts): `src/app/sitemap.ts`

### Application services

- [Inventory API](https://github.com/rs9313399-dot/saatvik-cars/tree/main/src/app/api/cars): `src/app/api/cars`
- [Admin authentication](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Car valuation](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/valuation.ts): `src/lib/valuation.ts`
- [Object storage](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Neon database](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Dealership details](https://github.com/rs9313399-dot/saatvik-cars/blob/main/src/lib/business.ts): `src/lib/business.ts`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Site pages: visits
- Site pages → Inventory browsing: presents
- Customer → Inventory browsing: browses
- Inventory browsing → Inventory filters: uses (evidence: `src/components/cars/FeaturedCars.tsx`)
- Inventory browsing → Inventory API: fetches listings (evidence: `src/components/cars/FeaturedCars.tsx`)
- Inventory API → Neon database: reads and writes (evidence: `src/app/api/cars/route.ts`)
- Administrator → Admin panel: manages inventory
- Admin panel → Inventory API: manages listings
- Inventory API → Admin authentication: checks access (evidence: `src/app/api/cars/route.ts`)
- Admin authentication → Neon database: checks admin (evidence: `src/lib/auth.ts`)
- Customer → Test drive leads: requests test drive (evidence: `src/app/api/leads/route.ts`)
- Test drive leads → Neon database: stores leads (evidence: `src/app/api/leads/route.ts`)
- Customer → Sell-car inquiry: requests valuation
- Sell-car inquiry → Car valuation: estimates value (evidence: `src/app/api/sell-inquiry/route.ts`)
- Sell-car inquiry → Neon database: stores inquiry (evidence: `src/app/api/sell-inquiry/route.ts`)
- Customer → Service inquiries: requests service (evidence: `src/app/api/service-inquiry/route.ts`)
- Service inquiries → Neon database: stores inquiry (evidence: `src/app/api/service-inquiry/route.ts`)
- Administrator → Service inquiries: reviews inquiries (evidence: `src/app/api/service-inquiry/route.ts`)
- Administrator → Image uploads: uploads images
- Image uploads → Object storage: authorizes uploads (evidence: `src/app/api/upload/route.ts`)
- Customer → Customer reviews: submits review
- Customer reviews → Testimonials API: loads and submits
- Testimonials API → Neon database: reads and writes (evidence: `src/app/api/testimonials/route.ts`)
- Customer → Blog content: reads posts
- Customer → Live chat: chats
- Live chat → Neon database: persists messages (evidence: `src/app/api/chat/route.ts`)
- Customer → Newsletter: subscribes (evidence: `src/app/api/newsletter/route.ts`)
- Newsletter → Neon database: stores subscribers (evidence: `src/app/api/newsletter/route.ts`)
- Site pages → SEO sitemap: provides sitemap
- Site pages → Dealership details: uses details (evidence: `src/app/api/chat/route.ts`)
- Customer → Fitness pages: visits
