ArthLedger:智能會計,讓企業更強健
ArthLedger — Smart Accounting. Stronger Businesses.
ArthLedger 是面向印度自由工作者、零售商及小型企業的本機優先 AI 會計與業務管理平台。它支援精確多貨幣記帳,並以 Ollama 在本機擷取收據和發票資料,經用戶確認後才儲存。即使 AI 模型或互聯網無法使用,開票、支出、庫存、報告及 CSV 匯出仍可運作;對話式助理以受控 SQLite 查詢回應會計問題。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
ArthLedger — Smart Accounting. Stronger Businesses.
A private, local-first AI accounting and business management platform designed for Indian freelancers, independent professionals, local retail shops, wholesalers, and small businesses.
What I Built
ArthLedger (from the Sanskrit Arth, meaning wealth, purpose, and finance) is a full-featured, local-first web application that bridges the gap between traditional double-entry bookkeeping and local artificial intelligence.
The Problem It Solves
Small business owners and freelancers face three major problems with existing accounting software:
- Predatory Recurring Subscriptions: Cloud SaaS platforms (QuickBooks, Zoho, FreshBooks) charge escalating monthly fees that disproportionately hurt early-stage side hustles, local merchants, and independent consultants.
- Financial Privacy & Data Exposure: Most "AI-powered" accounting tools silently transmit bank statements, vendor receipts, customer lists, and proprietary revenue numbers to third-party cloud AI APIs.
- Flawed Multi-Currency Support: Many tools either lack genuine multi-currency support, use inaccurate binary floating-point calculations, or silently overwrite historical transactions when exchange rates fluctuate.
Who Would Pay For It?
- Indian Freelancers & Remote Contractors: Exporting software, design, or writing services to global clients in USD, EUR, or GBP while filing taxes in INR.
- Local Retailers & Shop Owners: Managing physical inventory, tracking low-stock thresholds, and recording domestic GST invoices with lakh/crore Indian number formatting.
- Independent Consultants & Agencies: Wanting an automated receipt scanner and intelligent assistant that runs 100% on their own laptop, without an internet dependency or ongoing API bills.
Key Capabilities
-
Genuine Multi-Currency Engine: Built on Python's exact
Decimalarithmetic (no float rounding errors), with an ISO 4217 registry (INR, USD, EUR, GBP, AED, CAD, JPY with 0 decimals, etc.), manual exchange-rate history, and cross-currency settlement. - Local AI Document Scanner: Extracts structured JSON (merchant, document number, date, currency, line items, tax, total) from receipts and invoices locally using PyPDF and Ollama.
- Human-in-the-Loop Verification: Extracted data is presented in an editable review screen; no financial record is ever saved automatically without explicit user confirmation.
- Conversational Accounting Assistant: Answers natural language questions ("What were my largest expenses this month?", "Which invoices are still unpaid?", "Compare this month's sales with last month") by executing controlled, validated SQLite queries rather than letting AI execute arbitrary SQL.
- Professional PDF Generation: Generates clean, print-ready A4 Tax Invoices and Monthly Financial Performance Reports with bank details, terms, and authorized signature boxes using ReportLab.
- 100% Offline Usability: If the AI model or internet is unavailable, every accounting workflow—invoicing, expenses, inventory, reports, and CSV exports—remains completely functional.
Demo
Web Application Interface
- Dashboard: Real-time KPI cards (Invoiced Sales, Money Received, Outstanding Receivables, Total Expenses, Net Margin), monthly cash inflow vs expense SVG chart, pending invoice alerts, and recent transactions ledger.
-
Sales & Invoices: Interactive line-item editor with auto-calculating quantities, unit prices, discounts, GST/VAT rates, status lifecycle (
DRAFT,ISSUED,PARTIALLY_PAID,PAID,OVERDUE,CANCELLED), and one-click PDF generation. - Purchases & Expenses: Category-based expense tracking, receipt attachment previews, and CSV exports.
- Customer & Supplier Portals: Real-time calculated balances derived strictly from actual invoices, payments, and expenses, with safe archiving to protect financial history.
- Inventory Management: Product catalog with SKU tracking, stock adjustments, low-stock reorder alerts, and inventory valuation.
- AI Assistant: Local chat interface with instant query chips, connection status indicators, and deterministic fallbacks.
Running the Demo Locally
# Clone the repository
git clone https://github.com/Kashyap-Patel115/ArthLedger-Local-AI-Accounting.git
cd arthledger
# Install lightweight dependencies
pip install flask reportlab pypdf pytest requests
# Launch ArthLedger
python app.py
Open http://127.0.0.1:5000 in any modern browser.
Demo Video link:https://drive.google.com/file/d/129opE3qH3_B9pQ9SaElSag3a_fKFgV04/view?usp=sharing
Code
My github Repository Link:https://github.com/Kashyap-Patel115/ArthLedger-Local-AI-Accounting.git
The code is designed to be modular, readable, beginner-friendly, and free of heavy front-end build pipelines or proprietary dependencies.
ArthLedger/
├── app.py # Flask application factory & context processors
├── config.py # Local directory paths, database, & upload safety rules
├── database.py # SQLite schema, WAL mode, migrations, & audit trail
├── currency.py # ISO 4217 registry, Decimal financial math, Indian number formatting
├── accounting.py # Invoicing rules, payment allocation, KPIs, & stock movements
├── pdf_extractor.py # Local text extraction (pypdf) & path traversal prevention
├── pdf_generator.py # ReportLab professional PDF generation (A4 Invoices & Reports)
├── ai_service.py # Ollama local HTTP client, JSON schema extraction, & controlled queries
├── reset_db.py # Utility to cleanly zero all financial records
├── routes/ # Clean modular Flask Blueprints
│ ├── dashboard.py # KPIs and chart endpoints
│ ├── invoices.py # Invoice creation, status updates, & payments
│ ├── expenses.py # Expense recording, categorization, & CSV export
│ ├── contacts.py # Customers and suppliers management
│ ├── inventory.py # Stock movements and low-stock alerts
│ ├── transactions.py # Unified ledger view
│ ├── documents.py # Upload, local extraction, and review/confirm flow
│ ├── ai_assistant.py # Conversational assistant endpoints
│ ├── reports.py # Profit & Loss, Cash Flow, Multi-Currency position
│ └── settings.py # Business details, exchange rates registry, & AI setup
├── static/
│ ├── css/styles.css # Forest green & warm neutral responsive design system
│ └── js/
│ ├── app.js # Sidebar toggle, modals, and toast alerts
│ ├── invoices.js # Dynamic invoice line calculations
│ ├── charts.js # Zero-dependency responsive SVG bar chart
│ └── ai_assistant.js # Chat interface with suggestion chips
├── templates/ # Accessible, semantic Jinja2 templates
└── tests/ # 26 automated unit and integration tests (100% pass)
├── conftest.py
├── test_accounting.py
├── test_currency.py
├── test_invoices.py
├── test_inventory.py
├── test_documents.py
├── test_ai_service.py
├── test_pdf_and_exports.py
└── test_persistence.py
Automated Test Suite
ArthLedger comes with a 26-test automated suite covering financial calculations, security, and offline resilience:
python -m pytest -v
============================= 26 passed in 27.04s =============================
How I Built It
1. Technology Stack
- Backend: Python 3.12 with Flask.
-
Database: SQLite with Write-Ahead Logging (
WAL), strict foreign keys (PRAGMA foreign_keys = ON), parameterized queries, and an immutable audit trail. - Frontend: Vanilla HTML5, CSS3, and Vanilla JavaScript. No React, Next.js, or complex bundlers.
-
Visual Design: Forest green (
#1b4332,#2d6a4f) and emerald accents paired with warm neutral backgrounds (#f9f8f5) and crisp charcoal typography. -
Document Processing:
pypdffor local offline text extraction;reportlabfor generating A4 Tax Invoices and Financial Reports. -
Financial Arithmetic: Python
DecimalwithROUND_HALF_UPprecision to prevent binary floating-point discrepancies.
2. Local Open-Source AI Architecture
-
Model: Evaluated and tested with
smollm2:latest(1.7B parameters, Q8_0, Apache 2.0 license by Hugging Face) andqwen2.5:1.5b. -
Inference: Communicates locally via Ollama's HTTP API (
http://127.0.0.1:11434/api/generate). - Prompt Isolation & Security: Uploaded document text is treated strictly as untrusted user data enclosed in delimited text blocks, preventing prompt injection.
-
Controlled Assistant Queries: The AI model is never permitted to execute arbitrary SQL or directly mutate the database. Instead, user queries are routed through controlled, validated Python functions that pull verified data from SQLite, perform calculations with
Decimal, and ask the model to explain the results in clear business terms. - Graceful Offline Fallback: If Ollama is not installed or offline, the application automatically falls back to deterministic structured summaries and manual document entry without crashing or hanging.
Why Does Open Innovation Matter?
- Financial Privacy & Data Sovereignty: Small businesses handle sensitive data: supplier pricing, client billing, personal phone numbers, and profit margins. Open innovation allows small businesses to deploy AI locally on their own hardware, ensuring their data is never harvested to train closed commercial models.
-
True Affordability: Closed AI APIs charge on a per-token basis. For a small Indian retailer or freelance consultant, unpredictable API bills make AI inaccessible. Small open-weight models (
smollm2,qwen2.5) democratize intelligent software by running free of charge on everyday consumer PCs. - No Vendor Lock-In: Standardized local inference means the application is not married to any single proprietary provider. If a faster or more capable open-weight model is released, users can change the model name in Settings with zero code changes.
- Offline Resilience: In developing markets and regional hubs, internet connectivity can be intermittent. Open, self-contained software ensures that core accounting, invoicing, and inventory tracking never grind to a halt when the network drops.
My Agent Session
As a second-year IT engineering student, I built ArthLedger through pair programming with Google DeepMind's Antigravity AI Agent.
The project was constructed across 8 structured milestones:
- Foundation & Environment Verification: Inspected the workspace, verified Python 3.12 and Ollama, and configured an isolated database architecture.
-
Core Accounting Logic: Implemented
currency.pyandaccounting.pyusingDecimalarithmetic, avoiding floating-point rounding pitfalls and supporting Indian number grouping (12,34,567.89). - Multi-Currency System: Constructed an ISO 4217 currency registry and exchange-rate tracking table that preserves historical conversion rates across invoice creation and cross-currency payments.
- Professional UI System: Designed a forest green aesthetic with a collapsible sidebar, modal dialogs, status badges, and an SVG comparison chart.
-
Document Processing & ReportLab PDFs: Integrated
pypdffor text extraction and built A4 Tax Invoices and Financial Performance PDF generators. - Local AI Integration & Fallback: Connected Ollama for structured receipt parsing, added an editable review screen with Human-in-the-Loop confirmation, and built controlled query handlers for the conversational assistant.
- Inventory & Ledger Reporting: Implemented stock movements, reorder alerts, inventory valuation, cash flow statements, and accounts receivable aging schedules.
- Automated Testing & Data Zeroing: Authored 26 automated pytest tests verifying every financial rule, path traversal protection, and persistence across reconnects, concluding with a clean zeroed database ready for real-world use.
My First User
My first user is my maternal uncle, who runs a shop and manages its daily transactions. I shared an early build of ArthLedger with him to help simplify his shop's financial record-keeping.
The Challenge: He was managing his shop's daily sales, purchases, and other transactions manually, making it difficult to maintain organized financial records and track his business income and expenses efficiently. He needed a simple, reliable, and affordable solution to manage his shop's transactions in one place.
-
Their Feedback:
"ArthLedger makes it easier for me to record my shop's daily transactions and keep track of my income and expenses. Having all my financial records organized in one place saves time and makes managing my shop's accounts much simpler."
- Outcome: My maternal uncle started using ArthLedger to record and manage his shop's transactions. His experience as my first user helped me understand the practical needs of small shop owners and identify ways to make ArthLedger more useful, simple, and accessible for everyday business accounting.
Future Development
This is my first time developing and managing a project of this scale, and I have worked on ArthLedger within a limited time frame. Although the current version includes the core features, I understand that there is still room for improvement. As a student, I also need to balance my project work with my academic responsibilities.
ArthLedger is an ongoing project, not the final version. Whenever I get more time, I will continue improving the software, fixing bugs, adding useful features, and making it more reliable and user-friendly based on real-world feedback. My goal is to keep learning through this project and gradually develop ArthLedger into a more complete accounting solution for small businesses.
Prize Categories
- Hacktoberfest Open-Source AI Challenge — Week 2: Side Hustle
- Local AI & Edge Computing
- Privacy-First & Open-Source Developer Tools
Smart Accounting. Stronger Businesses. • Built with ❤️ for open-source innovation during Hacktoberfest 2026.
來源:DEV Community · dev.to