# rodrigo-pacosillo/app-construcci-n- architecture

> Architecture diagram of the GitHub repository rodrigo-pacosillo/app-construcci-n-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rodrigo-pacosillo/app-construcci-n-
- Repository: https://github.com/rodrigo-pacosillo/app-construcci-n-

## Overview

Constr-art is a construction-services website with public lead capture, an administrative operations panel, a client portal, and role-aware AI chat. A principal journey is a prospective customer submitting a quote request, staff managing the resulting customer and project records, and clients following their work through the portal. The tree documents these domains, while source excerpts verify selected chat, account, authentication, and data-access relationships. Many page-to-action and portal integrations were not sampled, so those links are marked unverified rather than asserted as direct calls.

Main entry points: [`src/app/api/chat/route.ts`](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/app/api/chat/route.ts) (Chat endpoint), [`src/app/admin/(panel)`](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)) (Admin panel), [`src/lib/db.ts`](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/db.ts) (Application database), [`src/app/(public)`](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)) (Marketing pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public website"]
  node_public_site["Marketing pages"]
  node_quote["Quote request"]
  node_public_content["Services and projects"]
end

subgraph group_operations["Business operations"]
  node_admin["Admin panel"]
  node_customer_ops["Customer records"]
  node_project_ops["Projects and works"]
  node_sales_ops["Quotes and contracts"]
  node_operations_tools["Business modules"]
end

subgraph group_portal["Client portal"]
  node_client_portal["Client portal"]
  node_portal_views["Project and account views"]
end

subgraph group_assistant["AI assistant"]
  node_chat_ui["Chat interface<br/>[ChatShell.tsx]"]
  node_chat_api["Chat endpoint<br/>[route.ts]"]
  node_ai_agents["AI agents<br/>[agents.ts]"]
  node_ai_tools["Role-based tools<br/>[index.ts]"]
  node_ai_knowledge["Knowledge base<br/>[conocimiento.ts]"]
  node_chat_sessions["Chat sessions<br/>[sesiones.ts]"]
  node_client_greeting["Client greeting<br/>[cliente.ts]"]
  node_client_summary["Client summary<br/>[resumenCliente.ts]"]
end

subgraph group_platform["Shared platform"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_account_setup["Account completion<br/>[route.ts]"]
  node_database[("Application database<br/>[db.ts]")]
end

node_visitor(("Prospective customer"))
node_client(("Client"))
node_chat_user(("Chat user"))

node_visitor -.->|"browses"| node_public_site
node_public_site -.->|"opens form"| node_quote
node_visitor -.->|"submits request"| node_quote
node_public_site -.->|"shows offerings"| node_public_content
node_admin -.->|"manages customers"| node_customer_ops
node_admin -.->|"manages works"| node_project_ops
node_admin -.->|"manages sales"| node_sales_ops
node_admin -.->|"uses modules"| node_operations_tools
node_client -.->|"views account"| node_client_portal
node_client_portal -.->|"shows project data"| node_portal_views
node_chat_user -.->|"opens chat"| node_chat_ui
node_chat_ui -.->|"sends messages"| node_chat_api
node_chat_api -->|"reads and writes"| node_database
node_chat_api -->|"builds tools"| node_ai_tools
node_chat_api -->|"creates sessions"| node_chat_sessions
node_chat_api -->|"loads knowledge"| node_ai_knowledge
node_chat_api -->|"builds greeting"| node_client_greeting
node_chat_api -.->|"selects agent"| node_ai_agents
node_chat_ui -->|"renders chat panel"| node_chat_api
node_client_greeting -->|"uses summary"| node_client_summary
node_client_summary -->|"queries records"| node_database
node_client_greeting -.->|"reads client context"| node_database
node_auth -->|"checks credentials"| node_database
node_account_setup -->|"creates account"| node_database
node_auth -.->|"guards access"| node_admin
node_quote -.->|"routes requests"| node_sales_ops

click node_public_site "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)"
click node_quote "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)/cotizacion"
click node_public_content "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)/servicios"
click node_admin "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)"
click node_customer_ops "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)/clientes"
click node_project_ops "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)/obras"
click node_sales_ops "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)/cotizaciones"
click node_operations_tools "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)"
click node_client_portal "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/cliente"
click node_portal_views "https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/cliente/proyectos"
click node_chat_ui "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/components/chat/ChatShell.tsx"
click node_chat_api "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/app/api/chat/route.ts"
click node_ai_agents "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/agents.ts"
click node_ai_tools "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/tools/index.ts"
click node_ai_knowledge "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/conocimiento.ts"
click node_chat_sessions "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/sesiones.ts"
click node_client_greeting "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/saludos/cliente.ts"
click node_client_summary "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/datos/resumenCliente.ts"
click node_auth "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/auth.ts"
click node_account_setup "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/app/api/completar-cuenta/route.ts"
click node_database "https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/db.ts"

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_public_site,node_quote,node_public_content,node_client,node_chat_user toneBlue
class node_admin,node_customer_ops,node_project_ops,node_sales_ops,node_operations_tools toneAmber
class node_client_portal,node_portal_views toneMint
class node_chat_ui,node_chat_api,node_ai_agents,node_ai_tools,node_ai_knowledge,node_chat_sessions,node_client_greeting,node_client_summary toneRose
class node_auth,node_account_setup,node_database,node_visitor toneIndigo
```

## Components

### Public website

- [Marketing pages](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)): `src/app/(public)`
- [Quote request](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)/cotizacion): `src/app/(public)/cotizacion`
- [Services and projects](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/(public)/servicios): `src/app/(public)/servicios`

### Business operations

- [Admin panel](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)): `src/app/admin/(panel)`
- [Customer records](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)/clientes): `src/app/admin/(panel)/clientes`
- [Projects and works](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)/obras): `src/app/admin/(panel)/obras`
- [Quotes and contracts](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)/cotizaciones): `src/app/admin/(panel)/cotizaciones`
- [Business modules](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/admin/(panel)): `src/app/admin/(panel)`

### Client portal

- [Client portal](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/cliente): `src/app/cliente`
- [Project and account views](https://github.com/rodrigo-pacosillo/app-construcci-n-/tree/main/src/app/cliente/proyectos): `src/app/cliente/proyectos`

### AI assistant

- [Chat interface](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/components/chat/ChatShell.tsx): `src/components/chat/ChatShell.tsx`
- [Chat endpoint](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [AI agents](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/agents.ts): `src/lib/ai/agents.ts`
- [Role-based tools](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/tools/index.ts): `src/lib/ai/tools/index.ts`
- [Knowledge base](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/conocimiento.ts): `src/lib/ai/conocimiento.ts`
- [Chat sessions](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/sesiones.ts): `src/lib/ai/sesiones.ts`
- [Client greeting](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/saludos/cliente.ts): `src/lib/ai/saludos/cliente.ts`
- [Client summary](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/ai/datos/resumenCliente.ts): `src/lib/ai/datos/resumenCliente.ts`

### Shared platform

- [Authentication](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Account completion](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/app/api/completar-cuenta/route.ts): `src/app/api/completar-cuenta/route.ts`
- [Application database](https://github.com/rodrigo-pacosillo/app-construcci-n-/blob/main/src/lib/db.ts): `src/lib/db.ts`

### Other components

- **Prospective customer**
- **Client**
- **Chat user**

## Connections

- Prospective customer → Marketing pages: browses
- Marketing pages → Quote request: opens form
- Prospective customer → Quote request: submits request
- Marketing pages → Services and projects: shows offerings
- Admin panel → Customer records: manages customers
- Admin panel → Projects and works: manages works
- Admin panel → Quotes and contracts: manages sales
- Admin panel → Business modules: uses modules
- Client → Client portal: views account
- Client portal → Project and account views: shows project data
- Chat user → Chat interface: opens chat
- Chat interface → Chat endpoint: sends messages
- Chat endpoint → Application database: reads and writes (evidence: `src/app/api/chat/route.ts`)
- Chat endpoint → Role-based tools: builds tools (evidence: `src/app/api/chat/route.ts`)
- Chat endpoint → Chat sessions: creates sessions (evidence: `src/app/api/chat/route.ts`)
- Chat endpoint → Knowledge base: loads knowledge (evidence: `src/app/api/chat/route.ts`)
- Chat endpoint → Client greeting: builds greeting (evidence: `src/app/api/chat/route.ts`)
- Chat endpoint → AI agents: selects agent (evidence: `src/app/api/chat/route.ts`)
- Chat interface → Chat endpoint: renders chat panel (evidence: `src/components/chat/ChatShell.tsx`)
- Client greeting → Client summary: uses summary (evidence: `src/lib/ai/saludos/cliente.ts`)
- Client summary → Application database: queries records (evidence: `src/lib/ai/datos/resumenCliente.ts`)
- Client greeting → Application database: reads client context
- Authentication → Application database: checks credentials (evidence: `src/lib/auth.ts`)
- Account completion → Application database: creates account (evidence: `src/app/api/completar-cuenta/route.ts`)
- Authentication → Admin panel: guards access
- Quote request → Quotes and contracts: routes requests
