Metadata-Version: 2.4
Name: leggen
Version: 2026.3.5
Summary: An Open Banking CLI
Project-URL: Repository, https://github.com/elisiariocouto/leggen
Author-email: Elisiário Couto <elisiario@couto.io>
License-Expression: MIT
License-File: LICENSE
Keywords: bank,cli,enablebanking,finance,openbanking,psd2,transactions
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Utilities
Requires-Python: ~=3.13.0
Requires-Dist: apscheduler<4,>=3.10.0
Requires-Dist: bcrypt<5,>=4.0.0
Requires-Dist: boto3<2,>=1.35.0
Requires-Dist: click<9,>=8.1.7
Requires-Dist: discord-webhook<2,>=1.3.1
Requires-Dist: fastapi<1,>=0.104.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: loguru<0.8,>=0.7.2
Requires-Dist: pydantic<3,>=2.0.0
Requires-Dist: pyjwt[crypto]<3,>=2.8.0
Requires-Dist: requests<3,>=2.31.0
Requires-Dist: tabulate<0.10,>=0.9.0
Requires-Dist: tomli-w<2,>=1.0.0
Requires-Dist: uvicorn[standard]<1,>=0.24.0
Description-Content-Type: text/markdown

# 💲 leggen


A self hosted Open Banking Dashboard, API and CLI for managing bank connections and transactions.

Having your bank data accessible through both CLI and REST API gives you the power to backup, analyze, create reports, and integrate with other applications.

![Leggen demo](docs/leggen_demo.gif)

## 🛠️ Technologies

  ### Frontend
  - [React](https://reactjs.org/): Modern web interface with TypeScript
  - [Vite](https://vitejs.dev/): Fast build tool and development server
  - [Tailwind CSS](https://tailwindcss.com/): Utility-first CSS framework
  - [shadcn/ui](https://ui.shadcn.com/): Modern component system built on Radix UI
  - [TanStack Query](https://tanstack.com/query): Powerful data synchronization for React

  ### 🔌 API & Backend
  - [FastAPI](https://fastapi.tiangolo.com/): High-performance async API backend (integrated into `leggen server`)
  - [EnableBanking](https://enablebanking.com/): Open Banking data access for connecting to banks
  - [APScheduler](https://apscheduler.readthedocs.io/): Background job scheduling with configurable cron

  ### 📦 Storage
  - [SQLite](https://www.sqlite.org): for storing transactions, simple and easy to use


## ✨ Features

### 🎯 Core Banking Features
- Connect to banks using EnableBanking (30+ EU countries)
- List all connected banks and their connection statuses
- View balances of all connected accounts
- List and filter transactions across all accounts

### 🏷️ Categorization & Analytics
- Categorize transactions with custom categories
- Keyword-based learning: automatically categorizes future transactions matching the same description
- Bulk categorization and removal by transaction description
- Filter transactions by category (including uncategorized)
- Analytics dashboard with spending-by-category breakdown
- `exclude_from_stats` flag for categories like inter-account transfers

### 🔄 Data Management
- Sync all transactions with SQLite database
- Background sync scheduling with configurable cron expressions

### 🔐 Authentication
- Single-user authentication with JWT tokens
- API key support for programmatic access

### 📡 API & Integration
- **REST API**: Complete FastAPI backend with comprehensive endpoints
- **CLI Interface**: Enhanced command-line tools with new options

### 🔔 Notifications & Monitoring
- Discord and Telegram notifications for filtered transactions
- Configurable transaction filters (case-sensitive/insensitive)
- Account expiry notifications and pre-expiry warnings
- Comprehensive logging and error handling

## 🚀 Quick Start

### Prerequisites
1. Create an Enable Banking account at [https://enablebanking.com/](https://enablebanking.com/)
2. Create an application in the [Enable Banking Customer Portal](https://enablebanking.com/cp/applications) as the image below. The redirect URL must use HTTPS and must end with `/bank-connected`. Enable Banking does not support HTTP.
3. Set up your bank accounts following the [Enable Banking Setup Guide](docs/enable-banking-setup.md)

![Enable Banking new application](docs/enable-banking-new-application.png)

### Installation

#### Docker Compose

```bash
# Clone the repository
git clone https://github.com/elisiariocouto/leggen.git
cd leggen

# Create your configuration
mkdir -p data && cp config.example.toml data/config.toml
# Edit data/config.toml with your EnableBanking credentials

# Generate the [auth] section for your config
docker compose run --rm leggen-server /app/.venv/bin/leggen generate-auth-config
# Copy the output into data/config.toml

# Start all services
docker compose up -d
```

### Configuration

Create a configuration file at `./data/config.toml`:

```toml
# Required: Authentication
# Generate with: leggen generate-auth-config
# Docker Compose: docker compose run --rm leggen-server /app/.venv/bin/leggen generate-auth-config
[auth]
username = "admin"
password_hash = "YOUR_BCRYPT_HASH"
api_key = "YOUR_API_KEY"
jwt_secret = "YOUR_JWT_SECRET"
jwt_expiry_minutes = 60

[enablebanking]
application_id = "your-application-id"
key_path = "/path/to/private-key.pem"
# url = "https://api.enablebanking.com"

[database]
sqlite = true

# Optional: Background sync scheduling
[scheduler.sync]
enabled = true
hour = 3      # 3 AM
minute = 0
# cron = "0 3 * * *"  # Alternative: use cron expression

# Optional: Discord notifications
[notifications.discord]
webhook = "https://discord.com/api/webhooks/..."
enabled = true

# Optional: Telegram notifications
[notifications.telegram]
token = "your-bot-token"
chat_id = 12345
enabled = true

# Optional: Transaction filters for notifications
[filters]
case_insensitive = ["salary", "utility"]
case_sensitive = ["SpecificStore"]
```

## 📖 Usage

### Web Interface
Access the React web interface at `http://localhost:3000` after starting the services.

### API Service
Visit `http://localhost:3000/api/v1/docs` for interactive API documentation.

### CLI Commands
```bash
leggen status              # Check connection status
leggen bank add            # Connect to a new bank
leggen balances            # View account balances
leggen transactions        # List transactions
leggen sync                # Trigger accounts sync
```

For more options, run `leggen --help` or `leggen <command> --help`.

## ⚠️ Notes
- This project is in active development
