Jaroslav Ištvan
ČeštinaEnglish
← Back to projects

Portfolio — how this website works

Next.jsReactTypeScriptCSS ModulesExpress

What this website is

A portfolio that does not just describe school projects but lets you run them. Most student portfolios stop at a paragraph and a link to the repository; the idea here is different - for the projects where it makes sense, readers can enter their own input and run the very same program that was written for school.

It started with a single index.html and a single style.css. That version still exists and serves as the design template, but a static page cannot take an input and run a computation on it. That is why this one was built - as an application that can talk to programs written in C++.

How it is put together

Three layers, each with a single responsibility. What matters is what they do not do: the website computes nothing and the server simulates nothing.

  • Website — renders the pages, collects input from the user and shows the results. It contains no project logic.
  • API server — a thin pass-through. It takes the input as JSON, starts the compiled C++ binary, passes the input to its standard input and sends its output back unchanged. It does not even validate - the C++ program enforces its own rules.
  • C++ programs — the original school projects. They stayed as they were; they only gained the ability to take input as JSON instead of having it hard-coded. The automaton simulator also got a more memory-efficient search (more in the block below), but an accepted word goes through the same computation.

The reason for this split is simple: if the website computed the simulation itself, it would have to reimplement all of it in JavaScript - and from then on, the page would be running something other than what was handed in. This way readers really run the original program.

How the demos compute

Both demos take the same route: the input travels to the server, which runs the C++ program and returns its result. Each of them had a different reason for it, though:

  • IMS has to run on the server. The simulation is built on the SIMLIB library, which has to be installed and compiled. That is not possible in a browser.
  • HZA could run in the browser. The automaton simulator needs no library and could be compiled to WebAssembly. It still takes the same route as IMS - one technology fewer, and all the programs run in one place.

The price is that the HZA computation loads the server. The breadth-first search from the bachelor’s thesis remembers every configuration it has visited and took up to gigabytes of memory on more demanding words. The website therefore uses iterative deepening depth-first search, which gets by with tens of megabytes, and limits the computation by time - a minute at most. When it accepts a word, it finds the same computation as the original version.

Technologies used

LayerWith whatWhy that
WebsiteNext.js, React, TypeScriptPages are created from the folder structure and pre-generated ahead of time, so they load as static files
Stylesplain CSS ModulesThe look comes from the hand-written CSS of the original page; a utility framework would only wrap it in someone else’s notation
Languages[lang] segment in the URLEvery page is pre-generated twice, /cs/… and /en/…; the language is visible in the URL and is not stored anywhere else
StateZustandHolds only two things that survive closing the page: the theme choice and your own HZA automata
API serverNode.js, ExpressIts only job is to start a process and pass data along, and a few dozen lines are enough for that
ProjectsC++17 and C++20The language they were handed in in; nothing was rewritten
ImagesPython, standard libraryCharts and diagrams are generated by a script, not drawn by hand in an editor

Where the look comes from

The purple background, turquoise bars and white blocks with rounded corners come from the original static page - hand-written HTML and CSS created in the ITW course (Web Design). No template, no generator.

This website builds on that look rather than replacing it. The static version remained the binding template: that is why dark mode deliberately switches only two things - the block fill from white to black and the text from black to white. The rest of the palette stays as it was. Recolouring everything would create a second look that would drift apart from the first.