A tiny, fully handmade HTTP server written in pure NASM x86_64, using only raw Linux syscalls: no libc, no C runtime, no external dependencies.
It accepts TCPs connections and responds with a minimal HTTP/1.1 message. The project is intentionally small, simple, readable, and educational, showing how things work under the hood.
$ ./assembly-http-server
# (server running)
$ curl http://0.0.0.0:8080
Hello from asm HTTP server!
This project was built to:
- Showcase real-world Linux syscall programming in assembly
- Demonstrate socket(), bind(), listen(), accept(), read(), write(), close(), and
fork() - Show how a TCP server works with zero abstractions
- Offer an educational codebase where each syscall is implemented in a dedicated file
- Help others understand that low-level programming is not impossible, it's actually fascinating
If you're curious how the kernel expects things to be laid out in memory… this repo is for you.
git clone https://github.com/renanleonellocastro/assembly_http_simple_server.git
cd assembly_http_simple_server
Make sure you have:
nasmld- Linux x86_64 system
Then simply:
make
Run:
./assembly-http-server
Your server will now be listening on:
http://0.0.0.0:8080
Once running, open your browser or use curl:
curl http://0.0.0.0:8080/
assembly_http_simple_server/
│
├── src/
│ ├── main.asm # Entry point, server loop, accept(), fork(), reading request
│ ├── handler_send.asm # Sends HTTP response
│ ├── net_sockaddr.asm # sockaddr_in structure
│ ├── sock_socket.asm # All syscall wrappers (one per file)
│ ├── sock_setsockopt.asm
│ ├── io_write.asm
│ ├── sock_bind.asm
│ ├── sock_listen.asm
│ ├── sock_accept.asm
│ ├── sys_fork.asm
│ ├── sys_wait4.asm
│ ├── io_close.asm
│ └── sys_exit.asm
│
├── Makefile
├── LICENSE
└── README.md
Every function lives in its own file, keeping the implementation extremely clean and easy to study.
- 🔧 Pure Linux syscalls (no libc)
- 🧱 One syscall per file for educational clarity
- ✍️ Well-commented Assembly, written for humans
- 🧵 Fork-per-connection model
- 🌐 Minimal, valid HTTP/1.1 Response
- 🔒 No dependencies
- 📚 Perfect for learning/demonstrating low-level knowledge
Contributions, issues and pull requests are welcome! If you'd like to add features, improve documentation, or extend the educational content, feel free to open an issue.
This project is released under the MIT License.
See LICENSE for details.
If you found this project useful or interesting, please consider giving it a ⭐ on GitHub!