Most small businesses track their budget the same way: a spreadsheet that starts ambitious in January, gets updated sporadically by March, and becomes a guessing game by July. By December, you’re piecing together bank exports and receipt folders to figure out where the money went.

The problem isn’t discipline. It’s that manual budget tracking fights against how money actually moves — in small, frequent, unpredictable transactions across multiple accounts. The fix isn’t another SaaS subscription that charges per seat and locks your financial data behind someone else’s servers. The fix is automating the boring parts: capture, categorization, and reporting.

This guide walks through building a self-hosted budget tracking and cash flow forecasting stack using four open source tools: Firefly III for transaction management, n8n for workflow automation, Ollama for AI-powered categorization, and Metabase for dashboards and forecasting. Everything runs on your own server. No per-seat fees. No data leaving your infrastructure.

Why Not Just Use a Spreadsheet?

Spreadsheets are great for planning. They’re terrible for ongoing tracking. Here’s why:

Problem Spreadsheet Automated Stack
Transaction entry Manual copy-paste from bank exports Automatic import via API or email parsing
Categorization You type the category every time AI suggests categories based on merchant history
Multi-account view Separate tabs, manual consolidation Unified view across all accounts
Cash flow forecast Formulas you build and maintain Visual dashboards that update in real time
Error detection You catch mistakes by accident Automated anomaly detection flags unusual transactions
Team access Email the file around or share a drive Role-based access with audit logs

The spreadsheet approach costs you about 2–3 hours per week in manual data entry and reconciliation. Over a year, that’s 100+ hours — roughly $3,000–5,000 in labor costs for a task that can be largely automated.

The Stack: Four Open Source Tools

1. Firefly III — Transaction Management

Firefly III is a self-hosted personal finance manager. Despite the “personal” label, it works exceptionally well for small business budget tracking. It supports multiple accounts (checking, savings, credit cards, cash), budgets, categories, tags, and rules for automatic transaction processing.

Key features for business use:

  • Multi-account support with full transaction history
  • Budget categories with spending limits and progress tracking
  • Rules engine that auto-categorizes transactions based on merchant, amount, or description
  • CSV and CAMT.053 import for bank statement processing
  • REST API for programmatic access and automation
  • Double-entry bookkeeping model — every transaction has a source and destination

2. n8n — Workflow Automation

n8n is a self-hosted workflow automation tool (like Zapier, but open source and running on your server). It connects your bank, email, and Firefly III through visual workflows. You build automations by dragging nodes onto a canvas and connecting them.

Use cases:

  • Parse daily bank notification emails and import transactions into Firefly III
  • Sync transaction data from Firefly III to Metabase for dashboarding
  • Trigger alerts when spending exceeds budget thresholds
  • Schedule recurring budget review reports

3. Ollama — AI-Powered Categorization

Ollama runs large language models locally on your server. No API calls to external services — your financial data never leaves your infrastructure. For budget tracking, Ollama can:

  • Read transaction descriptions and suggest appropriate categories
  • Identify recurring vs. one-time expenses
  • Flag unusual transactions that might be errors or fraud
  • Generate plain-language summaries of monthly spending

4. Metabase — Dashboards and Forecasting

Metabase is an open-source business analytics tool that connects to your database and lets you build visual dashboards without writing SQL. For budget tracking:

  • Real-time spending vs. budget visualizations
  • Cash flow trend charts with moving averages
  • Category breakdown pie charts
  • Custom alerts when metrics cross thresholds

Architecture Overview

Bank/Email → n8n (parse + import) → Firefly III (store + categorize)
                                         ↓
                                    Ollama (AI categorize)
                                         ↓
                                    Metabase (dashboard + forecast)

Transactions flow in from your bank (via email notifications or API exports), get processed by n8n, stored and categorized in Firefly III (with Ollama’s help for ambiguous transactions), and visualized in Metabase — all on your server.

Step 1: Install Firefly III

Firefly III runs as a Docker container. Here’s a minimal docker-compose.yml:

version: "3.8"

