Building a RAG application in Go (Golang) (Udemy.com)
Learn Retrieval-Augmented Generation by building one in plain Go, against any OpenAI-compatible model — local or hosted
Created by: Trevor Sawler
Last updated May 2026
What you will learn
- How a RAG pipeline actually works end-to-end: chunking, embedding, vector search, query rewriting, context injection, and streaming generation
- How to design Go interfaces so the LLM, the embedder, and the vector store are swappable without touching the rest of the codebase
- How to stream LLM tokens to a terminal AND to a browser with Server-Sent Events
- How to run everything against OpenAI, Ollama, LM Studio, or Groq — and how to mix and match (e.g. hosted chat with local embeddings)
- How to use Postgres + pgvector for production-grade vector search, including HNSW indexes and embedding-dimension migrations
- How to ingest documents reactively with fsnotify, debouncing half-written files, and idempotent re-ingest
- How to handle multimodal content: image upload, vision-model captioning, and image rendering in chat
Quality Score
No CourseDuck member has rated this course yet. Taken it? Give each part a thumbs up or down.
Overall Score : 94 / 100
Course Description
Build a Production-Style RAG System in Go — From Zero to Streaming Chat
Learn Retrieval-Augmented Generation by building one yourself, in plain Go, against any OpenAI-compatible model — local or hosted.
Stop reading about RAG and start shipping it. In this hands-on course you will build a complete, end-to-end Retrieval-Augmented Generation system from the ground up using the Go programming language. No Python. No LangChain. No magical abstractions. Just clear, idiomatic Go code that you can read, modify, and own.
By the end of the course, you will have a working application featuring a streaming terminal chat REPL, a browser-based chat UI with token-by-token Server-Sent Events, file and image uploads, a background filesystem watcher that ingests documents automatically, an evaluation harness that scores retrieval quality, and a Postgres + pgvector backend running in Docker.
Why this course?
Most RAG tutorials hide the interesting parts behind a framework. You wire three lines of someone else's library together, it works, and you have no idea what just happened. When something breaks in production — and it will — you are stuck.
This course takes the opposite approach. Every component is built explicitly, with clean seams between concepts so you can see exactly where the LLM client ends and the vector store begins. The package layout maps directly to lecture chapters. The interfaces between the LLM, the embedder, the vector store, the retriever, the chat loop, and the web server are deliberately exposed so you can swap pieces in and out as exercises.
This is the course I wish existed when I was learning RAG.
What you will build
A small but real RAG application with all the moving parts of a production system:
A streaming chat REPL (Read-Eval-Print Loop) in the terminal with a "thinking" spinner and proper history management
A web chat UI built with chi, Go templates, and Tailwind, streaming tokens to the browser over SSE with in-browser markdown rendering
A background filesystem watcher that detects new documents, chunks them, embeds them, and upserts them into pgvector — then moves the originals out of the way
A synchronous file upload path on the web UI for drag-and-drop ingest with chunk-count feedback
An image upload pipeline with optional auto-captioning by a vision-capable model, served back to the browser and rendered inline in chat
A paragraph-aware chunker with configurable size and overlap
A query rewriter that turns multi-turn conversation into a standalone search query before retrieval
A retriever with cosine-similarity filtering, top-K hit selection, and pluggable backends
A pgvector + Postgres 18 vector store with idempotent migrations, HNSW indexing, and a delete-by-source path that keeps re-ingest clean
What you will learn
How a RAG pipeline actually works end-to-end: chunking, embedding, vector search, query rewriting, context injection, and streaming generation
How to design Go interfaces so the LLM, the embedder, and the vector store are swappable without touching the rest of the codebase
How to stream LLM tokens to a terminal AND to a browser with Server-Sent Events
How to run everything against **OpenAI, Ollama, LM Studio, or Groq** — and how to mix and match (e.g. hosted chat with local embeddings)
How to use Postgres + pgvector for production-grade vector search, including HNSW indexes and embedding-dimension migrations
How to ingest documents reactively with `fsnotify`, debouncing half-written files, and idempotent re-ingest
How to handle multimodal content: image upload, vision-model captioning, and image rendering in chat
How to debug "why didn't the model use my docs?"
What makes this course different
Real code, not pseudo-code. Every example in the course is from a working, runnable project.
Local-first. You can complete the entire course with Ollama on your laptop. No API bills required.
Honest about tradeoffs. The course covers known limitations (chunker is token-blind, delete-then-upsert is not transactional, image retrieval is description-based) so you understand the design space, not just one fixed answer.
Tech stack you will use
Go, Postgres 18, pgvector, Docker Compose, chi router, Go templates, Tailwind, Server-Sent Events, fsnotify, OpenAI-compatible APIs (works with OpenAI, Ollama, LM Studio, Groq, and others).
Course outcome
When you finish this course, you will have a portfolio-quality RAG application running on your machine, a deep understanding of how every layer works, and the confidence to drop the same architecture into a real product at work. You will know what to measure, what to swap, and what to leave alone.
Enrol now and start building your own RAG system today.
Instructor Details
- 4.7 Rating
43 Reviews
Trevor Sawler
I have twenty years of experience in professional software development, and twenty years of experience as a University professor.
As an entrepreneur, I have worked with a broad range of clients, including Thomson Nelson, Hewlett Packard, the Royal Bank of Canada, Keybank, Sprint, and many, many others. I also have extensive management and project management experience. I have led teams of fifty developers and artists on multi-million dollar projects, and much smaller teams on much smaller projects.
As a professor, I have taught in a wide variety of course areas, including Computer Science, English, Irish, and American literature, and a number of "crossover" courses that bridge the liberal arts and technological fields.
I have won regional, national, and international awards for my work in the IT field, and have also won awards for my teaching and research as a University professor.
More courses by Trevor Sawler
Building Modern Web Applications with Go (Golang) (2022)
4.6 (5,848 Reviews)
Provider: Udemy
Time: 29.6h
$84.99
Working with Microservices in Go (Golang) (2024)
4.6 (3,186 Reviews)
Provider: Udemy
Time: 11.6h
$89.99
Working with Concurrency in Go (Golang) (2024)
4.7 (1,862 Reviews)
Provider: Udemy
Time: 9.7h
$79.99
Building Web Applications with Go - Intermediate Level (2025)
4.8 (597 Reviews)
Provider: Udemy
Time: 18.7h
$84.99
More Software Development courses
Build Web Apps with Nuxt.js 3: Master TypeScript & API [New] (2026)
4.9 (635 Reviews)
Provider: Udemy
Time: 6.7h
$19.99
70+ JavaScript Challenges: Data Structures & Algorithms (2023)
4.8 (748 Reviews)
Provider: Udemy
Time: 12.5h
$19.99
AI Agents Crash Course: Build with Python & OpenAI (2025)
4.8 (652 Reviews)
Provider: Udemy
Time: 3.4h
$19.99
Elasticsearch 9 & Spring Boot: Search Engine Masterclass (2026)
4.8 (225 Reviews)
Provider: Udemy
Time: 14.3h
$19.99
Introduction to AI and Machine Learning with Go (Golang) (2025)
4.8 (133 Reviews)
Provider: Udemy
Time: 36.2h
$19.99
Reviews
By Linux Isawesome on 9/1/2026
A bit advanced, but very good course to understand how llms work under the hood. This teacher is one of my preferred ones on udemy (english courses), maybe even #1. Real interesting stuff every time.
By Justin Djeumene on 8/20/2026
Great course! I love this teacher explaination.
By Paul Anderson on 7/27/2026
Another great course. Thanks Trevor.
By Stefano Cipriani on 7/22/2026
The concepts are well-organized and clearly explained. The course is not overly long—a definite advantage for participants who are working and have limited time.
By Gregorio Martinez on 7/4/2026
Trevor I am happy you are still creating courses. Thanks for another banger! Cant wait to do the python version.
By Doug Folland on 6/23/2026
I've taken several of your Golang courses and have always enjoyed them. This course was excellent as well!
By Héctor Barral on 6/18/2026
Excellent RAG course.
By Alibek Suleimenov on 6/10/2026
as always amazing
By Edward Cheadle on 6/1/2026
I think this was an amazing class. It really is for the intermediate go programmer. I haven't programmed in go for some time and it has changed, so I was a little lost at times, but that is my fault. There is only one minor annoyance and the only reason I can't give 5 stars is because often a large cursor gets in the way of reading some text and I have to stop or go back to see it. I lose my train of thought. Still it does not seriously impact the course, the only reason I give the course a slightly downgraded rating is because courses I give five stars don't have issues like this.
By Filipe Costa Ule on 5/21/2026
Incredible as always!







![Build Web Apps with Nuxt.js 3: Master TypeScript & API [New]](/programming/software-development/images/6457785_5adc_4.jpg?v=1789443959)




