{
  "id": 5730070,
  "title": "I Built a Database in Rust With Zero Dependencies (and What the Standard Library Quietly Gave Me)",
  "url": "https://urgent.news/2026/09/05/i-built-a-database-in-rust-with-zero-dependencies-and-what-the",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-05T06:11:16.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sanjaysah/i-built-a-database-in-rust-with-zero-dependencies-and-what-the-standard-library-quietly-gave-me-3n49"
  },
  "original_language": "en",
  "account": "The story describes a Rust developer who built a tiny database called zdb for a hackathon with the rule of using no third-party packages. The database is a simple key-value store that saves data to disk and survives crashes. The developer wrote the entire engine by hand in one Rust file, with an empty dependency list.\n\nTo save data, the developer decided on a byte layout consisting of a checksum, key length, value length, key, and value. Rust's standard library includes functions to convert numbers to and from bytes. Writing and loading data only required a dozen lines of code, without relying on serialization libraries.\n\nThe developer also implemented a checksum to detect data corruption. CRC-32, a simple algorithm, was used to calculate a small number from the data. The checksum was saved alongside the data, and if the recomputed checksum didn't match the saved one, it indicated corruption. The developer verified that their 15-line implementation matched the internationally-known result for a given input.\n\nTo prevent multiple instances of the database from writing to the same file simultaneously, the developer used a lock file. By checking if a file named \"LOCK\" existed and creating it if it didn't, they ensured only one instance of the database could run at a time. The lock file was deleted when the program exited cleanly.\n\nFor handling command-line options, the developer used Rust's standard library to read the user's input and matched it against a few commands (put, get, del, list). A simple loop and match statement were used instead of a specialized library like clap.\n\nFinally, the developer introduced a global \"run this once\" mechanism using Rust's standard library. This feature set up a value the first time it was accessed, and subsequent accesses would use the cached value. It was a straightforward implementation that eliminated the need for additional libraries like once_cell or lazy_static.",
  "summary": "TL;DR — I built a small database in Rust for a 72-hour hackathon with one rule: no third-party packages allowed. Just the language and nothing else. Here's what I had to write by hand, in plain English, and the surprisingly capable standard-library features that made it possible. Full source and a 5-minute video at the bottom. First, what's a \"dependency\" — and why does anyone care? When you…",
  "key_points": [
    "Developer built zdb, a key-value database in Rust with zero dependencies",
    "Implemented checksum (CRC-32) to detect data corruption",
    "Used Rust's standard library for lock files and command-line options"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}