services:
  fireflyiii:
    image: fireflyiii/core:latest
    ports:
      - "8080:8080"
    environment:
      - APP_KEY=your-32-char-app-key
      - DB_CONNECTION=mysql
      - DB_HOST=db
      - DB_PORT=3306
      - DB_DATABASE=firefly
      - DB_USERNAME=firefly
      - DB_PASSWORD=your-secure-password
      - APP_URL=https://budget.yourcompany.com
    depends_on:
      - db
    volumes:
      - firefly-upload:/var/www/html/storage/upload

  db:
    image: mariadb:10
    environment:
      - MYSQL_DATABASE=firefly
      - MYSQL_USER=firefly
      - MYSQL_PASSWORD=your-secure-password
      - MYSQL_ROOT_PASSWORD=your-root-password
    volumes:
      - firefly-db:/var/lib/mysql

volumes:
  firefly-upload:
  firefly-db:

Generate an app key with php artisan key:generate or use openssl rand -base64 32. Bring it up:

docker compose up -d

Visit https://budget.yourcompany.com (behind your reverse proxy — we recommend Caddy for automatic HTTPS), create your admin account, and set up your accounts and budgets.

Setting Up Budgets and Categories

In Firefly III, create budgets that match your business expense categories:

Budget Monthly Limit Typical Transactions
Software & Tools $500 SaaS subscriptions, hosting, licenses
Office Supplies $200 Stationery, printer ink, small equipment
Marketing $1,000 Ads, content, design, events
Travel $800 Flights, hotels, meals, mileage
Utilities $300 Internet, phone, electricity
Professional Fees $600 Legal, accounting, consulting

Create categories for finer-grained tracking, and set up rules to auto-assign transactions. For example:

  • If description contains “AWS” → category: Software & Tools, budget: Software & Tools
  • If description contains “Stripe” → category: Payment Processing, no budget
  • If amount > $500 and description contains “Flight” → category: Travel, budget: Travel, tag: “requires-approval”

Step 2: Automate Transaction Import with n8n

The biggest time sink in budget tracking is manually entering transactions. n8n can automate this by parsing bank notification emails or processing exported files.

Here’s a workflow that parses a daily bank notification email and imports transactions into Firefly III:

{
  "nodes": [
    {
      "type": "n8n-nodes-base.imapEmail",
      "name": "Read Bank Email",
      "parameters": {
        "host": "imap.yourcompany.com",
        "port": 993,
        "email": "finance@yourcompany.com",
        "text": "="
      }
    },
    {
      "type": "n8n-nodes-base.htmlExtract",
      "name": "Extract Transaction Data",
      "parameters": {
        "extractionValues": {
          "values": [
            { "key": "amount", "cssSelector": ".transaction-amount" },
            { "key": "description", "cssSelector": ".transaction-description" },
            { "key": "date", "cssSelector": ".transaction-date" }
          ]
        }
      }
    },
    {
      "type": "n8n-nodes-base.httpRequest",
      "name": "Import to Firefly III",
      "parameters": {
        "method": "POST",
        "url": "https://budget.yourcompany.com/api/v1/transactions",
        "authentication": "headerAuth",
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer YOUR_FIREFLY_TOKEN" }
          ]
        },
        "body": {
          "transactions": [
            {
              "type": "withdrawal",
              "amount": "=",
              "description": "=",
              "date": "=",
              "source_id": "1"
            }
          ]
        }
      }
    }
  ]
}

This workflow runs on a schedule (e.g., every morning at 8 AM), reads any bank notification emails, extracts the transaction details, and pushes them into Firefly III via the REST API.

Alternative: CSV Import Workflow

If your bank doesn’t send email notifications, you can set up a workflow that monitors a shared folder for CSV exports:

// n8n Code Node — parse bank CSV and prepare for Firefly III
const csv = items[0].json.data;
const lines = csv.split('\n');
const transactions = [];

for (const line of lines.slice(1)) {
  const [date, description, amount, balance] = line.split(',');
  if (!date) continue;
  
  transactions.push({
    type: parseFloat(amount) < 0 ? 'withdrawal' : 'deposit',
    amount: Math.abs(parseFloat(amount)).toFixed(2),
    description: description.trim(),
    date: date.trim(),
    source_id: 1  // your checking account ID
  });
}

return transactions.map(t => ({ json: t }));

Step 3: AI-Powered Categorization with Ollama

Firefly III’s rules engine handles most categorization automatically — if the merchant is known, the rule fires and the category is set. But new merchants, ambiguous descriptions, and one-off transactions fall through.

