๐ Librius
Librius โ A fast, minimalist CLI to manage your personal book collection, built in Rust.
๐งพ Overview
Librius is a cross-platform command-line tool written in Rust that helps you manage your personal library.
It uses a SQLite database to store your books and a simple YAML configuration file
(librius.conf) for flexible setup.
This project aims to provide a clean, modular architecture with future extensions such as search, add/remove commands, and import/export support.
โจ New in v0.2.5
-
Backup command (
librius backup)- Creates plain
.sqlitebackups in thebackups/directory - Optional
--compressflag for compressed backups.zipformat on Windows.tar.gzformat on macOS and Linux
- Localized help and messages via i18n (English and Italian)
- Timestamp-based file naming for safe sequential backups
- Creates plain
-
Export command (
librius export)- Added support for exporting library data in multiple formats:
--csv(default): plain text export with semicolon delimiter--json: structured JSON array output--xlsx: formatted Excel file using umya-spreadsheet
- Localized CLI help and status messages (English/Italian)
- Automatic export directory and timestamped filenames
- Uses
dirscrate for cross-platform export path handling
- Added support for exporting library data in multiple formats:
-
Import command (
librius import)- Supports importing book data from external sources
- Available formats:
--csv(default): semicolon-delimited CSV--json: JSON array of objects
- Unified parsing via
serdeand sharedBookRecordstruct - Duplicate detection through unique index on
isbn - Uses
INSERT OR IGNOREfor idempotent imports (no duplication) - Verbose mode logs skipped records (e.g., โSkipped duplicate ISBN: โฆโ)
- Non-blocking import completion logging
๐ฆ Installation
๐ง AUR (Arch Linux)
# or
๐บ Homebrew (macOS/Linux)
๐ฆ Crates.io (Rust)
โ๏ธ Features
| Status | Feature | Description |
|---|---|---|
| โ | List | Display all books stored in the local database |
| โ | Config management | Manage YAML config via config --print, --init, --edit, and --editor |
| โ | Backup | Create plain or compressed database backups (.sqlite, .zip, .tar.gz) |
| โ | Export | Export data in CSV, JSON, or XLSX format |
| โ | Import | Import data from CSV or JSON files (duplicate-safe via ISBN) |
| โ | Database migrations | Automatic schema upgrades at startup |
| โ | Logging system | Records operations and migrations in log table |
| โ | Verbose mode | Optional --verbose flag for detailed debug output |
| โ | Safe patch system | Each migration is idempotent and logged for traceability |
| โ | Multilanguage (i18n) | Localized CLI (commands, help); embedded JSON; --lang + YAML language |
| ๐ง | Add / Remove | Add or delete books via CLI commands |
| ๐ง | Search | Search by title, author, or ISBN |
| ๐ง | Export / Import | Export and import data (JSON, CSV) |
๐ Multilanguage support (i18n)
Librius now supports a multilingual interface.
| Source | Description |
|---|---|
| ๐ฌ๐ง en.json | Default English messages |
| ๐ฎ๐น it.json | Italian translation |
| ๐ README.md | Located in src/i18n/locales/, describes key naming conventions |
How it works
- On startup, Librius loads the language defined in:
- CLI argument --lang / -l
- Configuration file language:
- Fallback to English (en)
- All user-visible messages (print_info, print_err, etc.) are translated dynamically.
- Missing keys automatically fall back to their key name or English equivalent.
Example usage
# Default (English)
# Force Italian interface
Example config (librius.conf)
# librius.conf
database: "C:/Users/YourName/AppData/Roaming/librius/librius.sqlite"
language: "it" # Set default language to Italian
๐งฉ Translations
All translations are stored in:
Each .json file contains keyโvalue pairs like:
Variables can be inserted at runtime:
tr_with;
๐งพ Changelog reference
See CHANGELOG.md for a detailed list of changes and updates.
๐ค Export & ๐ฅ Import
Librius now supports full data import/export functionality.
Export
You can export your library to multiple formats:
Exports are automatically saved in your user data directory
(e.g. ~/.config/librius/exports or %APPDATA%\librius\exports).
Import
Import books from CSV or JSON files:
Features:
- Automatic detection of duplicate records via unique
isbn - Skips duplicates gracefully (no interruption)
- Transaction-safe import
- Verbose mode logs skipped ISBNs
Example output:
๐ Quick start
1๏ธโฃ Clone the repository
2๏ธโฃ Build and run
If this is the first launch, Librius will automatically create:
- The config file at
~/.config/librius/librius.conf - A SQLite database at
~/.config/librius/librius.sqlite
๐งฉ Example output
$ librius list
๐ Your Library
- The Hobbit (J.R.R. Tolkien) [1937]
- Foundation (Isaac Asimov) [1951]
- Dune (Frank Herbert) [1965]
โ๏ธ Configuration
# librius.conf
database: "C:/Users/YourName/AppData/Roaming/librius/librius.sqlite"
language: "en"
- Configuration file is automatically migrated if fields are missing or renamed.
- Default path:
- macOS/Linux โ $HOME/.librius/librius.conf
- Windows โ %APPDATA%\Roaming\librius\librius.conf
๐ Documentation
The API and user-facing documentation for Librius is available on docs.rs:
- Online: https://docs.rs/librius
To generate and view the documentation locally run:
This will build the documentation and open it in your default browser.
๐งฐ Dependencies
- clap โ Command-line argument parsing
- rusqlite โ SQLite database integration
- serde / serde_json โ Serialization/deserialization
- serde_yaml โ YAML config parsing
- umya-spreadsheet โ XLSX file creation
- csv โ CSV import/export
- colored โ Colored terminal output
- chrono โ Date and time utilities
๐๏ธ Database management
Librius automatically verifies and upgrades the SQLite database schema at startup.
The latest migration adds a unique index on isbn to guarantee
that duplicate imports are ignored safely.
(isbn);
- On first launch โ creates books table.
- On subsequent launches โ runs pending migrations silently.
- Migration results are recorded in the log table.
Each migration patch (PATCH_001, PATCH_002, โฆ) is applied once and recorded in the internal log table.
The process is fully idempotent โ no duplicate operations are ever performed.
๐ Applying database patch: PATCH_002
โ
All pending migrations applied.
โ
Database schema is up-to-date.
Example table log
| id | date | operation | target | message |
|---|---|---|---|---|
| 1 | 2025-10-13T21:45:12+02:00 | DB_CREATED | DB | Created new database |
| 2 | 2025-10-13T21:45:13+02:00 | DB_MIGRATION_OK | DB | Schema updated successfully |
๐ Verbose mode
Run Librius in diagnostic mode to display all internal initialization steps:
Output example:
In normal mode, only command output is displayed.
๐งช Development
Run in debug mode
Run with logging (future)
RUST_LOG=debug
Format and lint
๐งฑ Future roadmap
- Add
add,remove, andsearchcommands - Export/import JSON and CSV
- Add optional TUI (Text UI) with
ratatui - Web dashboard sync
๐งโ๐ป Author
Umpire274 GitHub: @umpire274
๐ License
This project is licensed under the MIT License โ see the LICENSE
โญ Contribute
Contributions, feature requests, and ideas are welcome! If youโd like to contribute, please open a pull request or start a discussion.
๐งก Support
If you enjoy this project, please โญ star the repository โ it helps visibility and development motivation!