Skip to the content.
Engineering Log: Evolution of a First-Principles Architectural Paradigm | AI Systems Design From Scratch

Connect with Amin Boulouma Official

AI Systems Design From First Principles - An implementation of AI Systems Design From First Principles | Product Hunt

🏠 Documentation Hub 📝 Engineering Blog 💻 GitHub Repository

Engineering Log: Evolution of a First-Principles Architectural Paradigm

Amin BouloumaSoftware Engineer

True systems mastery is never built in a single, flawless stroke. It is forged through a relentless cycle of implementation, critical evaluation, aggressive refactoring, and abstraction pruning.

Looking back at the commit ledger over the past few days, you can see a vivid picture of what it actually means to build complex systems from scratch. What began as a broad roadmap on June 16 rapidly matured into a battle-tested, zero-dependency engine by June 19.

Here is the raw, behind-the-scenes breakdown of how this custom architecture evolved.


June 16: Building the Base & Fighting the Pipelines

Every ambitious engineering sprint starts with a massive dump of core mechanics and the inevitable friction of setting up deployment pipelines.

Initial commit: Set up first-principles architecture and technical roadmap

The Roadmap and the Routing Matrix

The journey began by establishing the basic scaffolding for a massive suite of raw-socket implementations: HTTP servers, custom relational storage engines, load balancers, and a minimalist container daemon. Early iterations wrestled heavily with metadata handling, post routing, and getting the static documentation engine configured properly.

Key Lessons from the Trenches:


June 18: Architectural Purging and Applying SOLID

With the baseline layout stable, June 18 was defined by code discipline. Writing code from scratch often means writing something that works first, then aggressively refactoring it to map cleanly to object-oriented design patterns.

The Rise and Fall of the Singleton

Added Singleton Pattern over the codebase
...
Removed Singleton Pattern over the codebase

This sequence is the hallmark of real systems engineering. The Singleton pattern was initially introduced to manage shared state across the custom engines. However, global state frequently introduces subtle architectural rigidity and testing bottlenecks. Recognizing this, the pattern was promptly ripped out and replaced with explicit Factories and structured dependency injection patterns (Added Factory and other design patterns).

Deepening the Parsers

The Markdown parser and the custom YAML engine received massive design overhauls. The objective here was clear: push the code toward strict compliance with SOLID principles, ensuring that the text tokenization pipes and string-slicing logic remained modular and easily extensible without relying on abstract syntax trees.


June 19: The Refactoring Harvest & Clean Compilation

By June 19, the architecture transitioned into its polishing phase. This phase focused entirely on dry, mechanical optimizations to turn the prototype code into highly reusable core primitives.

Low-Level Consolidation

Added more refactory by refactoring utility factory with reusable read encoded function

This commit directly underscores the creation of the Shared Backbone Layer. Instead of having disparate I/O handling scattered across the TCP chat server, the custom Git client, and the HTTP engine, a centralized, reusable binary/text encoding factory was abstracted out.

Refactoring MD Parser -> Added Enum to MD parser

The line-by-line Markdown parsing logic was further hardened by replacing brittle string matchers with type-safe Enums. This ensures that the token-splitting logic executes with deterministic state changes during compilation streams.

Final Housekeeping

The sprint closed out with essential housecleaning: purging structural debris (Removed useless files), ensuring compiled output didn’t pollute the version history (Ignoring html generated by Jekyll), and dynamically updating the live engineering index to reflect the newly minted updates.


The Takeaway

Systems engineering from first principles isn’t clean on day one. It requires the willingness to write raw code, look at it critically, introduce a design pattern, change your mind, and rip it out for something more performant.

The codebase has evolved from an ambitious roadmap into a tightly packed ecosystem of deterministic, highly optimized primitives.

🏠 Documentation Hub 📝 Engineering Blog 💻 GitHub Repository