This is where Ollama comes in. Run a local LLM that reads the transaction description and suggests a category:

import requests

def categorize_transaction(description, amount, categories):
    """Use Ollama to suggest a category for an uncategorized transaction."""
    prompt = f"""You are a bookkeeping assistant. Categorize this transaction into one of these categories:
{', '.join(categories)}

Transaction: {description}
Amount: ${amount}

Respond with ONLY the category name, nothing else."""

    response = requests.post(
        "http://localhost:11434/api/generate",
        json={
            "model": "llama3.2",
            "prompt": prompt,
            "stream": False,
            "options": {"temperature": 0.1}
        }
    )
    
    suggested = response.json()["response"].strip()
    return suggested if suggested in categories else "Uncategorized"

# Example usage
categories = [
    "Software & Tools", "Office Supplies", "Marketing",
    "Travel", "Utilities", "Professional Fees",
    "Payment Processing", "Meals & Entertainment", "Miscellaneous"
]

result = categorize_transaction("SQ * COFFEE SHOP 1234", 8.50)
print(f"Suggested category: {result}")
# Output: Suggested category: Meals & Entertainment

Integrate this into your n8n workflow with an HTTP Request node that calls Ollama’s API before importing to Firefly III. If the transaction description doesn’t match any existing rule, n8n sends it to Ollama, gets a category suggestion, and includes it in the Firefly III import.

Detecting Unusual Transactions

Ollama can also flag transactions that look unusual for your business:

def flag_anomaly(description, amount, category, historical_avg):
    """Flag transactions that deviate significantly from the norm."""
    prompt = f"""You are a fraud detection assistant for a small business.
Review this transaction and determine if it's unusual.

Transaction: {description}
Amount: ${amount}
Category: {category}
Average amount for this category: ${historical_avg}

Is this transaction unusual? Consider: amount deviation, unusual merchants, 
category mismatch. Answer YES or NO with a brief reason."""

    response = requests.post(
        "http://localhost:11434/api/generate",
        json={
            "model": "llama3.2",
            "prompt": prompt,
            "stream": False,
            "options": {"temperature": 0.1}
        }
    )
    return response.json()["response"].strip()

When a transaction is flagged, n8n can send a notification to your team chat (Mattermost, for example) for manual review before the transaction is finalized in Firefly III.

Step 4: Dashboards and Forecasting with Metabase

Firefly III has decent built-in reports, but for business dashboards and forecasting, Metabase gives you more flexibility. Connect Metabase to Firefly III’s MySQL database and build dashboards that answer questions like:

  • “How much have we spent on marketing this month vs. last month?”
  • “Which categories are trending above budget?”
  • “What’s our projected cash runway based on the last 90 days?”

Key Dashboard Cards

1. Budget vs. Actual (Current Month)

A bar chart showing planned budget vs. actual spending for each category. Green bars mean you’re under budget; red means over. This is the single most useful view for day-to-day budget management.

2. Cash Flow Trend (90-Day Rolling)

A line chart showing daily total inflows and outflows. Add a 7-day moving average to smooth out the noise. This reveals your business’s natural cash rhythm — when money comes in and when it goes out.

3. Category Heat Map

A grid showing spending intensity by category and week. Dark cells mean high spending. This makes it easy to spot seasonal patterns and anomalies.

4. Cash Runway Forecast

A simple projection based on your average monthly burn rate:

SELECT 
  current_balance - (avg_monthly_burn * months_ahead) AS projected_balance,
  months_ahead
FROM (
  SELECT 
    (SELECT SUM(amount) FROM accounts WHERE account_type = 'asset') AS current_balance,
    AVG(monthly_total) AS avg_monthly_burn
  FROM (
    SELECT DATE_TRUNC('month', date) AS month, SUM(amount) AS monthly_total
    FROM transactions
    WHERE type = 'withdrawal'
      AND date > DATE_SUB(NOW(), INTERVAL 90 DAY)
    GROUP BY month
  ) monthly_totals
) stats
CROSS JOIN (
  SELECT 1 AS months_ahead UNION SELECT 2 UNION SELECT 3 
  UNION SELECT 4 UNION SELECT 5 UNION SELECT 6
) future;

