Skip to main content

Financial Workflow Application CLI

Project description

FiWa CLI - Financial Tracking Application

FiWa (Financial Wallet) is a terminal-based financial tracking application built with Textual, providing a rich TUI (Text User Interface) for managing personal finances, projects, and transactions.

๐Ÿ“‹ Table of Contents


โœจ Features

๐Ÿ” User Management

  • Multi-user support with secure password hashing (SHA-256)
  • Session management with UUID-based tracking
  • User login/logout with reactive state updates
  • User creation with configurable project limits
  • Role-based permissions (regular users and superusers)

๐Ÿ“Š Project Management

  • Multiple projects per user (configurable limit, default: 3)
  • Project creation with name, description, and currency settings
  • Project modification with real-time updates
  • Primary project selection for active context
  • Multi-currency support with main and additional currencies
  • Project switching via integrated selector

๐Ÿท๏ธ Label Management

  • Hierarchical labels for categorizing transactions
  • Label types: Action, Account, Label (3 levels)
  • Label status: Active, Deactivated, Mark for Deletion
  • Batch operations for efficient label management
  • Interactive editor with click-to-edit functionality
  • Label creation with validation and uniqueness checks

๐Ÿ“… Calendar Widget

  • Interactive date picker with month navigation
  • Configurable week start (Monday/Sunday)
  • Today highlighting with quick jump
  • Keyboard shortcuts (ESC to close)
  • Compact design positioned near trigger button

๐ŸŽจ User Interface

  • Reactive header showing user, project, and date
  • Menu system with contextual options
  • Settings panel with sidebar navigation
  • Dark/Light theme toggle (Ctrl+D)
  • Responsive layout with grid-based components
  • Modal screens for focused interactions

๐Ÿ”„ State Management

  • Reactive app_state for real-time UI updates
  • Automatic screen refresh on state changes
  • Session persistence across app lifecycle
  • Clean logout with complete state reset
  • Fallback to main screen after logout

๐Ÿ—๏ธ Architecture

Technology Stack

  • Framework: Textual - Modern TUI framework
  • Language: Python 3.12+
  • Database: SQLite (local storage)
  • Password Hashing: SHA-256 with salt
  • State Management: Reactive variables with watchers

Design Patterns

  • Screen-based navigation with modal overlays
  • Message passing for component communication
  • Reactive programming for state synchronization
  • Database handler pattern with op_* methods
  • Component-based architecture with reusable widgets

Key Components

FiWa CLI Application
โ”‚
โ”œโ”€โ”€ Main App (main.py)
โ”‚   โ”œโ”€โ”€ Reactive app_state
โ”‚   โ”œโ”€โ”€ Watch callbacks
โ”‚   โ””โ”€โ”€ Screen stack management
โ”‚
โ”œโ”€โ”€ Components (components/)
โ”‚   โ”œโ”€โ”€ FiwaHeader - Top navigation bar
โ”‚   โ””โ”€โ”€ CalendarWidget - Date picker modal
โ”‚
โ”œโ”€โ”€ Screens (screens/)
โ”‚   โ”œโ”€โ”€ Base - Login/Logout functionality
โ”‚   โ”œโ”€โ”€ Menu - Navigation menu
โ”‚   โ”œโ”€โ”€ Settings - Configuration hub
โ”‚   โ”œโ”€โ”€ Project Selector - Switch projects
โ”‚   โ”œโ”€โ”€ Reports - (Placeholder)
โ”‚   โ”œโ”€โ”€ Dashboard - (Placeholder)
โ”‚   โ””โ”€โ”€ Inputs - (Placeholder)
โ”‚
โ”œโ”€โ”€ Functions (functions/)
โ”‚   โ”œโ”€โ”€ handler_sqllite.py - Database operations
โ”‚   โ”œโ”€โ”€ loader.py - Configuration loading
โ”‚   โ””โ”€โ”€ db_faker.py - Test data generation
โ”‚
โ””โ”€โ”€ Database
    โ”œโ”€โ”€ Users
    โ”œโ”€โ”€ Projects
    โ”œโ”€โ”€ Labels
    โ”œโ”€โ”€ User-Project mapping
    โ””โ”€โ”€ Session tracking

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.12 or higher
  • pip (Python package manager)
  • Terminal with Unicode support

