Skip to main content

Glass Box

An educational HTTP/1.1 web server built from scratch in Java

Demystify web protocols by watching your HTTP requests flow through parsing, routing, and response pipelines in real time.

Core Features

{}

Raw HTTP/1.1 from Scratch

No frameworks, no magic. Built directly on TCP sockets with a custom request parser, router, and response builder so you can see exactly how HTTP works under the hood.

Virtual Threads (Java 25)

Leverages Project Loom virtual threads for lightweight, high-concurrency request handling without the complexity of traditional thread pools.

Real-time SSE Streaming

Server-Sent Events push live metrics, logs, and connection stats to a client-side dashboard as requests flow through the server.

Virtual Host Support

Serve multiple domains from a single server instance, each with its own document root, routes, and handler configuration.

/api

Built-in REST API

Includes a fully functional ToDo API with CRUD operations, demonstrating route-based handlers, JSON serialization, and proper HTTP methods.

YAML Configuration

Declarative YAML config for ports, log levels, virtual hosts, and route-to-handler mappings. Supports dev and production profiles.

Request Flow

Every request passes through a transparent pipeline you can inspect and learn from

1
TCP ConnectionClient connects via raw socket
2
HTTP ParsingHeaders and body extracted from byte stream
3
Host ResolutionVirtual host matched by Host header
4
Route MatchingURL pattern mapped to handler
5
Handler ExecutionRequest processed, response built
6
Response & LogResponse sent, metrics streamed via SSE

Tech Stack

Java 25Language & Runtime
Virtual ThreadsConcurrency Model
JacksonJSON & YAML Processing
MavenBuild System
Raw TCP SocketsNetworking Layer
ReflectionsHandler Discovery