How to Build a Rust CLI with Built-In Data Persistence
If you’ve ever built a CLI tool in Rust, you know the usual setup: parse commands with Clap, write logic for each subcommand, and then figure out how to store data—maybe with SQLite, maybe with JSON files.
The Deeb CLI Starter streamlines that process by giving you a ready-to-use CLI template with data persistence baked in from the start.
Why This Starter Exists
When starting a CLI project, wiring up data storage often feels like unnecessary busywork—especially for quick tools or prototypes.
This starter repo handles that for you by pairing:
- Clap → for intuitive command parsing
- Deeb → for lightweight, fast, and developer-friendly data persistence
With it, you can focus on your commands and business logic, not on boilerplate setup.
Getting Started
- Clone the repo:
- Copy the example environment file:
- Install dependencies and run the CLI:
- You should see the starter help screen:
Features Out of the Box
- Modular Command System
Easily extend or modify commands in the cli module. Clap handles parsing so you can focus on functionality.
- Built-In Persistence
Define a struct in the models module and store it instantly using Deeb’s insert_one or retrieve with find_many.
Like Deeb? Star the repo to support the direction Deeb is going - or - Check out the Docs!
-
Environment-First Configuration
Environment variables are validated before runtime to avoid misconfiguration issues. -
Logging Included
The log crate is set up and ready for use, so you can start logging debug and info messages immediately.
Example Command: Todos
This starter includes a simple todo command for managing a persistent list of tasks.
The data is automatically persisted by Deeb—no database setup required.
Perfect For
- Rapid CLI prototyping
- Internal tooling
- Learning Rust with real-world persistence
- Any small-to-medium CLI project that needs storage
Repo Link: Deeb CLI Starter
Last updated on
August 8, 2025
.png)
