Skip to main content

Architecture & Dependency Diagram

This page describes the project architecture and how the various layers depend on each other.

Dependency Diagram

┌─────────────────────────────────────────────────────────────────────┐
│ Application Layer │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ .Web (MVC App) │ │ Modules │ │ (Future) │ │
│ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │ │
└───────────┼─────────────────────┼──────────────────────┼────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────────┐
│ Optional Middle Layer │
│ │
│ ┌──────────────────────────┐ ┌──────────────────────────────┐ │
│ │ (Document Store) │ │ (Shape-based UI) │ │
│ └────────────┬─────────────┘ └──────────────┬───────────────┘ │
│ │ │ │
└───────────────┼────────────────────────────────┼────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────────────┐
│ Framework Layer │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Core Projects │ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │ │
│ │ │ CrestApps │ │ CrestApps │ │ CrestApps.Core.AI │ │ │
│ │ │ .AI.Core │ │ .AI.Chat │ │ .OpenAI.Core │ │ │
│ │ │ │ │ .Core │ │ │ │ │
│ │ └──────┬───────┘ └──────┬───────┘ └────────┬─────────┘ │ │
│ │ │ │ │ │ │
│ │ ┌──────┴───────┐ ┌─────┴────────┐ ┌───────┴─────────┐ │ │
│ │ │ CrestApps │ │ CrestApps │ │ CrestApps.Core.AI │ │ │
│ │ │ .Core │ │ .SignalR │ │ .OpenAI.Azure │ │ │
│ │ │ │ │ .Core │ │ .Core │ │ │
│ │ └──────┬───────┘ └──────┬───────┘ └────────┬────────┘ │ │
│ │ │ │ │ │ │
│ │ ┌──────┴───────┐ ┌─────┴────────┐ ┌───────┴─────────┐ │ │
│ │ │ CrestApps.Core.AI │ │ CrestApps.Core.AI │ │ CrestApps.Core.AI │ │ │
│ │ │ .Ollama.Core │ │ .AzureAI │ │ .Mcp.Core │ │ │
│ │ │ │ │ Inference │ │ │ │ │
│ │ │ │ │ .Core │ │ │ │ │
│ │ └──────┬───────┘ └──────┬───────┘ └────────┬────────┘ │ │
│ │ │ │ │ │ │
│ │ ┌──────┴───────┐ ┌─────┴────────┐ ┌───────┴─────────┐ │ │
│ │ │ CrestApps.Core.AI │ │ CrestApps.Core.AI │ │ CrestApps.Core.AI │ │ │
│ │ │ .Chat │ │ .DataSources │ │ .DataSources │ │ │
│ │ │ .Copilot │ │ .AzureAI │ │ .Elasticsearch │ │ │
│ │ └──────────────┘ └──────────────┘ └─────────────────┘ │ │
│ │ │ │
│ └─────────┼─────────────────┼────────────────────┼────────────┘ │
│ │ │ │ │
│ ┌─────────┴─────────────────┴────────────────────┴────────────┐ │
│ │ Abstractions │ │
│ │ │ │
│ │ ┌──────────────────┐ ┌────────────────────────────────┐ │ │
│ │ │ CrestApps │ │ CrestApps.Core.AI.Abstractions │ │ │
│ │ │ .Abstractions │ │ (IAICompletionService, │ │ │
│ │ │ (ICatalog, │ │ IAIProfileManager, │ │ │
│ │ │ INamedEntity) │ │ IOrchestrator, etc.) │ │ │
│ │ └──────────────────┘ └────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ Resources │ │
│ │ ┌──────────────────────────────────────────────────────┐ │ │
│ │ │ CrestApps.Core.AI.Resources (shared JS: ai-chat, │ │ │
│ │ │ chat-interaction) │ │ │
│ │ └──────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ Utilities │ │
│ │ ┌────────────────┐ ┌──────────────────────┐ │ │
│ │ │ CrestApps │ │ CrestApps.Core.AI │ │ │
│ │ │ .Support │ │ .Prompting │ │ │
│ │ └────────────────┘ └──────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘

Layer Descriptions

Framework Layer (Top Level)

ProjectRole
CrestApps.Core.AbstractionsCore interfaces: ICatalog<T>, INamedEntity, ExtensibleEntity, IODataValidator
CrestApps.Core.AI.AbstractionsAI interfaces: IAICompletionService, IAIProfileManager, IOrchestrator, models
CrestApps.CoreDefault implementations of core abstractions, IServiceCollection extensions
CrestApps.Core.AIAI orchestration, DefaultOrchestrator, tool execution, completion services
CrestApps.Core.AI.ChatChat session management, prompt storage, IAIChatSessionManager
CrestApps.Core.AI.OpenAIOpenAI provider (ChatClient, streaming, tool calls)
CrestApps.Core.AI.OpenAI.AzureAzure OpenAI provider with data source integration
CrestApps.Core.AI.OllamaOllama provider for locally hosted LLMs
CrestApps.Core.AI.AzureAIInferenceAzure AI Inference / GitHub Models provider
CrestApps.Core.AI.CopilotGitHub Copilot chat orchestration, OAuth flow, credential management
CrestApps.Core.Azure.AISearchAzure AI Search provider integration for indexing, document management, vector search, and OData filters
CrestApps.Core.ElasticsearchElasticsearch provider integration for indexing, document management, vector search, and query/filter translation
CrestApps.Core.AI.McpModel Context Protocol (MCP) client and server
CrestApps.Core.AzureAzure-specific utilities and integration helpers
CrestApps.Core.SignalRSignalR hub abstractions for real-time AI chat
CrestApps.Core.SupportGeneral utility classes
CrestApps.Core.TemplatesPrompt template engine

Optional Middle Layer

ProjectRole
CrestApps.Core.Data.YesSqlYesSql-based document catalog implementation (SQLite, PostgreSQL, SQL Server)

Application Layer

ProjectRole
CrestApps.Core.Mvc.WebStandalone ASP.NET Core MVC application with full admin UI
Blazor / OtherFuture: Blazor Server/WASM, minimal APIs, etc.

Data Flow

User → UI (MVC/Blazor/OC) → SignalR Hub → Orchestrator → AI Provider → LLM
↓ ↑
Session Manager ←──── Prompt Store ────┘

YesSql / Custom Store
  1. User sends a message via the UI (browser)
  2. SignalR Hub receives the message and resolves the AI profile
  3. Orchestrator builds the conversation context (system prompt, history, tools)
  4. AI Provider (OpenAI, Azure, Ollama) streams the response
  5. Prompt Store persists both user and assistant messages
  6. SignalR Hub streams response chunks back to the client

Extensibility Points

InterfacePurposeDefault Implementation
IAICompletionServiceAI provider abstractionOpenAI, Azure OpenAI, Ollama
IOrchestratorControls AI request pipelineDefaultOrchestrator
ICatalog<T>CRUD for named entitiesNamedSourceDocumentCatalog<T> (YesSql)
IAIProfileManagerProfile CRUDModule-specific implementations
IAIChatSessionManagerSession lifecycleYesSql-based implementation
IAIChatSessionPromptStorePrompt persistenceYesSql-based implementation
ICatalogEntryHandler<T>Entity lifecycle hooksPer-provider handlers