DEV Community

Aryan
Aryan

Posted on

Day 3 – The Thought That Changed Everything

Image description

🧠 Ever wondered what really happens before http.createServer() in Node?

I did β€” and decided to dig way deeper.

While working on my server recently, a thought struck me:

Can I build this from even lower down? Like, handle the raw socket connections myself β€” understand the handshake, data transfer at the byte level, and have full control over every bit sent and received.

So that’s exactly what I started doing:

βœ… Handling raw TCP data streams
βœ… Parsing HTTP methods, paths, and headers manually
βœ… Building a response engine without relying on the http module
βœ… Rewriting my Trie-based router to work directly on top of TCP sockets

Most devs just use express() or http.createServer().
But I wanted to know β€” what’s really going on underneath?

This deep dive is teaching me:
β†’ How TCP connections work from the ground up
β†’ How net.Socket behaves internally
β†’ How to build custom servers, proxies, or mini frameworks from scratch

Here is the Github Gist for the sample of the new implementation :

Top comments (0)