Loading...

Build your own HTTP server

Learn about TCP servers, the HTTP protocol and more

Start Building
C
C
C#
C#
C++
C++
Clojure
Clojure
Dart
Dart
Elixir
Elixir
Gleam
Gleam
Go
Go
Haskell
Haskell
Java
Java
JavaScript
JavaScript
Kotlin
Kotlin
PHP
PHP
Python
Python
Ruby
Ruby
Rust
Rust
Scala
Scala
TypeScript
TypeScript
Zig
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 Shell β€” it's free this month.

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.

Stages

Bind to a port
Login via GitHub to view this stage
Respond with 200
Login via GitHub to view this stage
Extract URL path
Login via GitHub to view this stage
Respond with body
Login via GitHub to view this stage
Read header
Login via GitHub to view this stage
Concurrent connections
Login via GitHub to view this stage
Return a file
Login via GitHub to view this stage
Read request body
Login via GitHub to view this stage

HTTP Compression

Compression headers
Login via GitHub to view this stage
Multiple compression schemes
Login via GitHub to view this stage
Gzip compression
Login via GitHub to view this stage

Persistent Connections

Persistent connections
Login via GitHub to view this stage
Concurrent persistent connections
Login via GitHub to view this stage
Connection closure
Login via GitHub to view this stage