DEV Community

Cover image for Simple RAG Application in .NET (Clean Architecture + Aspire)
rinesh
rinesh

Posted on

Simple RAG Application in .NET (Clean Architecture + Aspire)

I built a small Retrieval-Augmented Generation (RAG) sample using .NET 10, just to demonstrate how easily we can wire up:

  • Vector search with PostgreSQL (pgvector)
  • LLM integration
  • Clean Architecture
  • Local orchestration using .NET Aspire

You can find the source code here.
GitHub Repo: https://github.com/rineshpk/dotnet-rag-pgvector

What this repo demonstrates

  • Minimal RAG pipeline
  • Embedding storage using PostgreSQL + pgvector
  • Semantic search using cosine similarity
  • Clean Architecture structure
  • Aspire orchestration for local development

This project is orchestrated using .NET Aspire, making local setup extremely simple.

Just clone the repo and run: dotnet run --project AppHost.
Prerequisites: .Net 10, Docker

Open the aspire dashboard in browser. Ollama and PostgreSQL will take some time to pull their images the first time. Wait for all services to start.

screenshot of Aspire dashboard showing all running services

You can see all services running and connected in one place.

The application stores embeddings directly in PostgreSQL using pgvector.

screenshot of your table with vector embedding column

The API is exposed with a clean UI for testing endpoints.

screenshot of Scalar UI showing your API endpoints

Here’s an example of querying the system with a design pattern question and getting an LLM-powered response.

screenshot of request + response in Scalar UI

If you're exploring:

  • RAG in .NET
  • pgvector usage
  • Aspire-based orchestration

This repo gives you a clean starting point.

πŸ‘‰ Check it out here

Top comments (0)