Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:
LV.AI is an autonomous AI expert tailored for the tender, award, and billing (AVA) business in the D/A/CH region (Germany, Austria, Switzerland). The system manages bill of quantities (LV) according to GAEB DA XML standards, handles cost estimations via DIN 276, and supports E-invoicing through XRechnung and ZUGFeRD formats. Sources: README.md:1-12, CLAUDE.md:8-15
The application architecture utilizes a modern full-stack TypeScript environment. It centers on a chat-based interface where each conversation corresponds to a specific construction project, enriched by a dual-memory system for project-specific and global context. Sources: README.md:15-28, CLAUDE.md:37-43
Technical Stack
The project relies on Next.js 16 and a specialized AI routing layer to deliver construction-specific intelligence.
| Component | Technology | Description |
|---|---|---|
| Framework | Next.js 16 (App Router) | Core application framework. |
| AI SDK | Vercel AI SDK 6 | Orchestrates LLM interactions and tool calling. |
| AI Gateway | 9Router (NeXify) | Multi-provider gateway for DeepSeek V4 and OpenAI. |
| Database | Neon Postgres | Managed relational storage. |
| ORM | Drizzle ORM | Type-safe database interactions. |
| Memory | mem0 | Handles Project and Global scope memory. |
| PDF Engine | pdf-lib | Generates GAEB-compliant PDF documents server-side. |
Sources: README.md:18-28, CLAUDE.md:20-28, lib/lv/pdf.ts:13-15
System Architecture
The following diagram illustrates the high-level flow between the user interface, the AI orchestration layer, and the persistent storage systems.
The architecture separates concerns between UI components, server-side business logic (AVA compliance), and external AI providers accessed via a specialized gateway. Sources: README.md:18-28, CLAUDE.md:46-55
Data Model (AVA Schema)
The database schema is structured to support the lifecycle of construction projects, from initial tender to final billing. Every project is linked to a chat session.
Entity Relationships
Core Tables Summary
| Table | Description | Key Fields |
|---|---|---|
Project | Tracks construction project metadata. | land, gewerk, status, kostenbudget |
LvDocument | Represents a GAEB file (X81-X89). | gaebFormat, version, titel |
LvPosition | Single position in an LV. | oz (ID), kurztext, menge, einheitspreis |
Offer | Bidder response to a tender. | bieter, gesamtsumme, zuschlagErteiltAm |
Document | Artifact content (Text, Code, Sheet). | kind, content, title |
Sources: lib/db/schema.ts:54-72, lib/db/schema.ts:145-165, lib/db/schema.ts:178-195
AI Integration and Tooling
LV.AI uses "Artifacts" to display and edit structured content like bill of quantities or cost estimates in a side panel.
Artifact Management Flow
The system uses specialized prompts to ensure GAEB compliance and D/A/CH specific legal frameworks (VOB, ÖNORM, SIA). Sources: lib/ai/prompts.ts:15-35, lib/ai/tools/create-document.ts:25-50, components/chat/artifact.tsx:160-185
D/A/CH Compliance Layer
The system automatically adjusts its logic, terminology, and legal basis depending on the project's country field.
| Feature | Germany (DE) | Austria (AT) | Switzerland (CH) |
|---|---|---|---|
| Awarding | VOB/A | ÖNORM B2110 | SIA 118 |
| Contract | VOB/B | ÖNORM B2111 | SIA 102 |
| Technical | VOB/C (DIN 18299) | ÖNORM Anhang C | SIA 118 C |
| Currency | EUR | EUR | CHF |
Sources: README.md:73-80, CLAUDE.md:61-68
Document Generation (PDF)
The PDF generation service (generateLvPdf) creates standardized construction documents server-side using pdf-lib. It implements specific layout rules for GAEB-style tables, including columns for OZ (position ID), Kurztext, quantity, unit, unit price (EP), and total price (GP). Sources: lib/lv/pdf.ts:13-35
PDF Rendering Logic
- Retrieves
LvDocumentand relatedLvPositionrecords from Postgres. Sources: lib/lv/pdf.ts:70-75 - Embeds Helvetica fonts and creates a multi-page A4 document. Sources: lib/lv/pdf.ts:77-85
- Draws a cover page with project metadata. Sources: lib/lv/pdf.ts:90-135
- Iterates through positions, handling automatic page breaks and table header repetition. Sources: lib/lv/pdf.ts:160-230
- Calculates and renders a net total sum at the document end. Sources: lib/lv/pdf.ts:260-290
Conclusion
LV.AI's architecture integrates specialized construction domain knowledge (GAEB, VOB, DIN) into a modern AI-native web application. By binding every chat to a project entity and utilizing specialized artifacts for structured data, it transitions from a generic chatbot to a verticalized AVA expert. Sources: README.md:100-115, CLAUDE.md:46-55