This project demonstrates how to run a local Large Language Model (LLM) using Ollama and integrate it with a Spring Boot 3.4.2 application using DeepSeek-R1. No need for cloud APIs β run everything locally for maximum performance and data privacy.
The primary objective was to demonstrate a seamless integration of the DeepSeek-R1 model using Ollama, highlighting:
Here's what the chat UI looks like when the Angular frontend is running:

curl -fsSL https://ollama.com/install.sh | sh ollama serve
ollama pull deepseek-r1:1.5b
# Clone the repository git clone https://github.com/HenryXiloj/demo-ollama-deepseek-r1 cd demo-ollama-deepseek-r1 # Clean, build, and run the application mvn clean install spring-boot:run
Note: The Maven build will:
- Install Node.js and npm
- Install frontend dependencies
- Build the Angular frontend
- Compile and run the Spring Boot backend
π demo-ollama-deepseek-r1/
βββ angular-ui/
β βββ src/app/
β βββ app.component.ts
β βββ app.component.html
β βββ app.config.ts
β βββ chat/
β βββ chat.component.ts
β βββ chat.component.html
β βββ chat.component.scss
β
βββ src/main/java/com/henry/ollama/
β βββ Application.java
β βββ config/OllamaProperties.java
β βββ controller/ChatController.java
β βββ record/OllamaRequest.java
β βββ record/OllamaResponse.java
β βββ service/OllamaService.java
After starting the application, you can test the chat endpoint:
curl -X POST -H "Content-Type: text/plain" \ -d "Explain AI in simple terms" \ http://localhost:8080/api/chat
sudo ufw enable sudo ufw allow 11434 sudo systemctl stop ollama sudo lsof -i :11434 export OLLAMA_HOST=0.0.0.0 ollama serve
$wsl_ip = (wsl hostname -I).Split()[0] netsh interface portproxy add v4tov4 listenport=11434 listenaddress=0.0.0.0 connectport=11434 connectaddress=$wsl_ip New-NetFirewallRule -DisplayName "Ollama-WSL" -Direction Inbound -Protocol TCP -LocalPort 11434 -Action Allow
π Author
Created with β€οΈ by Henry Xiloj
π GitHub Repo: github.com/HenryXiloj/demo-ollama-deepseek-r1
π Blog: jarmx.blogspot.com