This gives you a 6-month projection of your account balance based on recent spending patterns. When the projected balance approaches zero, it’s time to either cut spending or increase revenue — and you’ll see it coming months in advance.

Comparison: Self-Hosted Stack vs. SaaS Alternatives

Feature Self-Hosted Stack SaaS (YNAB, Ramp, etc.)
Monthly cost $5–10 server cost $15–50+ per user
Data location Your server Vendor’s cloud
API access Full, unrestricted Limited or paid tier
Customization Complete control What the vendor offers
AI categorization Local, private Cloud-based, data shared
Setup time 2–4 hours initial 30 minutes
Maintenance Occasional updates Handled by vendor
Lock-in risk None — you own the data High — export is limited

The self-hosted stack has higher setup cost but lower long-term cost and zero lock-in. For a 5-person team, you save $900–3,000 per year in subscription fees. For a 20-person team, the savings compound further.

Maintenance and Best Practices

Weekly (15 minutes)

  • Review uncategorized transactions in Firefly III
  • Check anomaly alerts and confirm or dismiss flagged transactions
  • Glance at the Metabase dashboard for any obvious spending spikes

Monthly (30 minutes)

  • Review the budget vs. actual report
  • Adjust budget limits based on changing business needs
  • Update Firefly III rules for any new recurring merchants
  • Export a monthly summary for your accountant

Quarterly (1 hour)

  • Review category structure — merge or split categories as needed
  • Update Ollama’s categorization prompt with any new business context
  • Review the cash runway forecast and adjust business plans accordingly
  • Back up the Firefly III database (automate this with a cron job)

Automated Backup

Set up a simple daily backup of the Firefly III database:

#!/bin/bash
# Daily backup of Firefly III database
DATE=$(date +%Y%m%d)
docker exec firefly-db mysqldump -u firefly -pYOUR_PASSWORD firefly | \
  gzip > /backups/firefly-$DATE.sql.gz

# Keep last 30 days
find /backups -name "firefly-*.sql.gz" -mtime +30 -delete

Add this to your crontab: 0 2 * * * /opt/scripts/backup-firefly.sh

Common Pitfalls (and How to Avoid Them)

1. Over-categorizing. Start with 8–10 broad categories. You can always split them later. Having 40 categories creates more work without more insight.

2. Ignoring small transactions. Those $3 coffee charges add up. Your rules engine should capture everything, even if the category is just “Miscellaneous.” You can’t manage what you don’t measure.

3. Not reconciling with bank statements. Even with automation, do a monthly reconciliation. Export your bank statement, compare totals, and investigate any discrepancies. Automation reduces errors but doesn’t eliminate them.

4. Making the forecast too complex. A simple 90-day average is more reliable than a sophisticated model with seasonal adjustments — at least for the first year. You need 12+ months of data before seasonal patterns become reliable.

5. Forgetting about transfers. Moving money between accounts isn’t an expense. Make sure your rules engine tags transfers correctly so they don’t inflate your spending numbers.

Getting Started This Week

You don’t need to build the entire stack at once. Here’s a practical rollout plan:

  1. Day 1: Install Firefly III. Create your accounts, budgets, and categories.
  2. Day 2: Import the last 3 months of transactions via CSV. Set up your first 10 rules.
  3. Day 3: Install n8n. Build the email-parsing workflow. Test with a real bank notification.
  4. Day 4: Install Ollama. Add the categorization step to your n8n workflow.
  5. Day 5: Connect Metabase to the Firefly III database. Build your first dashboard (budget vs. actual).

By the end of the week, you’ll have a fully automated budget tracking system that runs itself. The only manual step is the weekly 15-minute review.

Wrapping Up

Budget tracking doesn’t have to be a spreadsheet chore. With Firefly III, n8n, Ollama, and Metabase, you can build a self-hosted financial tracking system that captures transactions automatically, categorizes them intelligently, and surfaces insights through visual dashboards — all for the cost of a small server and a few hours of setup.

The real value isn’t just saving time on data entry. It’s having a real-time view of your business’s financial health so you can make decisions based on data, not gut feelings. When you can see your cash runway projected six months out, you can plan hiring, investments, and growth with confidence.


Ready to automate your business finances? Contact ARDOT Consulting — we help small businesses set up self-hosted automation stacks tailored to their needs. No subscriptions, no lock-in, just tools that work.