# henryxiloj/demo-ollama-deepseek-r1 architecture

> Architecture diagram of the GitHub repository henryxiloj/demo-ollama-deepseek-r1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/henryxiloj/demo-ollama-deepseek-r1
- Repository: https://github.com/henryxiloj/demo-ollama-deepseek-r1

## Overview

##### Project Type and Purpose
- This is a full-stack application focused on demonstrating local AI inference.
- The backend, powered by Spring Boot 3.4.2/Java 21, exposes a chat API endpoint that integrates with Ollama’s local LLM (DeepSeek-R1).
- The frontend is an Angular application that provides a chat interface to interact with the AI service.
- Its use case emphasizes local processing for privacy and low latency without reliance on cloud APIs.

##### File Structure Analysis
- The top-level directories clearly separate the Angular frontend (in the “angular-ui” folder) and the backend source (under “src/main/java/com/henry/ollama”).
- The “angular-ui” folder contains standard Angular configuration (angular.json, package.json) and source files under “angular-ui/src/app” that include components like “chat.component”.
- The backend structure includes the Application entry point, configuration files (OllamaProperties), controllers (ChatController, WebController), service logic (OllamaService), and domain records (OllamaRequest, OllamaResponse).
- Maven build files (pom.xml, mvnw, etc.) indicate that the project builds the full-stack solution, including frontend asset installation and compilation.

##### Practical Steps
- Within the backend, break out the Controller, Service, and Configuration components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend"
        ANGULAR["Angular UI"]:::frontend
    end

    subgraph "Spring Boot Backend"
        ENTRY["Application.java\n(Java 21, Spring Boot 3.4.2)"]:::backend
        CTL["ChatController"]:::backend
        WCTL["WebController"]:::backend
        SERVICE["OllamaService"]:::backend
        CONFIG["OllamaProperties"]:::backend
        DOMAIN_REQ["OllamaRequest"]:::backend
        DOMAIN_RES["OllamaResponse"]:::backend
    end

    subgraph "External AI Service"
        OLLAMA["Ollama LLM (DeepSeek-R1)"]:::external
    end

    ANGULAR -->|"HTTP_POST_/api/chat"| CTL
    CTL -->|"delegates_to"| SERVICE
    SERVICE -->|"invokes"| OLLAMA
    OLLAMA -->|"returns_response"| SERVICE
    SERVICE -->|"replies_via"| CTL
    CTL -->|"sends_result"| ANGULAR
    WCTL -->|"serves_static_content"| ANGULAR
    ENTRY -->|"initializes"| CTL
    ENTRY -->|"initializes"| WCTL
    ENTRY -->|"loads_config"| CONFIG
    SERVICE -->|"processes"| DOMAIN_REQ
    SERVICE -->|"processes"| DOMAIN_RES

    click ANGULAR "https://github.com/henryxiloj/demo-ollama-deepseek-r1/tree/main/angular-ui/"
    click ENTRY "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/Application.java"
    click CTL "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/controller/ChatController.java"
    click WCTL "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/controller/WebController.java"
    click SERVICE "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/service/OllamaService.java"
    click CONFIG "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/config/OllamaProperties.java"
    click DOMAIN_REQ "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/record/OllamaRequest.java"
    click DOMAIN_RES "https://github.com/henryxiloj/demo-ollama-deepseek-r1/blob/main/src/main/java/com/henry/ollama/record/OllamaResponse.java"

    classDef frontend fill:#a3d8f4,stroke:#0277bd,stroke-width:2px;
    classDef backend fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
    classDef external fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
```
