LangChain for JavaScript developers
Minimum price
Suggested price

LangChain for JavaScript developers

How to integrate LLMs into Javascript web apps

About the Book

LangChain for JavaScript developers is a practical beginner’s workshop for integrating LLMs into JS applications.

Learn by building 5 real LLM-powered apps with LangChain, Next.js, and React.

📘 Preview first 25 pages for free

The AI Engineer, responsible for integrating AI features into traditional software applications, will be one of the most in-demand roles in the coming years.. In fact, there is a high chance that AI Engineers will outnumber ML Engineers in the near future.

LangChain is a perfect gateway to starting your AI Engineering journey. LangChain serves as the orchestrator that connects nearly everything in the AI-Webapp integration system. Starting from this point, you can get gain a good understanding of how all the components work together.

I’ve been doing JavaScript for almost 20 years, and this this book emerged from my struggle to reconcile the undeniable wave of AI Technologies with classic web development. You can read the full story here

In this short course, we take a fun, hands-on, and pragmatic approach to learning how to build LLM-powered apps using LangChain. We will build the following five examples using LangChain, Next.js and React:

  • 🦄 The Story Maker 
  • 🍵 Tea Wikipedia app
  • 🧭 Geography Trivia game
  • 🗄 Documents Researcher app
  • 🕵️‍♂️ AI Agent chatbot 

The goal of this course is to teach you LangChain development in a manageable way without overwhelming you. Some of the topics we will cover include: 

  • models and prompt templates
  • output parsers,
  • streaming data
  • conversation memory
  • agents & tools
  • RAG - Retrieval Augmented Generation
  • debugging responses and more. 

📘 See the full table of contents

Recent Changes

19 may 2024: I've updated all the code to use the .invoke() method for chains instead of .call(). The .call() method will be deprecated in the future versions of LangChain. 

What prerequisites do I need to have before taking this course?

The examples are using Next.js and React. You don't need to be an expert but you will need a very basic understanding of how React works.

Is the learning material up-to-date?

LangChain is currently undergoing rapid development. Technical books often become outdated soon after release, but since this book is self-published, I can update it as needed. I aim to provide monthly updates.

What if I don't like it? Can I get a refund?

I'm sorry to hear that you're not happy with the book! Yes, you can do a refund request within 60 days of purchase and I will fully refund you the price. While not mandatory, I would appreciate it if you could provide the reason for the refund so I can improve the book.

Do you support Purchasing Power Parity or student discounts?

If you live in a country with low purchasing power, or you are a student mail me with your details and some proof (student ID, etc.) and I'll organize a special discount for you.

  • Share this book

  • Categories

    • JavaScript
    • React
    • Node.js
    • Artificial Intelligence
    • Web Development
  • Feedback

    Contact the Author(s)

About the Author

Daniel Nastase
Daniel Nastase

Hi there, friend! I’m Daniel, a software developer and educator.

I like computers. I try to make them like me back. More than computers I like humans. I think every person has value, intelligence, and good inside. I believe that education is the key to building a better, stable, and richer world.

I used to work at companies such as Skillshare, Tradeshift or ING, where I had a chance to be exposed to completely different types of frontend development in various teams.

Over the past five years, I've been writing articles on about JavaScript, CSS, and other software development topics.

I've always enjoyed teaching, holding both in-class and online classes, and being involved in tech education startups.

You can always reach me on Twitter and read more on

Table of Contents

    • Introduction
      • About the author
      • How this book came to be
      • What is LangChain
      • Overview of this book
      • Requirements and how to use this book
    • Models, Prompts and Chains
      • Introduction
      • Getting Started
      • The API key for the OpenAI ChatGPT model
      • Using the ChatOpenAI LangChain model
      • Prompt templates
      • Chains
    • Introduction
      • Introduction and project setup
      • Project refactor
      • Streaming the response
    • Output parsers
      • Introduction
      • Example setup
      • StringOutputParser
      • CommaSeparatedListOutputParser
      • The getFormatInstructions() method and custom parsers
      • StructuredOutputParser
    • Chat memory
      • Introduction and project setup
      • Injecting messages into the conversation memory
      • Full conversation history
    • RAG / Chating with documents
      • Introduction
      • Example setup
      • Using local documents
      • Components of the RAG process
      • Vectors, Embeddings and Vector databases
      • Using CheerioWebBaseLoader and MemoryVectorStore
    • AI Agents
      • Introduction and project setup
      • Making an agent
      • Monitoring agents and performance considerations
      • Recap
    • Final Words

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub