I Built a Remote MCP Server with Auto OAuth — Here's How the Auth Magic Works
Posted on June 19, 2026
For Week 3 of themodernsoftware.dev, I built a remote HTTP MCP server exposing weather tools via GitHub OAuth 2.1 + PKCE. The interesting part: Claude's CLI handles the entire auth dance automatically — no manual token copying, no browser hacks. Here's how it actually works under the hood.
[Read More]
Building circle-db — Phase 9: Time-travel + Graph Traversal
The data model already encoded history and the graph. This phase just reads what was always there.
Posted on June 8, 2026
Two Capabilities, Zero New Data Structures
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 8: Query Execution
AND semantics across where-clauses is just set intersection — no cartesian product, no nested loop join.
Posted on June 8, 2026
What Does a Query Look Like?
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 7: Query Planning
Every where-clause encodes a 'what I know vs. what I want' structure, and the indexes exist precisely to exploit it.
Posted on June 5, 2026
Choosing the Right Card Catalog
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 6: Transactions & Layered History
Immutability makes 'what-if' free — no rollback, no savepoints, just values.
Posted on June 4, 2026
Atomic Writes, Layered History
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 5: CRUD Write Path
Every write must update storage and all four indexes atomically — not just the data, but every path into the data.
Posted on June 4, 2026
A History Book That Can Never Be Erased
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 4: Full 4-Index System
Every fact is stored four times — once per index. The key ordering is a direct statement about which queries it serves.
Posted on June 2, 2026
The Same Books, Sorted Four Ways
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 3: EAVT Index
The structure of an index directly encodes which queries are fast and which are slow.
Posted on June 2, 2026
The Phone Book Problem
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 2: In-Memory Storage
Storage is deliberately dumb — it has one job, and that's all it needs.
Posted on June 2, 2026
The Shelf and the Card Catalog
[Read More]
Tags:
database, clojure, python, learning
Building circle-db — Phase 1: Core Data Model (EAV)
The data model doesn't just describe current state — it encodes the entire history of every fact, for free.
Posted on June 2, 2026
Most databases you’ve used store data in rows. A users table has columns — id, name, email — and each row is one user. It feels natural because it mirrors a spreadsheet. But this model has a hidden assumption baked in: you have to decide your schema upfront. Add a...
[Read More]
Tags:
database, clojure, python, learning
Building a Computer from Scratch — Part 18: Putting It All Together
Posted on May 28, 2026
The three pieces that turn Go packages into a running simulator: a program generator that writes assembly from code, a bug that only appeared end-to-end, and a three-goroutine simulator that drives everything.
[Read More]
Building a Computer from Scratch — Part 17: The Assembler
Posted on May 27, 2026
After 16 phases of hardware, the computer can run programs — but only if you write them in raw binary. This final part adds an assembler that translates human-readable instructions into the binary the CPU executes, then runs the whole thing.
[Read More]
Building a Computer from Scratch — Part 16: The Complete Computer
Posted on May 26, 2026
Connecting CPU, RAM, keyboard, and display into a single runnable machine — with a memory map, a sentinel jump, and a clock loop.
[Read More]
Building a Computer from Scratch — Part 15: The CPU
Posted on May 24, 2026
Wiring nine registers, a stepper, an ALU, and a control unit into a fetch-decode-execute machine that runs one instruction every six clock steps.
[Read More]
Building a Computer from Scratch — Part 14: Display
Posted on May 23, 2026
Adding a 4,800-cell frame buffer with two independent address registers, a two-phase write protocol, and a 30fps scanner goroutine that never touches the CPU's bus.
[Read More]
Building a Computer from Scratch — Part 13: I/O Bus & Keyboard
Posted on May 22, 2026
Adding a 4-wire I/O control bus to keep RAM silent during peripheral cycles, and a keyboard that detects its own address in pure gate logic and delivers keycodes across a two-phase handshake.
[Read More]
Building a Computer from Scratch — Part 12: Memory (64K RAM)
Posted on May 20, 2026
Building 65,536 cells in a 256×256 grid, selected by two 8-bit decoders, with a Memory Address Register that makes the two-phase read/write protocol possible.
[Read More]
Building a Computer from Scratch — Part 11: The ALU
Posted on May 19, 2026
Assembling eight parallel operation units behind a decoder-controlled gate, so a 3-bit opcode routes exactly one result onto the bus — with no branching in sight.
[Read More]
Building a Computer from Scratch — Part 10: The Stepper
Posted on May 17, 2026
Building a six-position shift register that gives the machine a shared sense of time.
[Read More]
Building a Computer from Scratch — Part 9: The Register
Posted on May 15, 2026
Combining storage and bus access into a single unit with two independent control wires.
[Read More]
Building a Computer from Scratch — Part 8: The Adder
Posted on May 14, 2026
Building a 16-bit ripple-carry adder from five gates per bit column.
[Read More]
Building a Computer from Scratch — Part 7: Decoders
Posted on May 12, 2026
One NOT per input, not one per gate — and how cascading two 4×16 decoders selects any one of 256 outputs without 8-input AND gates.
[Read More]
Building a Computer from Scratch — Part 6: Comparison & BusOne
Posted on May 11, 2026
Building the comparator that chains 16 bit-stages MSB-first, and BusOne — the gate that injects the constant 1 without an if-statement.
[Read More]
Building a Computer from Scratch — Part 5: Enabler & Bitwise Ops
Posted on May 9, 2026
Building the gate that silences a component on the shared bus, and discovering that a left shift is just rewiring — no logic required.
[Read More]
MIT 6.5840 Lab 4C: Snapshots — Two Paths, One Bridge
Posted on May 7, 2026
Lab 4C adds snapshots to the KV service so servers don't have to replay the entire log on every restart. The implementation is small, but the tricky parts are in the lock discipline and understanding what Raft already does for you.
[Read More]
Building a Computer from Scratch — Part 4: The Bus
Posted on May 7, 2026
Storage cells can hold values, but they can't talk to each other. This phase builds the shared channel that every component in the computer will use to pass data.
[Read More]
Building a Computer from Scratch — Part 3: Storage Primitives
Posted on May 5, 2026
Building the first component that can remember — a 4-NAND feedback loop that locks a bit in place, and why Go's zero values make it tricky.
[Read More]
Build DBDB from scratch — Part 14: Atomic, thread-safe updates
Posted on May 5, 2026
A fifty-thread benchmark test reveals a lost update problem. This post adds a pessimistic `DBDB.update()` to provide atomic read-modify-write, then debugs three concurrency bugs that only appear with threads: fcntl locks being per-process, Python's I/O buffer hiding external writes, and overlapping object IDs in tests. It finishes by implementing and...
[Read More]
I Tried to Build the Distributed Search Engine from My Own Blog Post. Here's What Happened.
Posted on May 5, 2026
A few months ago I wrote a system design post about how to build a 100-billion-page distributed search engine. Then I actually tried to build it on AWS. This is the honest account of where the theory held up, where it fell apart, and why I eventually stopped.
[Read More]
MIT 6.5840 Lab 4B: Building a Replicated KV Service on Top of Raft
Posted on May 4, 2026
Lab 4B looks simple on paper — just connect a KV store to Raft. But correctness in the face of network drops, leadership changes, and server crashes demands understanding exactly where each guarantee comes from. Most of the hard problems turn out to already be solved — if you build...
[Read More]
MIT 6.5840 Lab 4A: From Raft to Replicated State Machine — The Story of a Middle Layer
Posted on May 4, 2026
Raft guarantees that a command will be committed on a majority of servers. But "committed" isn't the same as "executed." Lab 4A is the journey of building the middle layer — the RSM — that turns Raft's promises into actual results returned to clients.
[Read More]
Build DBDB from scratch — Part 13: Adding a B-Tree
Posted on May 4, 2026
Binary trees are tall and thin, leading to many disk reads. B-trees are short and fat, promising faster queries. This post adds a B-tree implementation to DBDB, with nodes that hold multiple keys. It covers top-down splitting for insertion, and the three cases for deletion (borrow from left, borrow from...
[Read More]
Build DBDB from scratch — Part 12: Replacing BST with AVL
Posted on May 3, 2026
The benchmark was supposed to find a known limitation, but it found two other bugs first: an N+1 query problem and a recursion depth error from inserting sorted keys. Both were symptoms of the same core issue — a tree with no opinion about its own shape. This post replaces...
[Read More]
Building a Computer from Scratch — Part 2: Multi-Input Gates
Posted on May 3, 2026
Extending the gate layer to handle three, four, five, and eight inputs at once — and why the struct fields matter more than the truth table.
[Read More]
Build DBDB from scratch — Retrospective: What a database actually is
Posted on May 2, 2026
Eleven posts, six layers, one guarantee. This retrospective traces the design thread that ran from append-only storage through compaction — why each decision followed from the last, what each layer was actually hiding, and which small choices (lock() return value, rename-before-close, fstat vs stat, double check in _prepare_write) turned out...
[Read More]
Build DBDB from scratch — Part 10: What immutability costs
Posted on May 1, 2026
Append-only storage never reclaims space — every overwrite leaves orphaned bytes. Compaction fixes this by copying the live dataset to a fresh file and atomically swapping it in. The hard part is the TOCTOU race: a writer that checks for file replacement before acquiring the lock, but not after, can...
[Read More]
Building a Computer from Scratch — Part 1: Wires and Logic Gates
Posted on May 1, 2026
Every computer is built from wires and gates. This post starts from scratch — what is a wire, what is a gate, and why one small design decision here is what makes memory possible three phases later.
[Read More]
Build DBDB from scratch — Part 9: The last translation
Posted on April 30, 2026
`tool.py` is 62 lines that translate dict syntax into shell commands. Three decisions worth examining: why `finally` handles `close()` rather than each branch, why `set` auto-commits while the Python API doesn't, and why values go to stdout while errors go to stderr — the conventions that make a tool composable....
[Read More]
Build DBDB from scratch — Part 8: The thinnest layer
Posted on April 29, 2026
55 lines of facade code that hide an entire architecture. `DBDB.__init__` wires Storage into BinaryTree so the caller never sees either. The dictionary protocol, `_assert_not_closed`, `__contains__` via try/except, and an EAFP `connect()` that absorbs the new-vs-existing branch — thin by design.
[Read More]
Build DBDB from scratch — Part 7: Two lines that hold everything
Posted on April 28, 2026
`commit()` is two lines — a bottom-up cascade that writes every dirty node, then an 8-byte root pointer flip. This post wires `get`, `set`, `pop`, and `commit` into `LogicalBase`, closes the locking story from Part 6, and runs four tests that make the durability guarantee precise and verifiable.
[Read More]
Build DBDB from scratch — Part 6: The race between two writers
Posted on April 27, 2026
The OS lock queues writers correctly but doesn't tell them what they missed. Trace the two-writer race that silently drops commits, then see how `lock()` returning `True` vs `False` carries the semantic signal that triggers a root refresh — and how `storage.locked` bridges Storage and LogicalBase without coupling them.
[Read More]
Build DBDB from scratch — Interlude: One key's journey through all four layers
Posted on April 26, 2026
A full write-then-read trace for `apple -> red` across Storage, ValueRef, BinaryNode, and LogicalBase. See exactly when bytes hit disk, when refs stay lazy, and why the root-pointer flip is the atomic hinge between old and new database states.
[Read More]
Build DBDB from scratch — Part 4: The part that holds it all together
Posted on April 25, 2026
How `LogicalBase` manages lifecycle while `BinaryTree` owns algorithms: root refresh policy, `_follow` as the indirection boundary, immutable insert/delete path copying, in-order predecessor deletion, and why the storage contract stays duck-typed for clean tests.
[Read More]
Build DBDB from scratch — Part 3: A tree that never changes
Posted on April 24, 2026
How immutable binary search tree nodes, copy-on-write path updates, and address-only node serialization give DBDB atomic reads with minimal locking. Includes `from_node` length deltas, post-order persistence, and lazy child loading through `BinaryNodeRef`.
[Read More]
Build DBDB from scratch — Part 2: The lazy pointer — loading only what you need
Posted on April 23, 2026
Why `ValueRef` separates “where on disk” from “what’s in RAM”: lazy `get()`, idempotent `store()`, `prepare_to_store` for subclasses, UTF-8 vs Python 3 strings, and `BytesValueRef` for pickled nodes without touching the inherited load/save logic.
[Read More]
Build DBDB from scratch — Part 1: What happens when the power goes out?
Posted on April 22, 2026
Append-only records, a 4096-byte superblock, big-endian length prefixes, flush vs fsync ordering for durable commits, advisory file locks with portalocker, and why DBDB trades disk space for a simple atomic story.
[Read More]
Build DBDB from scratch — Part 0: Before writing a single line of database logic
Posted on April 21, 2026
Why the first commit was a smoke test, not storage code. Setting up pyproject.toml (PEP 621), pytest with pythonpath, pytest-bdd Gherkin smoke, conftest plugin loading, and a tiny Makefile so every clone gets a green test loop from day one.
[Read More]
Build your own X: A minimal AI app builder — Part 10: WebContainer — running a Vite dev server in the browser tab
Posted on April 18, 2026
WebContainer boots a full Node.js environment in the browser using WebAssembly and SharedArrayBuffer. SharedArrayBuffer requires cross-origin isolation—but you cannot apply that globally without breaking third-party scripts. This part scopes the isolation headers to /project/* only, boots one WebContainer per tab, converts FileEntry rows into a nested mount tree, and runs...
[Read More]
Build your own X: A minimal AI app builder — Part 9: Rendering code that is still being written, and seeing what you sent the model
Posted on April 17, 2026
While the model is streaming, a fenced code block is open—there is no closing fence yet. Your renderer must handle that state without crashing or showing raw backticks. This part builds the segment scanner with a closed:false state, the collapsible CodeMirror card, and the context strip that shows exactly how...
[Read More]
Build your own X: A minimal AI app builder — Part 8: The sync problem — drafts, the 250 ms race, and "Updated" badges that do not lie
Posted on April 16, 2026
Three things write to the same file simultaneously: the user types a draft, the AI applies changes via a background transaction, and router.refresh() reloads server props. Without a merge policy, the user loses their draft every time the AI edits. This part builds the algorithm that keeps all three in...
[Read More]
Lab 3D khóa MIT 6.5840: Xây dựng thuật toán đồng thuận Raft - Phần 4: Log Compaction và Snapshot
Posted on April 15, 2026
Bài viết thứ sáu trong chuỗi bài về hệ thống phân tán qua các bài lab của khóa học MIT 6.5840. Phần này trình bày cách triển khai log compaction trong Raft — cắt ngắn log bằng snapshot để tránh log tăng trưởng vô hạn — và phân tích một...
[Read More]
MIT 6.5840 Lab 3D: Building Raft Consensus — Part 4: Log Compaction and Snapshots
Posted on April 15, 2026
The sixth post in the MIT 6.5840 distributed systems series. This post covers log compaction in Raft — trimming the log via snapshots to prevent unbounded growth — and a deep dive into the most counterintuitive design pitfall in Lab 3D: why clamping nextIndex destroys the entire InstallSnapshot mechanism.
[Read More]
Build your own X: A minimal AI app builder — Part 7: File tree UI, REST API with shared validation, and CodeMirror without SSR
Posted on April 15, 2026
The workbench needs three things: a file tree loaded from the database, a REST API to save/delete/rename with the same path rules as the parser, and a CodeMirror editor that cannot load during server-side rendering. Each reveals a different facet of building a database-backed IDE panel in Next.js.
[Read More]
Build your own X: A minimal AI app builder — Part 6: Context engineering — what the model knows when it edits
Posted on April 14, 2026
Without context, the model edits blind. On turn two it might rewrite a file it has never seen. This part builds the workspace snapshot: a selection algorithm that picks spine files first, fills remaining budget with the most recently edited files, and truncates gracefully—then records exactly what was sent so...
[Read More]
Lab 3C khóa MIT 6.5840: Xây dựng thuật toán đồng thuận Raft - Phần 3: Persistence và các lỗi ẩn dưới mạng nhiễu
Posted on April 13, 2026
Bài viết thứ năm trong chuỗi bài về hệ thống phân tán qua các bài lab của khóa học MIT 6.5840. Phần này trình bày cách triển khai persistence trong Raft — đảm bảo server không mất trạng thái khi crash — và phân tích hai lỗi an toàn tinh...
[Read More]
MIT 6.5840 Lab 3C: Building Raft Consensus — Part 3: Persistence and Hidden Bugs Under Network Chaos
Posted on April 13, 2026
The fifth post in the MIT 6.5840 distributed systems series. This post covers persistence in Raft — ensuring servers survive crashes without losing critical state — and a deep dive into two subtle safety bugs that only surface under an unreliable, high-reordering network.
[Read More]
Build your own X: A minimal AI app builder — Part 5: Parsing LLM output into database rows, safely
Posted on April 13, 2026
The model can output anything. Your parser must handle repeated paths (last wins), path traversal attempts (reject silently), unclosed fences (discard), and parse failures that must not roll back an already-saved message. This post builds the full parse → normalize → upsert pipeline with intentional two-layer error isolation.
[Read More]
Build your own X: A minimal AI app builder — Part 4: Streaming end to end — SSE, tee(), and concurrent persistence
Posted on April 12, 2026
You need two consumers of the same HTTP response stream: one for the browser so text appears token by token, one for the server so the full reply gets saved. ReadableStream.tee() splits one stream into two without buffering the whole thing. This post builds POST /api/chat around that trick plus...
[Read More]
Build your own X: A minimal AI app builder — Part 3: The LLM contract — system prompt, Message model, and history trimming
Posted on April 11, 2026
The system prompt is not documentation—it is the schema that your parser reads. This post builds the Message table, validates POST bodies so you never trust the client for chat history, designs the file fence contract, and trims long histories before they overflow the context window.
[Read More]
Build your own X: A minimal AI app builder — Part 2: Files as source of truth, atomic project creation, and template seeding
Posted on April 10, 2026
Every feature in this app—the AI context, the workbench, the preview—reads from the same FileEntry table in SQLite. This post explains why that single-source design matters, how to seed a full Vite + React template atomically in one transaction, and one bundler gotcha that silently breaks Prisma interactive transactions.
[Read More]
Build your own X: A minimal AI app builder — Part 1: What you are really building (and why the obvious approach breaks)
Posted on April 9, 2026
Before you write a line of code, you need to understand the four non-trivial problems hiding inside "chat → edit files → preview". This post maps the full architecture, explains where naive implementations fail, and gets the Next.js + Prisma skeleton running so you have something to build on.
[Read More]
Hệ thống mạng giả lập trong MIT 6.5840: Xây dựng labrpc từ đầu
Posted on April 7, 2026
Bài viết này phân tích hệ thống mạng giả lập (labrpc) được dùng để kiểm thử Raft trong MIT 6.5840. Thay vì socket TCP thật, hệ thống sử dụng Go channel để mô phỏng mạng, hỗ trợ giả lập mất gói tin, trễ, và phân vùng mạng — tất cả...
[Read More]
MIT 6.5840 Simulated Network: Building labrpc from Scratch
Posted on April 7, 2026
This post walks through the simulated network stack (labrpc) used to test Raft in MIT 6.5840. Instead of real TCP sockets, it uses Go channels to emulate the network—with packet loss, delay, and partitions—all inside a single process.
[Read More]
Lab 3B khóa MIT 6.5840: Xây dựng thuật toán đồng thuận Raft - Phần 2: Sao chép Log
Posted on April 7, 2026
Bài viết thứ tư trong chuỗi bài về hệ thống phân tán qua các bài lab của khóa học MIT 6.5840. Phần này trình bày cách triển khai cơ chế sao chép log trong thuật toán Raft — bước chuyển từ "chọn được leader" sang "đồng thuận thực sự về...
[Read More]
MIT 6.5840 Lab 3B: Building Raft Consensus — Part 2: Log Replication
Posted on April 7, 2026
The fourth post in the MIT 6.5840 distributed systems series. This post covers the implementation of log replication in Raft — the step that transforms "we elected a leader" into "we genuinely agree on a sequence of commands."
[Read More]
Lab 3A khóa MIT 6.5840: Xây dựng thuật toán đồng thuận Raft - Phần 1: Bầu cử Leader
Posted on April 6, 2026
Bài viết thứ ba trong chuỗi bài về hệ thống phân tán qua các bài lab của khóa học MIT 6.5840. Phần này trình bày cách triển khai cơ chế bầu cử leader trong thuật toán Raft — nền tảng cho một hệ thống phân tán có khả năng chịu...
[Read More]
MIT 6.5840 Lab 3A: Building the Raft Consensus Algorithm - Part 1: Leader Election
Posted on April 6, 2026
The third post in a series on distributed systems through the MIT 6.5840 labs. This post walks through implementing Raft's leader election mechanism — the foundation of a fault-tolerant distributed system.
[Read More]
System Design: Consistent Hashing — The Technique That Makes Distributed Systems Not Fall Apart
Posted on April 6, 2026
When you add or remove a server in a distributed cache, traditional hashing forces nearly every key to move to a different server — causing cache storms and cascading failures. Consistent hashing solves this elegantly. Here's how it works, and how it powers DynamoDB, Cassandra, Akamai, and Google's own load...
[Read More]
System Design: Designing a Rate Limiter
Posted on March 31, 2026
Rate limiting is one of those problems that sounds simple until you try to build it at scale. Five algorithms, each with real trade-offs. Distributed challenges like race conditions and sync. Here's how to think through all of it.
[Read More]
System Design: Payment Gateway & Payment System Architecture
Posted on March 9, 2026
How to design a payment backend for e-commerce: pay-in and pay-out, using a payment provider (PSP), double-entry bookkeeping, hosted payment pages, and how to avoid double charges when things fail or users click Pay twice.
[Read More]
System Design: Real-Time Leaderboard for Millions of Users
Posted on January 29, 2026
A comprehensive guide to designing a real-time gaming leaderboard: from clarifying requirements and back-of-the-envelope estimation to Redis Sorted Sets, a seven-step event-driven pipeline (Kafka, throttle, checksum, WebSocket), scaling with sharding, tie-breaking, and recovery.
[Read More]
System Design: Hotel Booking System Architecture - A Comprehensive Guide
Posted on January 28, 2026
Designing a scalable hotel booking system at scale. Learn about inventory management, concurrency control, distributed transactions, and how to handle hundreds of thousands of bookings per day with data integrity and fault tolerance.
[Read More]
System Design: Ad Click Event Aggregation System - A Comprehensive Guide
Posted on January 15, 2026
Designing an ad click event aggregation system at Facebook or Google scale. Learn about real-time bidding, stream processing, exactly-once semantics, and how to handle billions of clicks per day with proper fault tolerance and data accuracy.
[Read More]
System Design: Building a Scalable Cloud File Storage Service
Posted on January 9, 2026
How do services like Dropbox and Google Drive store petabytes of data while keeping files synchronized across millions of devices in real-time? In this comprehensive deep dive, I explore the architecture behind a scalable cloud file storage service, covering chunking strategies, synchronization mechanisms, and database scaling techniques.
[Read More]
System Design: Building a Scalable Real-Time Chat Application
Posted on January 5, 2026
Ever wondered how messaging apps like WhatsApp or Telegram handle billions of messages daily while maintaining instant delivery and end-to-end encryption? In this deep dive, I explore the architecture behind a scalable real-time chat application, covering everything from WebSocket connections to message routing and E2EE security.
[Read More]
System Design: A Scalable Architecture for a Music Streaming Service (Spotify-like)
Posted on January 2, 2026
How do music streaming services like Spotify handle millions of users streaming billions of songs? In this comprehensive system design deep dive, we'll explore scalable architecture, capacity planning, data storage strategies, and the technologies that power modern music platforms.
[Read More]
System Design: A Scalable Architecture for a Modern Ride-Sharing Platform
Posted on December 30, 2025
Ever wondered how ride-sharing platforms like Uber handle millions of users, match riders with drivers in seconds, and track locations in real-time? In this deep dive, we'll explore a scalable architecture built with microservices, event-driven communication, and cutting-edge technologies like H3 geospatial indexing.
[Read More]
System Design: Building a Scalable Distributed Web Search Engine
Posted on December 23, 2025
Explore the architecture behind a web-scale search engine capable of indexing 100 billion pages. Learn about distributed crawlers, URL frontiers, inverted indexes, sharded databases, and the fascinating engineering challenges of building a system that handles petabytes of data and millions of queries per second.
[Read More]
System Design: How Would You Build YouTube? A Beginner's Guide
Posted on December 19, 2025
Continuing our system design series, we dive into building a YouTube-like video platform. Learn about object storage, asynchronous processing, CDNs, video chunking, and how YouTube's architecture evolved from a simple MySQL setup to a globally distributed system handling billions of daily views.
[Read More]
System Design: Understanding Twitter's Architecture - A Deep Dive
Posted on December 15, 2025
After a long break, I'm back! In this first blog post about system design interview preparation, I explore the high-level architecture of a Twitter-like social network. Learn about load balancers, caching strategies, database sharding, and the fascinating trade-offs engineers make to handle billions of reads daily.
[Read More]
Rewriting a JavaScript Classic in React: A Learning Journey
Posted on August 17, 2025
This post documents the journey of rewriting the 'Blockcode' visual programming toolkit from the book *500 Lines or Less* in React. Follow along to see how a classic JavaScript project was modernized using a component-based architecture, React hooks for state management, and an interactive drag-and-drop interface.
[Read More]
Lab 2 khóa MIT 6.5840: Xây dựng Key/Value Store và Distributed Lock với tính nhất quán tuyến tính
Posted on July 20, 2025
Bài viết thứ hai trong chuỗi bài về hệ thống phân tán qua các bài lab của khóa học MIT 6.5840. Bài viết này trình bày cách xây dựng một máy chủ key/value đơn node với tính nhất quán tuyến tính (linearizability ) và sau đó sử dụng nó để...
[Read More]
MIT 6.5840 Lab 2: Key/Value Server and Distributed Lock with Linearizability
Posted on July 20, 2025
The second post in a series on distributed systems through the MIT 6.5840 labs. This post covers building a single-node key/value server with linearizability, then using it to implement a distributed lock.
[Read More]
Lab 1 khóa MIT 6.5840: Xây dựng framework MapReduce từ đầu
Posted on July 3, 2025
Bài viết đầu tiên trong chuỗi bài về hệ thống phân tán qua các bài lab của khóa học MIT 6.5840. Bài viết này trình bày cách triển khai MapReduce bằng Go, một mô hình lập trình phổ biến để xử lý dữ liệu lớn song song.
[Read More]
MIT 6.5840 Lab 1: Building a MapReduce Framework from Scratch
Posted on July 3, 2025
The first post in a series on distributed systems through the MIT 6.5840 labs. This post walks through implementing MapReduce in Go — a popular programming model for large-scale parallel data processing.
[Read More]
Build your own X: Xây dựng ORM framework với Go - Phần 7
Posted on June 17, 2025
Phần cuối trong chuỗi bài xây dựng ORM framework với Go. Bài viết trình bày cách tự động cập nhật cấu trúc bảng database khi struct thay đổi, thông qua tính năng Migrate — hỗ trợ thêm và xóa field mà không cần viết thủ công câu lệnh SQL.
[Read More]
Build your own X: Xây dựng ORM framework với Go - Phần 6
Posted on June 14, 2025
Phần 6 trong chuỗi bài về xây dựng ORM framework với Go. Trong bài này, ta sẽ tìm hiểu về transaction trong database, tính chất ACID, cách sử dụng trong Go, và cách tích hợp vào GeeORM để đảm bảo các thao tác an toàn và có thể rollback.
[Read More]
Build your own X: Xây dựng ORM framework với Go - Phần 5
Posted on June 11, 2025
Phần 5 trong chuỗi bài về xây dựng ORM framework với Go. Trong bài này, ta sẽ triển khai cơ chế Hook — cho phép chèn logic trước/sau khi thực hiện các thao tác CRUD như truy vấn, thêm, sửa, xóa.
[Read More]
Build your own X: Xây dựng ORM framework với Go - Phần 4
Posted on June 9, 2025
Phần 4 trong chuỗi bài về xây dựng ORM framework với Go. Trong bài này, ta sẽ triển khai các tính năng như cập nhật, xóa, đếm bản ghi và hỗ trợ gọi chuỗi (chain call) để viết truy vấn gọn gàng hơn.
[Read More]
Build your own X: Xây dựng ORM framework với Go - Phần 3
Posted on June 6, 2025
Phần 3 trong chuỗi bài về xây dựng ORM framework với Go. Bài viết hướng dẫn cách triển khai các chức năng thêm và truy vấn bản ghi, sử dụng reflection để chuyển đổi giữa đối tượng và dữ liệu trong cơ sở dữ liệu.
[Read More]
Build your own X: Xây dựng ORM framework với Go - Phần 2
Posted on June 3, 2025
Phần 2 trong chuỗi bài về xây dựng ORM framework với Go. Bài viết hướng dẫn cách tạo lớp Dialect để hỗ trợ nhiều loại cơ sở dữ liệu, sử dụng reflection để chuyển đổi struct thành bảng, và triển khai các thao tác quản lý bảng dữ liệu.
[Read More]
Build your own X: Tự xây dựng một ORM framework với Go - Phần 1
Posted on June 2, 2025
Phần 1 trong chuỗi bài về xây dựng ORM framework với Go. Bài viết này tập trung vào việc tìm hiểu cơ bản về SQLite, sử dụng thư viện database/sql của Go và xây dựng cấu trúc cơ bản cho framework ORM.
[Read More]
Build your own X: Tự xây dựng một ORM framework với Go - Giới thiệu
Posted on May 28, 2025
Giới thiệu về chuỗi bài viết mới: Xây dựng một ORM framework từ đầu bằng Go. Tìm hiểu cách ánh xạ đối tượng vào cơ sở dữ liệu quan hệ và triển khai các tính năng như tạo bảng, truy vấn, cập nhật, hooks và transaction.
[Read More]
Build your own X: Tự xây dựng một web framework với Go - Phần 7
Posted on May 26, 2025
Bài cuối cùng trong chuỗi bài về xây dựng web framework với Go. Tìm hiểu cách triển khai cơ chế xử lý lỗi (error handling) để ngăn chặn ứng dụng bị crash khi xảy ra panic. Hoàn thiện framework Gee với khả năng phục hồi từ lỗi và cung cấp...
[Read More]
Build your own X: Tự xây dựng web framework với Go - Phần 6
Posted on May 23, 2025
Phần 6 trong chuỗi bài về xây dựng web framework với Go. Bài viết này tập trung vào việc hỗ trợ phục vụ tài nguyên tĩnh và render template HTML - hai tính năng quan trọng cho phát triển web server-side.
[Read More]
Build your own X: Tự xây dựng web framework với Go - Phần 5
Posted on May 22, 2025
Phần 5 trong chuỗi bài về xây dựng web framework với Go. Bài viết này tập trung vào việc thiết kế và triển khai cơ chế middleware - thành phần quan trọng giúp mở rộng chức năng framework mà không cần sửa đổi mã nguồn gốc.
[Read More]
Build your own X: Tự xây dựng một web framework với Go - Phần 4
Posted on May 19, 2025
Phần 4 trong chuỗi bài về xây dựng web framework với Go. Trong bài này, chúng ta sẽ triển khai Route Group Control - một tính năng quan trọng giúp nhóm các route lại với nhau, hỗ trợ nhóm lồng nhau và tạo nền tảng cho việc áp dụng middleware....
[Read More]
Build your own X: Tự xây dựng một web framework với Go - Phần 3
Posted on May 13, 2025
Phần 3 trong chuỗi bài về xây dựng web framework với Go. Trong bài này, chúng ta sẽ học cách triển khai định tuyến động (dynamic routing) bằng cây tiền tố (Trie tree) thay vì sử dụng map như trước đây.
[Read More]
Build your own X: Tự xây dựng một web framework với Go - Phần 2
Posted on May 9, 2025
Phần 2 trong chuỗi bài về xây dựng web framework với Go. Tìm hiểu về thiết kế Context để đóng gói thông tin request/response, cung cấp các phương thức tiện ích để trả về dữ liệu dạng HTML, JSON, và tổ chức lại cấu trúc code để dễ mở rộng....
[Read More]
Build your own X: Tự xây dựng một web framework với Go - Phần 1
Posted on May 1, 2025
Bài đầu tiên trong chuỗi bài về việc xây dựng web framework với Go. Tìm hiểu về thư viện net/http, interface http.Handler và cách tạo một router đơn giản để xử lý các HTTP request. Bắt đầu hành trình tạo ra framework Gee từ những khái niệm cơ bản nhất....
[Read More]
Build your own X: Tự xây dựng một web framework với Go - Giới thiệu
Posted on April 25, 2025
Giới thiệu chuỗi bài viết về cách xây dựng một web framework bằng Go, nhằm giúp bạn hiểu sâu hơn về cách hoạt động của một web framework – từ net/http cơ bản đến router, middleware và nhiều chức năng quan trọng khác của một web framework.
[Read More]