# theshafcodes/logivshaf architecture

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

- Interactive diagram: https://gitdiagram.com/theshafcodes/logivshaf
- Repository: https://github.com/theshafcodes/logivshaf

## Overview

1. This repository is organized as a single main application: `quotation-extractor`, built with Next.js and TypeScript. The rest of the repo is mostly guidance/specification material rather than separate deployable services.

2. The runtime boundary is the Next.js app under `quotation-extractor/app`. `app/page.tsx` is the user-facing entry point, with `app/layout.tsx` and `app/globals.css` providing the shell and styling. This suggests a browser-driven upload/analysis workflow.

3. The backend surface is implemented as App Router API routes:
   - `app/api/extract/route.ts` for the primary end-to-end quotation extraction flow
   - `app/api/extract-raw/route.ts` for a lower-level/raw extraction path  
   These routes are the main orchestration layer and likely the only HTTP APIs exposed by the app.

4. The core integration with document processing lives in `lib/adobe-extract.ts`. This is the external-service boundary and appears to handle PDF/document extraction via Adobe’s extraction tooling or API.

5. `lib/parse-quotation.ts` is the domain transformation layer. It likely converts extracted document text/structure into a normalized quotation model, separating vendor-specific PDF extraction from business-specific parsing.

6. `lib/pdf-config.ts` holds extraction-related configuration for PDFs. That makes PDF handling a first-class concern, and it likely controls page/input settings used by the extraction pipeline.

7. The domain contract is centralized in `types/quotation.ts`, with a second `quotation.ts` file at the repo root suggesting shared quotation schema or domain definitions outside the app folder. This is the shape that API responses and parsing logic should agree on.

8. The main data flow is:
   browser/UI upload or request → `/api/extract` or `/api/extract-raw` → Adobe-based document extraction → quotation parsing/normalization → typed JSON response back to the UI or caller.  
   The raw route likely exposes an intermediate stage for debugging or inspection.

9. There is no evidence of a database, queue, or background worker. The architecture looks stateless and request/response driven, with processing happening synchronously inside the API route handlers.

10. Tooling and framework files (`next.config.ts`, `tsconfig.json`, `eslint.config.mjs`, `postcss.config.mjs`, `package.json`) indicate a standard Next.js/TypeScript frontend-plus-API deployment model, probably suitable for serverless or Node hosting.

11. The top-level docs (`QUICKSTART.md`, `TECHNICAL_PROMPT.md`, `FRAGILITY_CLASSIFICATION_PLAN.md`, `van-calculation.md`) suggest the repo also contains implementation guidance and adjacent domain notes. They are useful for understanding intended behavior, but they are not part of the runtime call graph.

Main entry points: [`logi-v1-main/logi-v1-main/quotation-extractor`](https://github.com/theshafcodes/logivshaf/tree/master/logi-v1-main/logi-v1-main/quotation-extractor) (quotation-extractor), [`logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract/route.ts`](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract/route.ts) (Extract API), [`logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract-raw/route.ts`](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract-raw/route.ts) (Raw API), [`logi-v1-main/logi-v1-main/quotation-extractor/types/quotation.ts`](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/types/quotation.ts) (Quotation types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_repo["Repository"]
  node_root_readme["README<br/>repo-doc<br/>[README.md]"]
  node_quickstart["Quickstart<br/>spec<br/>[QUICKSTART.md]"]
  node_tech_prompt["Tech prompt<br/>spec"]
  node_fragility_plan["Fragility plan<br/>spec"]
  node_van_calc["Van calc<br/>notes<br/>[van-calculation.md]"]
  node_root_quote["Quotation schema<br/>[quotation.ts]"]
  node_tooling["Tooling<br/>build-config<br/>[package.json]"]
end

subgraph group_app["Next.js app"]
  node_app_root["quotation-extractor<br/>next-app"]
  node_ui_page["Home page<br/>ui-entry<br/>[page.tsx]"]
  node_app_layout["App shell<br/>ui-shell<br/>[layout.tsx]"]
  node_global_css["Global styles<br/>ui-style<br/>[globals.css]"]
  node_api_extract["Extract API<br/>api-route<br/>[route.ts]"]
  node_api_extract_raw["Raw API<br/>api-route<br/>[route.ts]"]
end

subgraph group_lib["Core logic"]
  node_adobe_extract["Adobe extract<br/>integration<br/>[adobe-extract.ts]"]
  node_parse_quote["Parse quotation<br/>transform<br/>[parse-quotation.ts]"]
  node_pdf_config["PDF config<br/>[pdf-config.ts]"]
end

subgraph group_types["Domain types"]
  node_quote_types["Quotation types<br/>schema<br/>[quotation.ts]"]
end

node_app_root -->|"contains"| node_ui_page
node_app_root -->|"contains"| node_app_layout
node_app_root -->|"uses"| node_global_css
node_app_root -->|"exposes"| node_api_extract
node_app_root -->|"exposes"| node_api_extract_raw
node_ui_page -->|"calls"| node_api_extract
node_api_extract -->|"uses"| node_adobe_extract
node_api_extract -->|"uses"| node_parse_quote
node_api_extract -->|"uses"| node_pdf_config
node_api_extract -->|"returns"| node_quote_types
node_api_extract_raw -->|"uses"| node_adobe_extract
node_api_extract_raw -->|"uses"| node_pdf_config
node_api_extract_raw -->|"returns"| node_quote_types
node_parse_quote -->|"produces"| node_quote_types
node_root_quote -.->|"mirrors"| node_quote_types
node_tooling -->|"builds"| node_app_root
node_fragility_plan -.->|"guides"| node_parse_quote
node_tech_prompt -.->|"guides"| node_app_root
node_quickstart -.->|"explains"| node_app_root
node_van_calc -.->|"relates"| node_root_quote

click node_root_readme "https://github.com/theshafcodes/logivshaf/blob/master/README.md"
click node_quickstart "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/QUICKSTART.md"
click node_tech_prompt "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/TECHNICAL_PROMPT.md"
click node_fragility_plan "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/FRAGILITY_CLASSIFICATION_PLAN.md"
click node_van_calc "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/van-calculation.md"
click node_app_root "https://github.com/theshafcodes/logivshaf/tree/master/logi-v1-main/logi-v1-main/quotation-extractor"
click node_ui_page "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/page.tsx"
click node_app_layout "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/layout.tsx"
click node_global_css "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/globals.css"
click node_api_extract "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract/route.ts"
click node_api_extract_raw "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract-raw/route.ts"
click node_adobe_extract "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/lib/adobe-extract.ts"
click node_parse_quote "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/lib/parse-quotation.ts"
click node_pdf_config "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/lib/pdf-config.ts"
click node_quote_types "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/types/quotation.ts"
click node_root_quote "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation.ts"
click node_tooling "https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/package.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_root_readme,node_quickstart,node_tech_prompt,node_fragility_plan,node_van_calc,node_root_quote,node_tooling toneBlue
class node_app_root,node_ui_page,node_app_layout,node_global_css,node_api_extract,node_api_extract_raw toneAmber
class node_adobe_extract,node_parse_quote,node_pdf_config toneMint
class node_quote_types toneRose
```

## Components

### Repository

Top-level guidance and shared domain notes

- [README](https://github.com/theshafcodes/logivshaf/blob/master/README.md): repo-doc · Repository entry guidance · `README.md`
- [Quickstart](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/QUICKSTART.md): spec · Setup and usage guidance · `logi-v1-main/logi-v1-main/QUICKSTART.md`
- [Tech prompt](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/TECHNICAL_PROMPT.md): spec · Implementation guidance and constraints · `logi-v1-main/logi-v1-main/TECHNICAL_PROMPT.md`
- [Fragility plan](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/FRAGILITY_CLASSIFICATION_PLAN.md): spec · Domain-specific quality and failure analysis notes · `logi-v1-main/logi-v1-main/quotation-extractor/FRAGILITY_CLASSIFICATION_PLAN.md`
- [Van calc](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/van-calculation.md): notes · Adjacent domain notes · `logi-v1-main/logi-v1-main/van-calculation.md`
- [Quotation schema](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation.ts): schema · Shared quotation definition at repo root · `logi-v1-main/logi-v1-main/quotation.ts`
- [Tooling](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/package.json): build-config · Next.js and TypeScript build/runtime configuration · `logi-v1-main/logi-v1-main/quotation-extractor/package.json`

### Next.js app

Main browser-facing application and API routes

- [quotation-extractor](https://github.com/theshafcodes/logivshaf/tree/master/logi-v1-main/logi-v1-main/quotation-extractor): next-app · Main Next.js application · `logi-v1-main/logi-v1-main/quotation-extractor`
- [Home page](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/page.tsx): ui-entry · User-facing upload and analysis entry point · `logi-v1-main/logi-v1-main/quotation-extractor/app/page.tsx`
- [App shell](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/layout.tsx): ui-shell · Global layout wrapper · `logi-v1-main/logi-v1-main/quotation-extractor/app/layout.tsx`
- [Global styles](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/globals.css): ui-style · Application-wide styling · `logi-v1-main/logi-v1-main/quotation-extractor/app/globals.css`
- [Extract API](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract/route.ts): api-route · Primary end-to-end quotation extraction endpoint · `logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract/route.ts`
- [Raw API](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract-raw/route.ts): api-route · Lower-level extraction endpoint · `logi-v1-main/logi-v1-main/quotation-extractor/app/api/extract-raw/route.ts`

### Core logic

Document extraction and quotation parsing pipeline

- [Adobe extract](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/lib/adobe-extract.ts): integration · External document extraction boundary · `logi-v1-main/logi-v1-main/quotation-extractor/lib/adobe-extract.ts`
- [Parse quotation](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/lib/parse-quotation.ts): transform · Normalizes extracted content into quotation data · `logi-v1-main/logi-v1-main/quotation-extractor/lib/parse-quotation.ts`
- [PDF config](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/lib/pdf-config.ts): config · PDF extraction settings · `logi-v1-main/logi-v1-main/quotation-extractor/lib/pdf-config.ts`

### Domain types

Shared quotation schema definitions

- [Quotation types](https://github.com/theshafcodes/logivshaf/blob/master/logi-v1-main/logi-v1-main/quotation-extractor/types/quotation.ts): schema · Shared quotation contract · `logi-v1-main/logi-v1-main/quotation-extractor/types/quotation.ts`

## Connections

- quotation-extractor → Home page: contains · Main user entry
- quotation-extractor → App shell: contains · App shell
- quotation-extractor → Global styles: uses · Global styling
- quotation-extractor → Extract API: exposes · Primary API route
- quotation-extractor → Raw API: exposes · Raw API route
- Home page → Extract API: calls · Browser workflow submits extraction requests
- Extract API → Adobe extract: uses · Document extraction step
- Extract API → Parse quotation: uses · Transforms extracted data into quotation model
- Extract API → PDF config: uses · Extraction settings
- Extract API → Quotation types: returns · Typed response contract
- Raw API → Adobe extract: uses · Raw extraction path
- Raw API → PDF config: uses · PDF handling settings
- Raw API → Quotation types: returns · Structured output shape
- Parse quotation → Quotation types: produces · Normalization target
- Quotation schema → Quotation types: mirrors · Shared domain schema representation
- Tooling → quotation-extractor: builds · Framework/runtime configuration supports the app
- Fragility plan → Parse quotation: guides · Domain-specific implementation notes
- Tech prompt → quotation-extractor: guides · Implementation guidance
- Quickstart → quotation-extractor: explains · Setup and run instructions
- Van calc → Quotation schema: relates · Adjacent domain documentation