Install Dependencies

# Clone the repository
cd /home/koenig/Projects/00_fiwa_work/fiwa-cli

# Create virtual environment (optional but recommended)
conda create -n fiwa-cli python=3.12
conda activate fiwa-cli

# Install dependencies
pip install textual bcrypt pyyaml faker

Database Setup

The application automatically initializes the SQLite database on first run using the schema defined in schema.sql.


๐Ÿš€ Quick Start

Run the Application

# From the project directory
python main.py

First Time Setup

  1. Create a User (if database is empty)

    • Navigate: Menu โ†’ Settings โ†’ + Create User
    • Fill in: First name, Last name, Username, Email, Password
    • Click "Create"
  2. Login

    • Click: Menu โ†’ Login
    • Enter credentials
    • Click "Login"
  3. Create a Project

    • Navigate: Settings โ†’ + Create Project
    • Fill in: Name, Description, Currencies
    • Click "Create"
  4. Create Labels

    • Navigate: Settings โ†’ + Create Label
    • Fill in: Name, Description, Type, Status
    • Click "Create"

๐Ÿ“– User Guide

Navigation

Header Bar

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ FiWa [โ˜ฐ Menu] [๐Ÿ“… Calendar]  User | Project    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • FiWa - Application title
  • โ˜ฐ Menu - Opens main menu
  • ๐Ÿ“… Calendar - Opens date picker
  • User - Current logged-in user
  • Project - Active project

Main Menu

  • Inputs - Add transactions (Coming soon)
  • Reports - View financial reports (Coming soon)
  • Dashboard - Overview (Coming soon)
  • Settings - Configure application
  • Select Project - Switch active project
  • Login/Logout - Manage session
  • Exit - Close application

User Management

Creating a User

  1. Navigate to Settings โ†’ + Create User
  2. Fill in the form:
    • First Name (required)
    • Last Name (required)
    • Username (required)
    • Email (required, unique)
    • Password (required, will be hashed)
    • Birthday (optional)
    • Max Projects (default: 3)
  3. Click Create
  4. User is created and saved to database

Login/Logout

Login:

  1. Click Menu โ†’ Login
  2. Enter username/email and password
  3. Click "Login"
  4. Session starts, app_state updates with user data

Logout:

  1. Click Menu โ†’ Logout
  2. Confirm logout
  3. Session ends, returns to main screen
  4. All user data cleared from app_state

Project Management

Creating a Project

  1. Settings โ†’ + Create Project
  2. Check project limit (displayed at top)
  3. Fill in:
    • Name (required, max 24 chars)
    • Description (optional)
    • Main Currency (3-letter code, e.g., USD)
    • Additional Currencies (comma-separated)
  4. Click Create
  5. Project added to database and app_state

Modifying a Project

  1. Settings โ†’ = Modify Project
  2. Current project shown (selected from app_state)
  3. Edit fields:
    • Name
    • Description
    • Main Currency
    • Additional Currencies
  4. Click Update
  5. Changes saved, app_state updated

Switching Projects

  1. Menu โ†’ Select Project
  2. Choose from list of your projects
  3. Project changes immediately
  4. Header updates to show new project

Label Management

Creating Labels

  1. Settings โ†’ + Create Label
  2. Fill in:
    • Name (required)
    • Description (optional)
    • Action Type: Account / Action / Label
    • Status: Active / Inactive
  3. Click Create
  4. Label saved to database

Managing Labels

  1. Settings โ†’ = Manage Labels
  2. View table of all labels
  3. Click any row to edit:
    • Edit name
    • Edit description
    • Change status (Active/Deactivated/Deleted)
  4. Click Save All Changes to persist

Label Status:

  • Active (2) - Label is in use
  • Deactivated (1) - Label is hidden but preserved
  • Mark for Deletion (0) - Flagged for removal

Calendar Usage

  1. Click ๐Ÿ“… Calendar in header
  2. Navigate:
    • โ—€ Previous month
    • Today Jump to current month
    • โ–ถ Next month
  3. Select date by clicking any day
  4. ESC to close without selecting

