liveBook · Manning

What you will learn in Build AI-Enhanced Web Apps

How to get reliable results with React, Next.js, and Vercel

by Theo Despoudis

Chapter by chapter

Chapter 1: Using generative AI in web apps

1.1 What generative AI can do for web applications · 1.1.1 Generative AI capabilities · 1.1.2 Real-world uses of generative AI · 1.2 How a generative AI web app works · 1.2.1 Core components · 1.2.2 The flow of user interactions · 1.3 AI tools and the ecosystem · 1.4 Choosing the right model · 1.4.1 Model types · 1.4.2 Pretrained vs. self-hosted · 1.4.3 Performance considerations · 1.5 Generative vs. traditional AI · 1.6 Handling the concerns and implications of generative AI · 1.6.1 What are the limitations of generative AI? · 1.6.2 Will developers lose jobs because of AI? · 1.6.3 Are generative AI outputs reliable? · 1.7 Summary

What you learn in chapter 1 →

Chapter 2: Building your first generative AI web application

2.1 Introducing Astra · 2.2 Project goal and requirements · 2.2.1 Goal: Build a simple interactive AI chat interface · 2.2.2 Project and technology requirements · 2.2.3 Setting up · 2.2.4 Running the project · 2.3 Under the hood: The generative AI lifecycle · 2.4 Designing for a better user experience · 2.5 Building the major components · 2.5.1 Frontend · 2.5.2 Autoscroll · 2.5.3 ChatPage · 2.5.4 ChatList · 2.5.5 The backend: Handling API communication · 2.5.6 Tests · 2.5.7 Common challenges and solutions · 2.6 Assessing the app’s first iteration · 2.7 Migrating the app to Next.js · 2.7.1 Setting up · 2.7.2 Running the project · 2.8 Routing and configuration on Next.js · 2.8.1 File-based routing · 2.8.2 Configuration · 2.8.3 Environment variables in Next.js · 2.8.4 Route groups · 2.8.5 Layout components · 2.8.6 Route API handlers · 2.8.7 Going deeper with Next.js · 2.9 Summary

What you learn in chapter 2 →

Chapter 3: Connecting AI models with the Vercel AI SDK

3.1 Introducing the Vercel AI SDK · 3.1.1 Key features and benefits · 3.1.2 A strategic approach to integration · 3.1.3 Practical integration: The Vercel AI SDK with Astra AI · 3.2 Handling streaming responses with the Vercel AI SDK · 3.2.1 Challenges and how the SDK solves streaming in web applications · 3.2.2 Implementing streaming with the Vercel AI SDK · 3.2.3 Integrating streaming into Astra AI · 3.3 Working with multiple AI providers · 3.3.1 Handling different AI providers and models · 3.3.2 Using the Vercel AI SDK’s interoperability · 3.3.3 Astra AI project: Integrating multiple AI providers and models · 3.4 Enhancing conversational UIs with multimedia content · 3.4.1 Introducing OpenAI’s vision capabilities · 3.4.2 Astra AI project: Integrating Gemini vision queries · 3.5 Summary

What you learn in chapter 3 →

Chapter 4: Managing conversation and state in your application

4.1 AI SDK React server components · 4.1.1 Overview of RSCs · 4.1.2 Using server actions for AI-powered RSCs · 4.1.3 Updating the UI to use server actions · 4.1.4 Techniques for generating and streaming UI components · 4.1.5 Creating streamable UI components from LLM providers with streamUI · 4.1.6 Streaming React components with createStreamableUI · 4.2 Managing UI state in AI-powered applications · 4.2.1 Separating AI and UI state in React/Next.js applications · 4.2.2 Key components for UI state management · 4.2.3 Implementing UI state management patterns · 4.3 Structured data generation using the Vercel AI SDK · 4.3.1 How structured data generation works · 4.3.2 Techniques for generating structured data from AI responses · 4.3.3 Tools for implementing type-safe AI-generated content · 4.3.4 Integrating structured data generation into our web application · 4.4 Tool and function calling with AI models · 4.4.1 Understanding tool calling and function calling in AI models · 4.4.2 Implementing custom tools and functions with the Vercel AI SDK · 4.5 Summary

What you learn in chapter 4 →

Chapter 5: Prompt engineering in web applications

5.1 Introducing prompt engineering · 5.1.1 What exactly are prompts? · 5.1.2 Prompt types · 5.1.3 Organizing your prompts: Versioning, testing, and optimization · 5.2 Few-shot learning · 5.2.1 Examples of few-shot learning · 5.2.2 General methodology for creating few-shot learning prompts · 5.3 Chain-of-thought prompting: A deeper dive into reasoning · 5.3.1 Example of chain-of-thought prompting · 5.3.2 General methodology for creating chain-of-thought prompts · 5.4 Embeddings: Giving AI a sense of meaning · 5.4.1 The restaurant menu analogy: A taste of embeddings · 5.4.2 Using embeddings in practice: The Vercel AI SDK · 5.4.3 Use case: IT support knowledge base · 5.5 Going deeper into LLM techniques · 5.5.1 Tree of thoughts · 5.5.2 Self-refine · 5.5.3 LLM-as-a-judge · 5.6 Summary

What you learn in chapter 5 →

Chapter 6: Building AI workflows with LangChain.js

