Skip to content

About

Pure Typescript HTTP Server based on Bun TCP sockets, from scratch. Zero libraries, zero deps.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

http-server-bun-ts

Pure Typescript HTTP Server based on Bun TCP sockets, from scratch.

Zero libraries, zero dependencies, zero ChatGPT, 100% man made and DIY.


This is a rewrite in Typescript using the native Bun TCP API of my solution to the "Build Your Own HTTP server" Challenge.

progress-banner

HTTP is the protocol that powers the web. In this challenge, you have to build a HTTP/1.1 server that is capable of serving multiple clients.

This server is build on top of native Bun 1.1 native API, avoiding its builtin HTTP Server (DIY or not?), meaning that it is a pure TCP server, and it can parse and serve concurrent HTTP request syntax requests, and more.

Just launch it by:

$ bun src/main.ts [--directory <staticFilesDirectory>]
OR
$ bun start [--directory <staticFilesDirectory>]

Even Faster version:

Just bypass the Typescript transpilation by bundle sources into a unique compact javascript file:

$ bun run bundle

Then start this file:

$ bun app/main.js

Portable executable binary

If you want to distribute this program as a standalone executable binary, thanks to Bun, you can do it by:

$ bun run build

You should now have an executable file named "http-server" at the root of your directory.

About

Pure Typescript HTTP Server based on Bun TCP sockets, from scratch. Zero libraries, zero deps.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages