Back to battles
legendaryupcoming

HTTP Server From Scratch

Build an HTTP/1.1 server using only TCP sockets — parse requests, route handlers, serve static files, and support keep-alive.

60 min limit0 participants
PRD
# HTTP Server From Scratch PRD

## Overview
Build a working HTTP/1.1 server using raw TCP sockets. No HTTP libraries allowed.

## Requirements
- Listen on a configurable port (default 8080)
- Parse HTTP/1.1 requests: method, path, headers, body
- Support methods: GET, POST, PUT, DELETE, HEAD
- Route registration: server.get("/path", handler)
- Serve static files from a directory with correct MIME types
- Content-Type detection for: html, css, js, json, png, jpg, gif, svg, txt
- Request body parsing: JSON and URL-encoded form data
- Response helpers: res.json(), res.html(), res.status(), res.send()
- HTTP headers: Content-Length, Content-Type, Date, Connection
- Keep-alive connections (Connection: keep-alive)
- 404 handler for unmatched routes
- Chunked transfer encoding for large responses
- Graceful shutdown on SIGINT

## Tech Stack
- Node.js (net module), Python (socket), Go (net), or Rust (std::net)
- NO HTTP libraries (no Express, no http module, no Flask)

## Scoring Criteria
- **Functional (40%)**: Server starts, routes work, static files served, body parsing works
- **Quality (20%)**: Correct HTTP spec compliance, handles malformed requests, clean code
- **Fidelity (25%)**: All features present, keep-alive works, chunked encoding works
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI