Loading...

Build your own HTTP server

Learn about TCP servers, the HTTP protocol and more

Start Building
http-server
Go
http-server
Haskell
http-server
JavaScript
http-server
Python
http-server
Rust
http-server
C
http-server
C++
http-server
C#
http-server
Dart
http-server
Elixir
http-server
Gleam
http-server
Java
http-server
Kotlin
http-server
Ruby
http-server
Clojure
http-server
TypeScript
http-server
Zig

This challenge requires a CodeCrafters Membership.

You're welcome to study the full challenge structure and stage instructions for free. A membership is needed for submitting code and viewing solutions.

Want to try a free challenge? Try Build your own Kafka — it's free during beta.

HTTP is the protocol that powers the web. In this challenge, you'll build a HTTP server from scratch using TCP primitives. Your server will be capable of handling simple GET/POST requests, serving files and handling multiple concurrent connections.

Along the way, we'll learn about TCP connections, HTTP headers, HTTP verbs, handling multiple connections and more.

Base Stages

HTTP is the protocol that powers the web. In this challenge, you'll build a HTTP server from scratch using TCP primitives. Your server will be capable of handling simple GET/POST requests, serving files and handling multiple concurrent connections.

Along the way, we'll learn about TCP connections, HTTP headers, HTTP verbs, handling multiple connections and more.

Bind to a port
Very easy
We'd expect a proficient developer to take < 5 minutes to complete this stage.
Respond with 200
Very easy
We'd expect a proficient developer to take < 5 minutes to complete this stage.
Extract URL path
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Respond with body
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Read header
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Concurrent connections
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Return a file
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Read request body
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.

HTTP Compression

In this challenge extension you'll add compression support to your HTTP server implementation.

Along the way you'll learn about compression, compression scheme negotiation and more.

Compression headers
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Multiple compression schemes
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Gzip compression
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.

Persistent Connections

In this challenge extension you'll add persistent connections support to your HTTP server implementation.

Along the way you'll learn about persistent connections, the Connection header and more.

Persistent connections
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Concurrent persistent connections
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Connection closure
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.