Directories & Files
This file describes the directory and file structure for the Personal Ledger project. It utilies Cargo workspaces with multiple reusable crates (libraries) and multiple binaries that combine in different ways to compile and build the different binaries and functionality.
Libraries
The Personal Ledger project is made up of the following libraries:
- Configuration: This library crate holds the configuration defaults, file parsing and logic.
- Database: This library crate contains the database abstraction layer.
- Domain: This library crate contains the business logic and type definitions. Including application error and result. No I/O is managed here.
- RPC: This libary crate contains the proto definitions, protoc generated files and grpc servers.
- Telemetry: This library crate contains the telemtry shared code.
Binaries
Every binary is a thin main.rs that just glues crates together. The Personal Ledger project is made up of the following binaries and there shared libraries:
1. Backend
A stand alone grpc server that interfaces with the database. It accepts grpc requests, queries the database and provides a grpc response. It contains the following libraries:
- Configuration
- Database
- Grpc
- Telemetry
2. Desktop
A standalone desktop applicatoin built with egui/tauri
3. TUI
4. Leptos (Web)
my-app/
├── Cargo.toml # Workspace root
├── crates/
│ ├── lib-core/ # Pure business logic, no I/O
│ │ ├── Cargo.toml
│ │ └── src/lib.rs
│ │
│ ├── lib-database/ # Database models + repository traits/impls
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── models.rs
│ │ └── repository.rs
│ │
│ ├── lib-rpc/
│ │ ├── Cargo.toml
│ │ ├── proto/
│ │ │ ├── personal-ledger/
| | | | └──v001/
│ │ │ │ ├── common.proto
│ │ │ │ ├── utilities.proto
│ │ │ │ └── ...
│ │ ├── build.rs # Generate protobuf services from proto files
│ │ └── src/
| | ├── gennerated/ # proto files generated by proto buf
| | | ├── mod.rs
| | | └── ...
│ │ ├── lib.rs
│ │ └── utilities.rs
| | └── ...
| |
│ ├── lib-telemetry/ # Telemetry module for the project
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── error.rs
│ │
│ ├── tui/ # Ratatui / crossterm UI (library so it can be reused)
│ │ ├── Cargo.toml
│ │ └── src/lib.rs
│ │
│ ├── backend/ # Binary: gRPC + HTTP server + DB
│ │ ├── Cargo.toml
│ │ └── src/main.rs
│ │
│ ├── cli/ # Binary: Interactive TUI that uses local DB
│ │ ├── Cargo.toml
│ │ └── src/main.rs
│ │
│ └── desktop/ # Binary: Standalone desktop (TUI or egui/tauri) + embedded DB
│ ├── Cargo.toml
│ └── src/main.rs
|
└── rust-toolchain.toml # Optional: pin toolchain + components