Website

This website is written from the ground up in C++, with some client-side Javascript. The server program targets Linux, using Unix socket syscalls directly -- specifically, it uses socket(), bind(), listen(), accept(), recv(), send(), and close() to facilitate communication. It creates a thread for each active connection in order to read and write from that connection, however the responses for each request are all processed on the main thread. The rationale is that waiting for data to make its way to and from the client is dependent on the quality of the client's internet connection, which may be poor and thus take a long time for transfers to complete, however deciding upon and generating the appropriate response for any request is quite fast.

This means the server website depends on the standard C++ library and the Linux API (which includes pthread, the library I use for threading), and that's all it needs in order to run. However, since it does not perform TLS encryption/decryption on its own, it must use an external web server such as Apache for HTTPS connections.

There are two reasons I decided to create my website from scratch: one is that, given a variety of options as to how to build something, I generally prefer to pick the option with the least overall complexity. This is not the same as difficulty, or the amount of code that I have to write -- by complexity, I mean the complexity of the total system as a whole, a tiny fraction of which is what's visible to the developer. The other reason, which is more significant in this case, is that I wanted to learn how a web server actually works. By building an understanding from the foundations, it makes it easier to make better decisions and identify inefficiencies when working at a higher level of abstraction.