A custom HTTP server written from scratch using raw TCP sockets — with a heavy focus on security, rate limiting, and controlled request flows.
- Log in securely via JWT
- Hit 3 predefined endpoints
- View your own request metadata
- And do it all within a 4 requests/week/IP limit
Strict? Yeah. But that's the point.
I built beasty as a challenge through CodeCrafters, inspired by a desire to go low-level — and a craving to showcase that work live on the internet.
And it really seemed interesting, which it absolutely was!!!
Written in Node.js, using net module (no HTTP wrappers). Processes requests manually from buffer chunks. Splits them into its HTTP method, path, headers, body, and version.
-
JWT-authenticated requests only (made a whole separate backend folder for this)
-
3 hardcoded endpoints:
- /greeting
- /beasty — user metadata (no IP)
- /beasty?withIP=true — full metadata (with IP)
-
No user can hit custom URLs. Only these endpoints are allowed. That's not a bug, that's a feature. For atmost security.
-
TCP-level rate limiting was too good — slowed everything down, so had to remove it.
-
CORS & CSP hell — made worse by 3 separate services (frontend, backend, beasty)
-
Dev Auth Hell — logged in so many times for testing that I can't explain!
-
Socket end states were bad, they issued a lot of bugs.
- Zero external HTTP dependencies
- Real-time metadata tracking
- Gzip compression with configurable levels
- Custom error handling with detailed messages
- Privacy-first logging (no IP storage)
I learned a lot building this project — the logic was determined by me alone (i am proud of it). Maybe nobody has made this exact kind of thing (or maybe I just haven't seen it), but yeah, all the customization, the flow of requests + responses — I figured out myself, and it was a solid learning.
- Rate-limiting
- IP-level rate-limiting
- TCP-level rate-limiting
- Input sanitization
- Gzip compression
- Handling timeouts
- Connecting two backends with one frontend
- API integration at its peak
- CORS & CSP are bad
# Clone & install
git clone https://github.com/NewSmoke38/beasty-the-http-server.git
cd beasty-the-http-servercd backend && npm install bcrypt cors dotenv express jsonwebtoken mongoose nodemoncd beasty && npm install jsonwebtoken node-fetch nodemoncd frontend && npm install axios jwt-decode react react-dom vite eslintTerminal 1 - Backend:
cd backend && npm run devTerminal 2 - Frontend:
cd frontend && npm run devTerminal 3 - Beasty server:
cd beasty && ./your_program.shTerminal 4 - Beasty requests:
cd beasty && your curl requestRead the full Documentation