Build Your Own Web Server From Scratch In JavaScript
⟵ prev Contents next ⟶

🆕 This chapter is part of the WIP book:
Build Your Own Web Server From Scratch In JavaScript

Subscribe to get notified of new chapters and the book's release.
🔥 My other Book: Build Your Own Redis

Build Your Own Web Server From Scratch In JavaScript

Learn network programming, HTTP protocol and their applications in one book.

James Smith


Understand the basis of the Web by coding a web server from scratch.

You probably use a browser to surf the web every day, and HTTP is one of the technologies that powers the web. It is one of the foundations of today’s software ecosystem. There are many important software products that are related to web technologies. To name a few: NGINX, Apache, and many HTTP-based RPCs.

While many software developers are web developers, not many software developers have peeked into the technology itself. Web servers and networking applications are often seen as magical black boxes. That’s why I started the “Build Your Own X” book series. To learn and teach basic things by the “from scratch” approach, through succinct and condensed books.

Even if you are not a web developer, general knowledge of computer networking is still relevant. And coding a web server can be good a project to learn how network applications are created. It’s also a fun side project for your spare time.


Part I: Make A Basic HTTP Server

  1. Introduction
  2. HTTP Overview
  3. Code A TCP Server
  4. Promises and Events
  5. Your First Network Protocol
  6. HTTP Semantics & Message Format
  7. Code Your First HTTP Server

Part II: Applications & Extensions

(Coming soon.)

  1. Dynamic Content and Streaming
  2. Static Files and Caching
  3. Proxies and Load Balancers
  4. Timeouts
  5. WebSocket and Messaging

Work in Progress…

Subscribe to be notified of new chapters.

[🔔 Subscribe]

Book Cover

I have curated a list of resources that are highly relevant and can be used as supplements.

High Performance Browser Networking by Ilya Grigorik.
[Amazon] [Web]
A book that focuses on creating fast network applications. One cannot understand performance issues without first understanding networking. Although the title says “browser”, this is a general and practical networking book relevant to all kinds of developers.
Fundamentals of Backend Engineering by Hussein Nasser.
Moving data around databases is only a small part of backend applications, a larger part of backend engineering is about computer networking, i.e. how components are connected, different communication patterns such as push or polling, layers of protocols, and etc. This Udemy course largely overlaps with the goal of this project, but goes broader and deeper.
Eloquent JavaScript by Marijn Haverbeke.
[Amazon] [Web]
Not a JS developer, but still want to follow this project and code an HTTP server? Fortunately, JS is one of the easiest languages to pick up. If you know a few other programming languages, you can probably get started in no time.
See also: offers “Build Your Own X” courses in many programming languages.
Including Redis, Git, SQLite, Docker, and more.
Check it out

⟵ prev Contents next ⟶