# boluski2/karken- architecture

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

- Interactive diagram: https://gitdiagram.com/boluski2/karken-
- Repository: https://github.com/boluski2/karken-

## Overview

#### Purpose and Runtime
Baltic Harvest Hub is a bilingual (Lithuanian/English), SEO-focused B2B marketing site for Karken Company, an African-food distributor serving Lithuania/Baltic markets. It is a client-side React/TypeScript application built and served by Vite; there is no backend API or database in this repository. Primary bootstrapping is `src/main.tsx`, which mounts the application defined in `src/App.tsx`.

#### Application Shell and Navigation
`src/App.tsx` composes global providers and React Router routes for the marketing pages. `src/components/Layout.tsx` provides the shared page frame, with navigation and site-level chrome supplied by `src/components/Header.tsx` and `src/components/Footer.tsx`. Route targets are independently authored content pages such as `src/pages/Index.tsx`, `src/pages/Products.tsx`, and `src/pages/Contact.tsx`; unmatched paths terminate in `src/pages/NotFound.tsx`.

#### Language State Boundary
Bilingual content is controlled centrally through `src/contexts/LanguageContext.tsx`. Components/pages consume language state rather than calling an external translation service, making locale selection an in-browser UI state boundary. The provider is established at application level in `src/App.tsx`, allowing shared header navigation and route content to stay synchronized.

#### Marketing Content and Media Delivery
The route pages render static distributor/service/product/compliance content and locally bundled imagery. `src/components/OptimizedImage.tsx` is the media delivery boundary: it uses IntersectionObserver-based lazy loading while permitting priority hero loads. Responsive AVIF variants live alongside originals under `src/assets/`, for example `src/assets/hero-nigerian-food-w320.avif`, `src/assets/hero-nigerian-food-w1024.avif`, and `src/assets/hero-nigerian-food-w1600.avif`. Asset metadata is generated into `src/assets/optimized-manifest.json`.

#### SEO and Public Discoverability
Each route can declare title, metadata, social cards, and structured JSON-LD through `src/components/SEO.tsx`. This isolates document-head mutation from page rendering and relies on the React Helmet runtime described by the project. Crawl behavior is exposed at `public/robots.txt`; Vercel deployment behavior is defined in `vercel.json`.

#### Lead Capture Integration
Contact UI is hosted by `src/pages/Contact.tsx`; EmailJS configuration is isolated in `src/config/emailjs.ts`. The browser submits lead-form data to EmailJS rather than an application-owned server, so EmailJS is the material external service and configuration/secrets boundary. UI feedback uses the local toast infrastructure, including `src/components/ui/toaster.tsx`.

#### Build, Styling, and Asset Pipeline
Vite provides development and production bundling via `vite.config.ts`; package scripts and dependency runtime definitions are in `package.json`. Tailwind drives the responsive design system through `tailwind.config.ts`, with global CSS at `src/index.css` and application styling at `src/App.css`. Source-image transformations and responsive manifest generation are handled before runtime by `scripts/optimize-images.js` and `scripts/generate-manifest.js`.

