My chess game has three layers. There's a browser page, a small Flask server, and a chess engine written in C. The server runs the engine as a separate program. You can follow the whole build in How to Make AI Projects in C . My build notes say a layer can look fine in the code and still give you a 404 or a 500. It happened to me twice. Below you'll see what each bug looked like, why it happened, and the tests that now catch it. I ran every test on Python 3.14 with GCC 16.1 on Windows.
How the Layers Talk
Browser (HTML/CSS/JS) --JSON--> Flask (server.py) --command line--> C engine (engine.exe)
Enter fullscreen mode
Exit fullscreen mode
The browser never talks to the engine. It sends the board and a move to Flask. Flask runs the engine as a subprocess and reads one line of output. Then it answers the browser with JSON. So a mistake in one layer pops up in another layer as a vague error. A missing file in the engine layer becomes a 500 in the server layer.…