๐Ÿ—„๏ธ Database Schema

Users Table

CREATE TABLE pstand_users (
    user_id INTEGER PRIMARY KEY AUTOINCREMENT,
    first_name VARCHAR(255) NOT NULL,
    last_name VARCHAR(255) NOT NULL,
    username VARCHAR(255) NOT NULL,
    birthday DATE,
    email VARCHAR(255) NOT NULL UNIQUE,
    password_hash VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    activated BOOLEAN DEFAULT 1,
    is_superuser BOOLEAN DEFAULT 0,
    scope VARCHAR(255) DEFAULT 'user:write',
    max_projects INTEGER DEFAULT 3,
    unique_identifier VARCHAR(36) NOT NULL
);

Projects Table

CREATE TABLE pstand_projects (
    project_id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    created_at TIMESTAMP NOT NULL,
    currency_main VARCHAR(3),
    currency_list TEXT,
    project_hash VARCHAR(64) UNIQUE
);

Labels Table

CREATE TABLE pstand_labels (
    label_id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(36) NOT NULL,
    description VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    project_id INTEGER NOT NULL,
    composite TEXT NOT NULL,
    label_status INTEGER DEFAULT 2,
    label_type INTEGER DEFAULT 1,
    FOREIGN KEY (project_id) REFERENCES pstand_projects(project_id),
    UNIQUE (name, project_id)
);

User-Project Mapping

CREATE TABLE pstand_user_project_map (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER,
    project_id INTEGER,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    project_perm_model VARCHAR(6) DEFAULT '000000',
    project_primary BOOLEAN DEFAULT 0,
    excluded_tags TEXT,
    FOREIGN KEY (user_id) REFERENCES pstand_users(user_id),
    FOREIGN KEY (project_id) REFERENCES pstand_projects(project_id)
);

Session Table

CREATE TABLE pstand_session_table (
    session_id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER NOT NULL,
    session_start TIMESTAMP NOT NULL,
    session_uuid VARCHAR(36) UNIQUE NOT NULL,
    session_type VARCHAR(50),
    FOREIGN KEY (user_id) REFERENCES pstand_users(user_id)
);

โš™๏ธ Configuration

config.yml

database:
  path: "./fiwa_data.db"
  salt: "fiwa_default_salt_2026"
  partition: "stand"

app:
  mode: "terminal"  # or "web"
  theme: "textual-dark"

calendar:
  week_starts_monday: true

Configuration Options

  • database.path - SQLite database file location
  • database.salt - Password hashing salt
  • database.partition - Database table prefix
  • app.mode - Terminal or web mode
  • app.theme - UI theme (dark/light)
  • calendar.week_starts_monday - Week start day

๐Ÿ› ๏ธ Development

Project Structure

fiwa-cli/
โ”œโ”€โ”€ main.py                 # Application entry point
โ”œโ”€โ”€ main.css                # Global styles
โ”œโ”€โ”€ config.yml              # Configuration file
โ”œโ”€โ”€ schema.sql              # Database schema
โ”œโ”€โ”€ README.md               # This file
โ”‚
โ”œโ”€โ”€ components/             # Reusable UI components
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ header.py          # FiwaHeader component
โ”‚   โ””โ”€โ”€ calendar_display.py # Calendar widget
โ”‚
โ”œโ”€โ”€ screens/                # Application screens
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ base.py            # Base screen + Login/Logout
โ”‚   โ”œโ”€โ”€ menu.py            # Main menu
โ”‚   โ”œโ”€โ”€ settings.py        # Settings screen
โ”‚   โ”œโ”€โ”€ project_selector.py # Project selector
โ”‚   โ”œโ”€โ”€ settings_project_new.py
โ”‚   โ”œโ”€โ”€ settings_project_modify.py
โ”‚   โ”œโ”€โ”€ settings_user_new.py
โ”‚   โ”œโ”€โ”€ settings_label_new.py
โ”‚   โ”œโ”€โ”€ settings_label_page.py
โ”‚   โ”œโ”€โ”€ reports.py         # Reports screen
โ”‚   โ”œโ”€โ”€ dashboard.py       # Dashboard screen
โ”‚   โ””โ”€โ”€ inputs.py          # Inputs screen
โ”‚
โ””โ”€โ”€ functions/              # Business logic
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ handler_sqllite.py  # Database operations
    โ”œโ”€โ”€ loader.py           # Config loader
    โ””โ”€โ”€ db_faker.py         # Test data generator

