This repository contains the full-stack solution for a powerful, self-hosted home finance tracking application. Built with Rust, Axum, SeaORM, and Polars on the backend, and Yew (WebAssembly) on the frontend, this tool is designed for users who want granular control over their financial data, robust forecasting capabilities, and a system based on sound accounting principles.
The core mission of this project is to provide a comprehensive and accurate view of your financial situation, both past and future. It allows you to model your entire financial ecosystem—from various bank accounts and currencies to complex recurring transactions—and then use that model to gain insights and forecast with precision.
- Core Features
- Project Goals
- Technical Stack
- Getting Started
- API Documentation
- Project Structure
- Development
- Contributing
- License
This application is built around a set of powerful, interconnected features:
- Multi-Currency Account Management:
- Track an unlimited number of accounts (e.g., bank accounts, credit cards, cash).
- Each account has its own designated currency, with all calculations being currency-aware using
rusty_money. - Designate specific accounts (e.g., for error correction) to be ignored in statistics and totals.
- Comprehensive Transaction Modeling:
- Recurring Transactions: Model regular expenses like rent, subscriptions, or loan payments with flexible recurrence rules (daily, weekly, monthly, etc.).
- Recurring Income: Separately model recurring income streams like salaries or business revenue.
- One-Off Transactions: Manually add any extra or non-recurring transactions.
- Imported Transactions: Import transactions from standard banking formats. The system is designed to let you reconcile these imported items against your manually modeled data to prevent duplicates.
- Double-Entry Accounting System:
- All transactions support an optional source account in addition to the mandatory target account.
- When both are specified, the system automatically creates the corresponding transaction on the source account, ensuring that money is never created or destroyed, only moved.
- Financial Analysis & Forecasting:
- Historical View: Get a cumulative, day-by-day balance for any account up to the present.
- Future Forecast: Project account balances into the future based on all scheduled recurring transactions and income.
- Scenarios (What-If Analysis): Create and apply hypothetical financial scenarios (e.g., "Buying a House", "New Job") to see how major decisions impact your future balance without affecting your actual data.
- Per-Account Statistics: Analyze account performance with metrics like starting/ending balances for a period and lowest/highest balances.
- Advanced Categorization & Reporting:
- Hierarchical Tagging: Apply tags to both transactions and accounts. Tags can be nested (e.g.,
Expenses:Food:Groceries) to allow for detailed, tree-based reporting on spending and income. - Cross-Account Insights: Use tags to see total expenses or income in a category, regardless of which account was used.
- Hierarchical Tagging: Apply tags to both transactions and accounts. Tags can be nested (e.g.,
- Manual Account States:
- Create "snapshots" of your account balance at specific points in time.
- Useful for correcting drift or ensuring historical accuracy by overriding calculated balances with actual bank statement values.
- Interoperability:
- Ledger CLI Compatibility: Every entity (accounts, transactions, tags) can be configured with a
ledger_name, allowing the entire financial history to be exported in a format compatible with the powerful, plain-text accounting tool, Ledger.
- Ledger CLI Compatibility: Every entity (accounts, transactions, tags) can be configured with a
The main goals of this project are:
- Current Account State Visibility: Provide a clear and accurate view of all account states over time.
- Account Forecasting: Enable precise forecasting of account balances based on recurring transactions and income.
- Scenario Planning: Allow users to model future life events and their financial impact.
This project is built using the following technologies:
Backend
- Rust (Edition 2024)
- Axum - REST API
- SeaORM - Async ORM
- Polars - High-performance dataframes for financial compute
- Tokio - Async runtime
- Observability:
tracing&axum-prometheus - Documentation:
utoipa(OpenAPI 3.0)
Frontend
- Yew - Rust framework for WebAssembly apps
- Trunk - WASM web application bundler
- Styling: Tailwind CSS & DaisyUI
- Routing: Yew Router
Infrastructure & Data
- Database: SQLite (development), PostgreSQL (production)
- Containerization: Docker & Docker Compose
- Data Handling:
serde,chrono,rust_decimal
The easiest way to run the full stack (backend + frontend) is via Docker Compose.
- Clone the repository:
Bash
�git clone https://github.com/yourusername/finrust.git
cd finrust
- Start the application:
Bash
�docker-compose up -d
- Access the services:
- Frontend:
http://localhost:8081 - Backend API:
http://localhost:8080/api/v1/ - Swagger UI:
http://localhost:8080/swagger-ui
- Frontend:
- Note: Data will be persisted in the
./datadirectory.
Prerequisites
- Rust (latest stable version)
- Trunk (for frontend):
cargo install trunk wasm-bindgen-cli:cargo install wasm-bindgen-cli- SQLite (for development) or PostgreSQL
Backend Setup
- Initialize the database:
Bash
�cargo run init-db --database-url "sqlite://finrust.db"
- Start the server:
Bash
�cargo run serve --bind-address "0.0.0.0:8080"
Frontend Setup
- Navigate to the frontend workspace:
Bash
�cd workspace/frontend
- Add the WebAssembly target (if not already added):
Bash
�rustup target add wasm32-unknown-unknown
- Serve the application:
Bash
�trunk serve --port 8081
The application provides a comprehensive REST API with full OpenAPI 3.0 specification and interactive Swagger UI documentation.
- Accounts: CRUD operations for financial accounts.
- Transactions: Manage one-off, recurring, and imported transactions.
- Recurring Income: Handle recurring income streams.
- Scenarios: Create and manage "what-if" financial scenarios.
- Manual Account States: Override account balances at specific points in time.
- Statistics: Account performance metrics and analytics.
- Timeseries: Historical and forecasted account balance data.
- Users: User management functionality.
- Tags & Categories: Hierarchical organization for transactions.
Once the backend is running, visit http://localhost:8080/swagger-ui to explore the complete API documentation with
interactive endpoint testing, schemas, and example payloads.
Plaintext
finrust/
├── Cargo.toml # Main workspace configuration
├── docker-compose.yaml # Docker composition for full stack
├── Dockerfile # Multi-stage Docker build
├── src/ # Main application entry point & CLI
│ ├── handlers/ # API endpoint handlers
│ ├── cli.rs # Command-line interface definitions
│ └── router.rs # API routing configuration
└── workspace/
├── frontend/ # Yew (WebAssembly) Frontend Application
│ ├── src/
│ └── index.html
├── model/ # Database models and entities (SeaORM)
├── migration/ # Database migrations
├── compute/ # Financial computation logic (Polars)
└── common/ # Shared utilities and types
- Install Rust and dependencies:
Bash
�curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup update stable
cargo install trunk wasm-bindgen-cli
- Set up the database:
Bash
�# For SQLite (development)
cargo run init-db --database-url "sqlite://finrust.db"
- Logging: This project uses the
tracingcrate. Use appropriate log levels (error!,warn!,info!,debug!,trace!) and neverprintln!in production code. - Documentation: Every public struct, enum, trait, and function must have a docstring explaining its purpose, arguments, and return values.
Run the test suite for the entire workspace:
Bash
cargo test
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.