Project Overview
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- CLAUDE.md
- lib/db/schema.ts
- lib/ai/prompts.ts
- app/knowledge/page.tsx
- lib/lv/pdf.ts
- app/(chat)/lv/import-actions.test.ts/lv/import-actions.test.ts)
LV.AI is an autonomous AI expert for the construction industry in the D/A/CH region (Germany, Austria, Switzerland). The system automates the processes of Tendering, Awarding, and Billing (AVA) by providing a chat-based interface for managing Bill of Quantities (BoQ/LV) data. It ensures compliance with national regulations such as VOB, ÖNORM, and SIA.
Sources: README.md:1-12, CLAUDE.md:1-10
Core Architecture
The platform uses a modern TypeScript stack centered around Next.js 16 and the Vercel AI SDK. It operates on the principle that every chat session represents a specific construction project containing metadata and structured documents.
Tech Stack Components
| Component | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| UI | shadcn/ui + Tailwind CSS 4 |
| AI | Vercel AI SDK 6 + 9Router (DeepSeek V4) |
| Database | Neon Postgres + Drizzle ORM |
| Memory | mem0 (Project + Global Scope) |
| Auth | Auth.js |
Sources: README.md:19-27, CLAUDE.md:14-23
Logical Data Flow
The following diagram illustrates the relationship between users, chat sessions, and project-specific AVA documents.
The system links each Chat to a Project. AVA documents like LvDocument and Offer belong to these projects to maintain context.
Sources: lib/db/schema.ts:80-160, CLAUDE.md:32-33
AI and Provider Integration
LV.AI integrates with 9Router, a multi-provider gateway that primarily utilizes the DeepSeek V4 backend. The AI is prompted to act as an AVA expert with specific knowledge of construction trades (DIN 18299) and regional legal frameworks.
Prompting Strategy
The system uses modularized prompts to optimize token usage and caching:
- Stable Part: Contains the AI role, industry keywords (GAEB, VOB, SIA), and artifact handling rules.
- Dynamic Part: Contains user request hints (location) and specific project context.
Sources: lib/ai/prompts.ts:110-145, CLAUDE.md:41-52
Artifacts System
The system uses "Artifacts" to display structured content in a side panel. Tools like createDocument and editDocument allow the AI to generate spreadsheets (for LVs) or text documents in real-time.
Data Model and Schema
The database schema is designed to support the GAEB DA XML structure (X81–X86) for exchanging tender data.
Primary Entities
| Table | Purpose | Key Fields |
|---|---|---|
Project | Central container for a building project | land, gewerk, kostenbudget |
LvDocument | A tender document (GAEB-compliant) | gaebFormat, status, titel |
LvPosition | Individual items within an LV | oz (ID), menge, einheitspreis |
Offer | Bidder submissions | bieter, gesamtsumme, status |
Sources: lib/db/schema.ts:50-240
Regional Compliance Mapping
The application automatically adjusts legal foundations based on the project's country.
| Country | Tendering | Contract | Technical (ATV) |
|---|---|---|---|
| DE | VOB/A | VOB/B | VOB/C (DIN 18299) |
| AT | ÖNORM B2110 | ÖNORM B2111 | ÖNORM Anhang C |
| CH | SIA 118 | SIA 102 | SIA 118 C |
Sources: README.md:46-52, CLAUDE.md:54-61
Key Feature Modules
Knowledge Base and Import
Users can upload construction documents (PDF, GAEB XML, Excel) to a Knowledge Base. The importLvFileAction parses GAEB files or unstructured text to populate LvDocument and LvPosition tables.
Sources: app/knowledge/page.tsx:100-140, app/(chat)/lv/import-actions.test.ts:100-120
PDF Generation
The system includes a server-side PDF generator using pdf-lib. It creates professional Bill of Quantities documents with standard A4 layouts, including headers for OZ (Item IDs), short/long texts, quantities, and totals.
Sources: lib/lv/pdf.ts:15-60
Dual Memory System
Leveraging mem0, the system maintains two layers of memory:
- Project Scope: Context specific to the current building project.
- Global Scope: General user preferences and cross-project knowledge.
Sources: CLAUDE.md:34-35
Summary
LV.AI functions as a specialized technical copilot that combines large language models with structured construction data formats (GAEB). By strictly adhering to D/A/CH regional standards and utilizing a sophisticated artifacts system, it provides a comprehensive environment for managing the lifecycle of construction tenders and awards.