Database Handler Pattern

All database operations use the op_* naming convention:

# User operations
op_user_create(user_dict)
op_user_login(username, password)
op_user_logout(session_uuid)
op_user_get_info(user_id)

# Project operations
op_project_create(project_dict, user_id)
op_project_update(project_dict)
op_project_get_info(user_id)
op_get_max_projects(user_id)

# Label operations
op_label_create(label_dict, project_id)
op_label_update(label_id, label_dict)
op_label_get_all(project_id)
op_label_delete(label_id, hard_delete)

Generating Test Data

from functions.db_faker import faker_users, faker_projects, faker_labels

# Create fake users
dbh = SQLLiteHandler(db_path="./test.db")
user_ids = faker_users(dbh, n=5)

# Create fake projects
project_ids = faker_projects(dbh)

# Create fake labels
faker_labels(dbh, project_ids)

Key Bindings

  • Ctrl+C - Quit application
  • D - Toggle dark/light mode
  • ESC - Close modals/dialogs
  • Tab - Navigate between inputs
  • Enter - Activate buttons

๐Ÿ”ฎ Roadmap

Planned Features

  • Inputs Screen

    • Add transactions (income/expenses)
    • Quick entry mode
    • Bulk import from CSV/Excel
    • Receipt attachment
  • Reports Screen

    • Monthly summaries
    • Category breakdowns
    • Trend analysis
    • Export to PDF/Excel
  • Dashboard Screen

    • Budget overview
    • Spending charts
    • Account balances
    • Savings goals
  • Items Table

    • Transaction details
    • Label associations
    • Currency conversion
    • Exchange rate tracking
  • Advanced Features

    • Multi-currency conversion
    • Recurring transactions
    • Budget alerts
    • Data export/import
    • API integration

๐Ÿ“ License

This project is part of a private financial tracking system.


๐Ÿ‘ฅ Contributors

  • Boris Bauermeister - Lead Developer

๐Ÿ› Known Issues

  • Calendar widget positioning may vary on different terminal sizes
  • Label table scrolling requires keyboard navigation
  • Some placeholder screens (Inputs, Reports, Dashboard) are not yet implemented

๐Ÿ“ž Support

For issues, questions, or contributions, please contact the development team.


๐ŸŽฏ Getting Help

Common Issues

Q: Database not found

  • A: Run the app once to auto-create the database, or check config.yml path

Q: Can't login

  • A: Ensure you created a user first (Settings โ†’ + Create User)

Q: Project limit reached

  • A: Check user's max_projects setting in database

Q: Labels not saving

  • A: Click "Save All Changes" button after editing labels

Q: Screen not updating after login

  • A: This is a known issue; logout and login again

๐Ÿ“š Additional Resources


Version: 0.1.0-alpha
Last Updated: February 15, 2026
Status: Active Development

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fiwa_cli-0.3.0.tar.gz (214.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fiwa_cli-0.3.0-py3-none-any.whl (240.9 kB view details)

Uploaded Python 3

File details

Details for the file fiwa_cli-0.3.0.tar.gz.

File metadata

  • Download URL: fiwa_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 214.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for fiwa_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e49881417ac57ccf892db3995b895a7e29f59602e526572fd9c7a243a9f52cf7
MD5 0f14eaa5bb711dded6ace9584a3ea684
BLAKE2b-256 28cef22cb2d2db3e31a9e24e618c19ec378282b57e32cf4bf8cdf65493be7df5

See more details on using hashes here.

File details

Details for the file fiwa_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: fiwa_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 240.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for fiwa_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53b6d68813c023a4806f0c82d4d5ef3fc3acd7b9db3ef5cb18a289b9e6161632
MD5 f5ca614afe4a3eac12095ebbc41227f9
BLAKE2b-256 707635d266d90538518cbf4be3a0abff012c7b77d64e794baf6e1c2a0c69922c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page