8 The Database as an Architectural Pillar: Choosing Between Strict Order and Massive Scale
This chapter covers
- Ending the “Feud" between SQL and NoSQL.
- The "Third Pillar" of modern data: Vector Databases for AI.
- Balancing the purity of Normalization with the speed of Denormalization.
- Protecting your data from "Little Bobby Tables" (SQL Injection).
8.1 Introduction
In Chapter 7, we learned how to move data around the world using Events. We built a sophisticated pipeline to ship information from the Order Service to the Shipping Service. But eventually, that data has to stop moving. It has to sit down, take off its shoes, and live somewhere. Kind of like you after a long day of coding. You want to sit down, crack open a nice cold beer, and relax while watching your favorite show.
You may need a nice comfy couch or oversized recliner, but your data needs a database.
For Junior Developers, the database is often an afterthought, a magic bucket where you dump data and hope to find it later. For Clarity Engineers, the database is the Architectural Pillar. If you choose the wrong one or design your schema poorly, no amount of clean code in your Controller will save you.