BashintermediatebackendAI generated

Minimal Static File HTTP Server

A tiny HTTP/1.1 server implemented in Bash using netcat that serves static files from a directory, handles basic MIME types, and returns proper status codes for missing files. Learners practice raw socket handling in shell, HTTP protocol basics, and process/loop management.

Estimate
~8.5h
Steps
5
Completed by
0
Proposed by
codeseed.app

netcat · socat · mimetype detection

Project roadmap

  1. 01

    Parse a raw HTTP request

    ~2h

    Use nc in listen mode to accept a connection and parse the request line and headers from stdin.

  2. 02

    Map requests to files and detect MIME type

    ~1.5h

    Resolve the requested path against a document root and guess Content-Type from file extension.

  3. 03

    Build and send a valid HTTP response

    ~2h

    Construct status line, headers (Content-Length, Content-Type), and body, then write it back to the socket.

  4. 04

    Handle 404 and 403 error cases

    ~1.5h

    Return proper error responses for missing files and path traversal attempts (e.g. blocking '..').

  5. 05

    Add a request loop and logging

    ~1.5h

    Wrap the handler in a loop so the server accepts multiple sequential connections and logs each request.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~8.5h · 5 steps

Tech stack

netcatsocatmimetype detection