# livenormad/livenormad-quote-engine architecture

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

- Interactive diagram: https://gitdiagram.com/livenormad/livenormad-quote-engine
- Repository: https://github.com/livenormad/livenormad-quote-engine

## Overview

LiveNormad Pricing API turns submitted product orders into supplier-informed quotes, with both custom-product and catalogue/flipbook entry paths. The main workflow parses orders, resolves catalogue data where applicable, searches for supplier offers, calculates line and package pricing, renders a PDF, and stores quote history. Background Celery tasks support asynchronous processing; API routes also expose synchronous paths and retrieval. Bedroom qualification and partial-order pricing are distinct pricing rules. Several source excerpts are partial, so uncertain internal wiring is omitted; documented capabilities are represented where their implementation was not sampled.

Main entry points: [`app/services/pipeline.py`](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pipeline.py) (Shared Pipeline), [`app/routers/quotes.py`](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/routers/quotes.py) (Quote Endpoints), [`app/tasks/quote_tasks.py`](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/tasks/quote_tasks.py) (Quote Tasks), [`app/main.py`](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/main.py) (FastAPI Application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Intake"]
  node_api_app["FastAPI Application<br/>[main.py]"]
  node_quotes_router["Quote Endpoints<br/>[quotes.py]"]
  node_flipbook_router["Flipbook Endpoints<br/>[flipbook.py]"]
end

subgraph group_processing["Order Processing"]
  node_quote_tasks["Quote Tasks<br/>[quote_tasks.py]"]
  node_flipbook_tasks["Flipbook Tasks<br/>[flipbook_tasks.py]"]
  node_pipeline["Shared Pipeline<br/>[pipeline.py]"]
  node_csv_parser["CSV Parser<br/>[csv_parser.py]"]
  node_schemas["Order and Quote Models<br/>[schemas.py]"]
end

subgraph group_pricing["Sourcing and Pricing"]
  node_scraper["Supplier Search<br/>[scraper.py]"]
  node_supplier_cache["Supplier Cache<br/>[supplier_cache.py]"]
  node_pricing_engine["Line Pricing<br/>[pricing_engine.py]"]
  node_package_pricing["Package Pricing<br/>[package_pricing.py]"]
  node_catalogue_categories["Bedroom Categories"]
end

subgraph group_outputs["Quote Outputs"]
  node_pdf_generator["Quote PDF<br/>[pdf_generator.py]"]
  node_quote_template["Quote Template"]
  node_quote_database[("Quote History<br/>[database.py]")]
end

subgraph group_catalogue["Catalogue Data"]
  node_flipbook_service["Flipbook Lookups"]
end

node_customer(("Order Submitter"))
node_suppliers{{"Supplier Search Services"}}
node_exchange_rates{{"Exchange Rate Services"}}
node_supabase[("Supabase")]
node_celery["Celery Queue"]

node_customer -->|"submits order"| node_api_app
node_api_app -->|"routes requests"| node_quotes_router
node_api_app -->|"routes requests"| node_flipbook_router
node_quotes_router -->|"queues processing"| node_quote_tasks
node_quotes_router -->|"runs sync pipeline"| node_pipeline
node_quotes_router -->|"retrieves quotes"| node_quote_database
node_flipbook_router -->|"queues processing"| node_flipbook_tasks
node_flipbook_router -->|"runs pipeline"| node_pipeline
node_quote_tasks -->|"parses CSV"| node_csv_parser
node_quote_tasks -->|"runs order pipeline"| node_pipeline
node_flipbook_tasks -->|"runs flipbook pipeline"| node_pipeline
node_quote_tasks -->|"updates task state"| node_celery
node_flipbook_tasks -->|"updates task state"| node_celery
node_pipeline -->|"looks up catalogue"| node_flipbook_service
node_pipeline -->|"searches suppliers"| node_scraper
node_pipeline -->|"builds line prices"| node_pricing_engine
node_pipeline -->|"prices packages"| node_package_pricing
node_pipeline -->|"qualifies bedrooms"| node_catalogue_categories
node_pipeline -->|"renders quote"| node_pdf_generator
node_pipeline -->|"saves quote"| node_quote_database
node_scraper -->|"searches offers"| node_suppliers
node_scraper -->|"uses cached data"| node_supplier_cache
node_pricing_engine -->|"converts currency"| node_exchange_rates
node_pdf_generator -->|"renders template"| node_quote_template
node_flipbook_service -->|"reads catalogue"| node_supabase
node_flipbook_service -->|"updates prices"| node_supabase
node_quote_database -->|"reads and writes"| node_supabase

click node_api_app "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/main.py"
click node_quotes_router "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/routers/quotes.py"
click node_flipbook_router "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/routers/flipbook.py"
click node_quote_tasks "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/tasks/quote_tasks.py"
click node_flipbook_tasks "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/tasks/flipbook_tasks.py"
click node_pipeline "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pipeline.py"
click node_csv_parser "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/csv_parser.py"
click node_schemas "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/models/schemas.py"
click node_scraper "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/scraper.py"
click node_supplier_cache "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/supplier_cache.py"
click node_pricing_engine "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pricing_engine.py"
click node_package_pricing "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/package_pricing.py"
click node_catalogue_categories "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/catalogue_categories.py"
click node_pdf_generator "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pdf_generator.py"
click node_quote_template "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/templates/quote_template.html"
click node_quote_database "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/database.py"
click node_flipbook_service "https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/flipbook_service.py"

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_api_app,node_quotes_router,node_flipbook_router toneBlue
class node_quote_tasks,node_flipbook_tasks,node_pipeline,node_csv_parser,node_schemas,node_supabase toneAmber
class node_scraper,node_supplier_cache,node_pricing_engine,node_package_pricing,node_catalogue_categories toneMint
class node_pdf_generator,node_quote_template,node_quote_database,node_celery toneRose
class node_flipbook_service,node_customer,node_suppliers,node_exchange_rates toneIndigo
```

## Components

### API and Intake

- [FastAPI Application](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/main.py): `app/main.py`
- [Quote Endpoints](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/routers/quotes.py): `app/routers/quotes.py`
- [Flipbook Endpoints](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/routers/flipbook.py): `app/routers/flipbook.py`

### Order Processing

- [Quote Tasks](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/tasks/quote_tasks.py): `app/tasks/quote_tasks.py`
- [Flipbook Tasks](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/tasks/flipbook_tasks.py): `app/tasks/flipbook_tasks.py`
- [Shared Pipeline](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pipeline.py): `app/services/pipeline.py`
- [CSV Parser](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/csv_parser.py): `app/services/csv_parser.py`
- [Order and Quote Models](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/models/schemas.py): `app/models/schemas.py`

### Sourcing and Pricing

- [Supplier Search](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/scraper.py): `app/services/scraper.py`
- [Supplier Cache](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/supplier_cache.py): `app/services/supplier_cache.py`
- [Line Pricing](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pricing_engine.py): `app/services/pricing_engine.py`
- [Package Pricing](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/package_pricing.py): `app/services/package_pricing.py`
- [Bedroom Categories](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/catalogue_categories.py): `app/services/catalogue_categories.py`

### Quote Outputs

- [Quote PDF](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/pdf_generator.py): `app/services/pdf_generator.py`
- [Quote Template](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/templates/quote_template.html): `app/templates/quote_template.html`
- [Quote History](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/database.py): `app/database.py`

### Catalogue Data

- [Flipbook Lookups](https://github.com/livenormad/livenormad-quote-engine/blob/main/app/services/flipbook_service.py): `app/services/flipbook_service.py`

### Other components

- **Order Submitter**
- **Supplier Search Services**
- **Exchange Rate Services**
- **Supabase**
- **Celery Queue**

## Connections

- Order Submitter → FastAPI Application: submits order
- FastAPI Application → Quote Endpoints: routes requests
- FastAPI Application → Flipbook Endpoints: routes requests
- Quote Endpoints → Quote Tasks: queues processing
- Quote Endpoints → Shared Pipeline: runs sync pipeline
- Quote Endpoints → Quote History: retrieves quotes
- Flipbook Endpoints → Flipbook Tasks: queues processing
- Flipbook Endpoints → Shared Pipeline: runs pipeline
- Quote Tasks → CSV Parser: parses CSV
- Quote Tasks → Shared Pipeline: runs order pipeline
- Flipbook Tasks → Shared Pipeline: runs flipbook pipeline
- Quote Tasks → Celery Queue: updates task state
- Flipbook Tasks → Celery Queue: updates task state
- Shared Pipeline → Flipbook Lookups: looks up catalogue
- Shared Pipeline → Supplier Search: searches suppliers
- Shared Pipeline → Line Pricing: builds line prices
- Shared Pipeline → Package Pricing: prices packages
- Shared Pipeline → Bedroom Categories: qualifies bedrooms
- Shared Pipeline → Quote PDF: renders quote
- Shared Pipeline → Quote History: saves quote
- Supplier Search → Supplier Search Services: searches offers
- Supplier Search → Supplier Cache: uses cached data
- Line Pricing → Exchange Rate Services: converts currency
- Quote PDF → Quote Template: renders template
- Flipbook Lookups → Supabase: reads catalogue
- Flipbook Lookups → Supabase: updates prices
- Quote History → Supabase: reads and writes