Main entry points: [`src/App.tsx`](https://github.com/boluski2/karken-/blob/main/src/App.tsx) (App and routes), [`src/pages/Contact.tsx`](https://github.com/boluski2/karken-/blob/main/src/pages/Contact.tsx) (Contact and lead form), [`src/pages/Index.tsx`](https://github.com/boluski2/karken-/blob/main/src/pages/Index.tsx) (Marketing pages), [`src/components/Layout.tsx`](https://github.com/boluski2/karken-/blob/main/src/components/Layout.tsx) (Shared layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Client Runtime"]
  node_vite{{"Vite<br/>build runtime<br/>[vite.config.ts]"}}
  node_main["Application bootstrap<br/>React entry<br/>[main.tsx]"]
  node_app["App and routes<br/>React router shell<br/>[App.tsx]"]
  node_language["Language state<br/>locale provider"]
  node_emailconfig["EmailJS configuration<br/>integration config<br/>[emailjs.ts]"]
end

subgraph group_ui["UI and Content"]
  node_layout["Shared layout<br/>page frame<br/>[Layout.tsx]"]
  node_header["Header navigation<br/>shared component<br/>[Header.tsx]"]
  node_footer["Footer<br/>shared component<br/>[Footer.tsx]"]
  node_pages["Marketing pages<br/>route content<br/>[Index.tsx]"]
  node_products["Products page<br/>route content<br/>[Products.tsx]"]
  node_contact["Contact and lead form<br/>route content<br/>[Contact.tsx]"]
  node_notfound["Not found page<br/>fallback route<br/>[NotFound.tsx]"]
  node_seo["SEO head manager<br/>metadata component<br/>[SEO.tsx]"]
  node_images["Optimized image loader<br/>media component<br/>[OptimizedImage.tsx]"]
  node_toast["Toast feedback<br/>UI feedback<br/>[toaster.tsx]"]
end

subgraph group_delivery["Delivery and Build"]
  node_assets["Responsive image assets<br/>bundled media"]
  node_assetpipeline{{"Image optimization pipeline<br/>prebuild scripts<br/>[optimize-images.js]"}}
  node_tailwind["Tailwind design system<br/>styling<br/>[tailwind.config.ts]"]
  node_robots["Crawl policy<br/>public SEO file<br/>[robots.txt]"]
  node_vercel["Vercel deployment<br/>deployment config<br/>[vercel.json]"]
end

node_emailjs{{"EmailJS<br/>external lead service"}}

node_vite -->|"builds and serves"| node_main
node_main -->|"mounts"| node_app
node_app -->|"provides"| node_language
node_app -->|"wraps routes"| node_layout
node_layout -->|"includes"| node_header
node_layout -->|"includes"| node_footer
node_app -->|"routes to"| node_pages
node_app -->|"routes to"| node_products
node_app -->|"routes to"| node_contact
node_app -->|"falls back to"| node_notfound
node_header -->|"consumes"| node_language
node_pages -->|"consumes"| node_language
node_pages -->|"declares metadata"| node_seo
node_products -->|"declares metadata"| node_seo
node_contact -->|"declares metadata"| node_seo
node_pages -->|"renders media"| node_images
node_images -->|"loads variants"| node_assets
node_assetpipeline -->|"generates"| node_assets
node_contact -->|"uses"| node_emailconfig
node_contact -->|"submits leads"| node_emailjs
node_contact -->|"shows feedback"| node_toast
node_tailwind -.->|"styles"| node_app
node_robots -.->|"published with site"| node_vite
node_vercel -.->|"deploys build"| node_vite

click node_vite "https://github.com/boluski2/karken-/blob/main/vite.config.ts"
click node_main "https://github.com/boluski2/karken-/blob/main/src/main.tsx"
click node_app "https://github.com/boluski2/karken-/blob/main/src/App.tsx"
click node_language "https://github.com/boluski2/karken-/blob/main/src/contexts/LanguageContext.tsx"
click node_layout "https://github.com/boluski2/karken-/blob/main/src/components/Layout.tsx"
click node_header "https://github.com/boluski2/karken-/blob/main/src/components/Header.tsx"
click node_footer "https://github.com/boluski2/karken-/blob/main/src/components/Footer.tsx"
click node_pages "https://github.com/boluski2/karken-/blob/main/src/pages/Index.tsx"
click node_products "https://github.com/boluski2/karken-/blob/main/src/pages/Products.tsx"
click node_contact "https://github.com/boluski2/karken-/blob/main/src/pages/Contact.tsx"
click node_notfound "https://github.com/boluski2/karken-/blob/main/src/pages/NotFound.tsx"
click node_seo "https://github.com/boluski2/karken-/blob/main/src/components/SEO.tsx"
click node_images "https://github.com/boluski2/karken-/blob/main/src/components/OptimizedImage.tsx"
click node_toast "https://github.com/boluski2/karken-/blob/main/src/components/ui/toaster.tsx"
click node_emailconfig "https://github.com/boluski2/karken-/blob/main/src/config/emailjs.ts"
click node_assets "https://github.com/boluski2/karken-/blob/main/src/assets/optimized-manifest.json"
click node_assetpipeline "https://github.com/boluski2/karken-/blob/main/scripts/optimize-images.js"
click node_tailwind "https://github.com/boluski2/karken-/blob/main/tailwind.config.ts"
click node_robots "https://github.com/boluski2/karken-/blob/main/public/robots.txt"
click node_vercel "https://github.com/boluski2/karken-/blob/main/vercel.json"

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_vite,node_main,node_app,node_language,node_emailconfig toneBlue
class node_layout,node_header,node_footer,node_pages,node_products,node_contact,node_notfound,node_seo,node_images,node_toast toneAmber
class node_assets,node_assetpipeline,node_tailwind,node_robots,node_vercel toneMint
class node_emailjs toneNeutral
```

## Components

### Client Runtime

Vite-served React application.

- [Vite](https://github.com/boluski2/karken-/blob/main/vite.config.ts): build runtime · Builds and serves the client application. · `vite.config.ts`
- [Application bootstrap](https://github.com/boluski2/karken-/blob/main/src/main.tsx): React entry · `src/main.tsx`
- [App and routes](https://github.com/boluski2/karken-/blob/main/src/App.tsx): React router shell · Establishes providers and page routes. · `src/App.tsx`
- [Language state](https://github.com/boluski2/karken-/blob/main/src/contexts/LanguageContext.tsx): locale provider · Synchronizes Lithuanian and English UI state. · `src/contexts/LanguageContext.tsx`
- [EmailJS configuration](https://github.com/boluski2/karken-/blob/main/src/config/emailjs.ts): integration config · Browser-side EmailJS configuration boundary. · `src/config/emailjs.ts`

### UI and Content

Shared shell and route-driven marketing content.

- [Shared layout](https://github.com/boluski2/karken-/blob/main/src/components/Layout.tsx): page frame · `src/components/Layout.tsx`
- [Header navigation](https://github.com/boluski2/karken-/blob/main/src/components/Header.tsx): shared component · `src/components/Header.tsx`
- [Footer](https://github.com/boluski2/karken-/blob/main/src/components/Footer.tsx): shared component · `src/components/Footer.tsx`
- [Marketing pages](https://github.com/boluski2/karken-/blob/main/src/pages/Index.tsx): route content · Distributor, product, service, and compliance content. · `src/pages/Index.tsx`
- [Products page](https://github.com/boluski2/karken-/blob/main/src/pages/Products.tsx): route content · `src/pages/Products.tsx`
- [Contact and lead form](https://github.com/boluski2/karken-/blob/main/src/pages/Contact.tsx): route content · `src/pages/Contact.tsx`
- [Not found page](https://github.com/boluski2/karken-/blob/main/src/pages/NotFound.tsx): fallback route · `src/pages/NotFound.tsx`
- [SEO head manager](https://github.com/boluski2/karken-/blob/main/src/components/SEO.tsx): metadata component · Sets metadata, social cards, and JSON-LD. · `src/components/SEO.tsx`
- [Optimized image loader](https://github.com/boluski2/karken-/blob/main/src/components/OptimizedImage.tsx): media component · Lazy loads responsive images, with priority hero support. · `src/components/OptimizedImage.tsx`
- [Toast feedback](https://github.com/boluski2/karken-/blob/main/src/components/ui/toaster.tsx): UI feedback · `src/components/ui/toaster.tsx`

### Delivery and Build

Static assets, discovery files, and build tooling.

- [Responsive image assets](https://github.com/boluski2/karken-/blob/main/src/assets/optimized-manifest.json): bundled media · AVIF variants and generated asset manifest. · `src/assets/optimized-manifest.json`
- [Image optimization pipeline](https://github.com/boluski2/karken-/blob/main/scripts/optimize-images.js): prebuild scripts · Generates responsive image variants and manifest metadata. · `scripts/optimize-images.js`
- [Tailwind design system](https://github.com/boluski2/karken-/blob/main/tailwind.config.ts): styling · Drives responsive site styling. · `tailwind.config.ts`
- [Crawl policy](https://github.com/boluski2/karken-/blob/main/public/robots.txt): public SEO file · `public/robots.txt`
- [Vercel deployment](https://github.com/boluski2/karken-/blob/main/vercel.json): deployment config · `vercel.json`

### Other components

- **EmailJS**: external lead service · Receives browser-submitted lead forms.

## Connections

- Vite → Application bootstrap: builds and serves
- Application bootstrap → App and routes: mounts
- App and routes → Language state: provides
- App and routes → Shared layout: wraps routes
- Shared layout → Header navigation: includes
- Shared layout → Footer: includes
- App and routes → Marketing pages: routes to
- App and routes → Products page: routes to
- App and routes → Contact and lead form: routes to
- App and routes → Not found page: falls back to
- Header navigation → Language state: consumes
- Marketing pages → Language state: consumes
- Marketing pages → SEO head manager: declares metadata
- Products page → SEO head manager: declares metadata
- Contact and lead form → SEO head manager: declares metadata
- Marketing pages → Optimized image loader: renders media
- Optimized image loader → Responsive image assets: loads variants
- Image optimization pipeline → Responsive image assets: generates
- Contact and lead form → EmailJS configuration: uses
- Contact and lead form → EmailJS: submits leads
- Contact and lead form → Toast feedback: shows feedback
- Tailwind design system → App and routes: styles
- Crawl policy → Vite: published with site
- Vercel deployment → Vite: deploys build