6.1 Introducing LangChain · 6.1.1 Chaining calls with LangChain · 6.1.2 Integration with the Vercel AI SDK · 6.2 Preparing and storing documents for retrieval using LangChain · 6.2.1 Document ingestion using text splitters · 6.2.2 Introducing vector stores · 6.2.3 Document retrieval · 6.2.4 Full example of preparing and storing documents with LangChain · 6.3 Using memory components in LangChain to remember conversation history · 6.4 Utilizing agents in LangChain.js · 6.4.1 How LangChain agents work · 6.4.2 Creating an agent using LangChain.js · 6.4.3 Agent integration with the Vercel AI SDK · 6.4.4 Overview of LangChain.js modules · 6.5 Going deeper with LangChain.js · 6.5.1 LangChain Expression Language · 6.5.2 LangGraph · 6.6 Summary

What you learn in chapter 6 →

Chapter 7: Document summarization and RAG with LangChain.js

7.1 Building a document summarization web application with LangChain.js · 7.1.1 Summarization app project requirements · 7.1.2 Architecture and workflow · 7.1.3 Building the document summarization web application · 7.1.4 Caveats and limitations of document summarization · 7.1.5 Demonstrating the app · 7.1.6 Additional considerations for summarizing documents · 7.2 Building a RAG web application with LangChain.js · 7.2.1 RAG app project requirements · 7.2.2 Key architectural components of RAG · 7.2.3 Technical architecture overview · 7.2.4 RAG system components · 7.2.5 Web app demonstration · 7.2.6 Adding grounding support · 7.3 Summary

What you learn in chapter 7 →

Chapter 8: Testing and debugging techniques

8.1 Debugging Next.js AI applications · 8.1.1 Debugging common Next.js rendering Issues · 8.1.2 Debugging client–server problems · 8.1.3 Handling state management · 8.1.4 Performance monitoring · 8.2 Vercel AI SDK troubleshooting · 8.2.1 Handling error states in AI-generated content · 8.2.2 Managing token limits and rate limiting · 8.3 Troubleshooting LangChain.js · 8.3.1 Chain execution errors · 8.3.2 Troubleshooting model integration problems · 8.4 Testing strategies for AI applications · 8.4.1 Unit and integration testing in React and Next.js · 8.4.2 Mocking LLM responses · 8.4.3 Testing Vercel AI SDK responses · 8.4.4 Testing LangChain.js · 8.5 Summary

What you learn in chapter 8 →

Chapter 9: Deployment and security

9.1 Building a secure foundation with input validation, rate limits, and middleware · 9.1.1 Input validation · 9.1.2 Security middleware layer · 9.2 Building a core security and data protection pipeline · 9.3 Setting up authentication and authorization · 9.3.1 Simple authentication with Clerk.js and Next.js · 9.3.2 Practical security control: Rate limiting · 9.4 API key and secrets management · 9.4.1 Understanding Next.js environment variables · 9.4.2 Application-level API keys · 9.4.3 User-provided API keys · 9.5 Data protection and compliance · 9.5.1 Example: Adding anonymization to our chat messages · 9.6 Deployment considerations for AI web applications · 9.6.1 Deployment options · 9.6.2 Production deployment checklist · 9.6.3 Example deployment to Vercel · 9.6.4 Alternative deployments: Netlify · 9.6.5 Alternative deployments: Hugging Face Spaces · 9.6.6 Next steps · 9.7 Summary

What you learn in chapter 9 →

Chapter 10: Building an AI interview assistant: Project walk-through

10.1 Overview of the application · 10.1.1 Key features · 10.1.2 Technical implementation · 10.1.3 Technology stack overview · 10.2 Security measures implemented · 10.3 Challenges during development · 10.3.1 State management considerations · 10.3.2 Text-to-speech integration · 10.3.3 Generating feedback · 10.4 Additional considerations and improvements · 10.5 Summary

What you learn in chapter 10 →

Chapter 11: Building an AI RAG agent: Project walk-through

11.1 Overview of the application · 11.1.1 Key features · 11.1.2 Technical implementation · 11.1.3 Technology stack overview · 11.2 Challenges during development · 11.2.1 Shared vs. dedicated user data in vector stores · 11.2.2 Security considerations around document management and heavy workloads · 11.2.3 API design and URL structure to minimize information exposure · 11.3 Additional thoughts on AI and the future of web development · 11.4 Summary

What you learn in chapter 11 →

Chapter 12: Integrating web apps with the Model Context Protocol

12.1 Why the MCP matters for AI integration · 12.2 MCP architecture · 12.3 Connecting Next.js and the Vercel AI SDK with the MCP · 12.3.1 Architecture overview · 12.3.2 Building an end-to-end integration with the MCP in Next.js · 12.3.3 Benefits of using the MCP for web applications with LLMs · 12.4 Inside an MCP server: Extending web applications · 12.4.1 MCP server structure · 12.4.2 Additional considerations for MCP servers · 12.5 Integrating MCP servers with LangChain.js · 12.5.1 Architecture overview · 12.5.2 Building an end-to-end integration with LangChain.js · 12.6 The future of the MCP: Gateways, directories, and MCP-as-a-service · 12.6.1 MCP gateways · 12.6.2 MCP-as-a-service · 12.6.3 MCP directories and registries · 12.7 Your next steps with MCP servers · 12.8 Summary

What you learn in chapter 12 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.