Devs HiveDevs Hive
System DesignNew
AI InterviewNew
Interview Q&A
Roadmaps
Courses

Interview prep

  • QuizzesTest yourself against the clock
  • MentoringMock interviews and personal prep

Learning

  • Books for the AI eraBooks worth reading
Sign In
Menu
System DesignNewAI InterviewNewInterview Q&ARoadmapsCourses

Interview prep

QuizzesMentoring

Learning

Books for the AI era
© 2026 Devs Hive. All rights reserved.
Privacy policy·LinkedInYouTube
System DesignNew
AI InterviewNew
Interview Q&A
Roadmaps
Courses

Interview prep

  • QuizzesTest yourself against the clock
  • MentoringMock interviews and personal prep

Learning

  • Books for the AI eraBooks worth reading
System DesignNewAI InterviewNewInterview Q&ARoadmapsCourses

Interview prep

QuizzesMentoring

Learning

Books for the AI era

Join us

Sign in to access all features

Sign InCreate account
←All courses

Text course

RAG from Scratch in TypeScript

How to make an LLM answer from your own documents: embeddings, chunking, pgvector, answers with sources and a chat on LangChain.js.

4 modules · 12 lessons · 5 quizzes

Start the course

You need a free account to take the course.

RAG from Scratch in TypeScript

LLMs know a lot, but nothing about your documents: company policies, documentation, notes. Retrieval-Augmented Generation (RAG) is the most common way to fix this: for every question, find the relevant document fragments and give them to the model.

The course has two parts:

  1. Theory: what LLMs can't do, what embeddings and semantic search are, and what a RAG system is made of;
  2. Practice: RAG by hand on the OpenAI SDK, then LangChain.js, document chunking, PostgreSQL with pgvector, answers with links to sources, a web chat with streaming, quality checks and moving the chat to Nest.js.

The course is for developers who know TypeScript and backend basics but haven't worked with LLMs yet. Each module ends with a short quiz, and there's a final quiz at the end.

The finished code for all practical lessons is in the examples repository: separately, scripts with no web framework, a chat on Express and a chat on Nest.js.

Syllabus

Module 1: How RAG works

Theory without code: what LLMs can't do, what embeddings and semantic search are, what parts every RAG system consists of, and how a vector index searches among millions of vectors.

  1. 1LLMs and their limits
  2. 2Embeddings and semantic search
  3. 3Anatomy of a RAG system
  4. 4Vector indexes
  5. Module quiz9 questions

Module 2: Your first RAG

Practice: RAG by hand on the OpenAI SDK, then LangChain.js, chunking, pgvector and answers with links to sources.

Start the course
  • 5RAG by hand on the OpenAI SDK
  • 6Documents and chunking with LangChain
  • 7Vector store: from memory to pgvector
  • 8Retrieval and answers with sources
  • Module quiz5 questions
  • Module 3: Chat and quality

    A web chat with a streamed answer and conversation history, and a first quality check on a set of test questions.

    1. 9Chat with streaming and history
    2. 10How to tell that RAG works
    3. Module quiz5 questions

    Module 4: What's next

    Moving the chat to Nest.js, an overview of the techniques that turn a prototype into a production system, and where to go after the course.

    1. 11Moving RAG to Nest.js
    2. 12From prototype to production
    3. Module quiz8 questions
    • Final quiz15 questions