Show HN: Building a web server in assembly to give my life (a lack of) meaning

· systems coding web · Source ↗

TLDR

  • ymawky is a static HTTP server in aarch64 assembly for macOS, using raw Darwin syscalls, no libc, supporting GET/HEAD/PUT/OPTIONS/DELETE, byte ranges, and directory listing.

Key Takeaways

  • Raw Darwin syscalls only: syscall number in x16, args in registers, carry flag signals failure – no exceptions, no automatic cleanup.
  • Fork-on-request model: simple to reason about but memory-heavy and connection-limited compared to nginx’s async event-driven model.
  • HTTP parsing is ~200 lines of assembly per method: percent-decoding, strict CRLF validation, 414/400 guards against buffer overflows and malformed headers.
  • PUT writes to a temp file (.ymawkytmp<pid>) then renames atomically; incomplete transfers trigger unlink() to avoid half-written files.
  • Config-gated MAX_BODY_SIZE (default 1 GB) and ALLOW_DIR_LISTING; hardening is explicit and hand-rolled throughout.

Hacker News Comment Review

  • Community reaction is warmly nostalgic – commenters with C64/Amiga assembly backgrounds recognize the tradeoffs and validate the approach as a serious learning exercise.
  • The author confirms ~3,000 lines of code with ~1,000 comment lines; a commenter requested separate architecture docs and the author agreed to add them.
  • The repo link was initially misconfigured in the HN submission; the correct repo is github.com/imtomt/ymawky.

Notable Comments

  • @imtomt: “I think most programmers would benefit a lot from taking a few weeks or months to try and learn some assembly, and demystify how CPUs and compiled languages work.”

Original | Discuss on HN