Systems & architecture
AI engineering for web developers
From a streaming chat UI and RAG that answers correctly to MCP servers for agents and LLM app security — what a web developer needs to ship AI features to production.
4 parts86 min readUpdated Oct 24, 2026
Parts
Part 1
Building a Streaming AI Chat UI That Stays Smooth: SSE, ReadableStream, Incremental Markdown and a Stop ButtonThe frontend half that AI chat tutorials tend to skip: picking a transport, parsing SSE by hand when events are split across chunks, a Route Handler that keeps the API key safe and propagates cancellation upstream, message-parts state, batching renders with requestAnimationFrame, safe incremental markdown, autoscroll, accessibility and error handling.
19 min
Part 2
RAG That Actually Answers Correctly: Chunking, Hybrid Search with pgvector, Reranking and EvaluationAnyone can build a RAG demo in an afternoon; making it answer correctly is the hard part. This post walks through a TypeScript RAG pipeline on PostgreSQL/pgvector: structure-aware chunking, hybrid search fused with RRF in a single SQL query, reranking, filtering by permission before ranking, citations, and how to measure quality with numbers.
25 min
Part 3
Model Context Protocol in Practice: Building a Production MCP Server in TypeScriptMCP isn't magic, it's a well-designed JSON-RPC protocol. This post explains hosts, clients, servers, primitives and transports as of the 2026-07-28 spec, then builds a read-only TypeScript server over order data: tool design, pagination, testing with the Inspector, OAuth for remote servers, and the security holes you need to close.
19 min
Part 4
LLM and Agent Application Security: Prompt Injection, Excessive Agency and the OWASP Top 10 for LLMsA practical threat model for applications that put an LLM between tools and private data: direct and indirect prompt injection, the lethal trifecta, and the design patterns that keep the damage contained, mapped against the OWASP Top 10 for LLM Applications.
23 min
Series review
0/8 answered · 0 correct
8 questions drawn from the parts of this series. Answers here count toward each post's own quiz.
Other series
Series- NestJS in production3 parts · 67 min read0/3 read
- Web performance from the ground up8 parts · 74 min read0/8 read
- Modern CSS and the web platform5 parts · 46 min read0/5 read
- Frontend architecture that lasts5 parts · 30 min read0/5 read
- The engineering craft4 parts · 21 min read0/4 read
- Frontend in depth7 parts · 129 min read0/7 read
- Business analysis for product teams6 parts · 147 min read0/6 read
- Web application security9 parts · 168 min read0/9 read