EthiBooks

A multi-tenant, multi-currency cloud accounting SaaS built for freelancers, SMBs, and growing businesses worldwide. Complete double-entry bookkeeping with localized tax compliance, invoice branding, Stripe-powered payment collection, and auditor-ready exports.

Multi-Currency Double-Entry AI Smart Scan Inventory + FIFO/LIFO Light Manufacturing GST / VAT / Sales Tax Stripe Connect Credit & Debit Notes Tally · Xero · QuickBooks · Sage Plugins & Integrations Multi-Tenant

01 Multi-Currency Double-Entry Accounting

Pain Point: Most small-business tools force a single currency or lose precision in FX conversions, causing ledger imbalances.
Solution: Dual-value ledger pattern with 6-decimal internal precision and automated FX gain/loss accounting.
  • Dual-Value Ledger: Every invoice, bill, and expense stores both the foreign currency amount and the base currency equivalent.
  • 6-Decimal Precision: All GL calculations use 0.000001 tolerance. Display rounds to 2 decimals via roundForDisplay().
  • Daily Cached Exchange Rates: Rates fetched from ExchangeRate-API, cached in exchange_rates table. One fetch per currency pair per day.
  • Rate Locking: Rates lock when documents transition to Pending status. Tracked via rate_locked_at and rate_manually_set.
  • Manual Rate Overrides: Users can override auto-fetched rates with full audit tracking.
  • Automated FX Gain/Loss: Realized gains/losses posted to GL 4300 (Gain) / 8500 (Loss) when payment rate differs from document rate.
  • Self-Healing Integrity: Database triggers and backfill functions ensure no transaction ever has NULL rates or missing base currency amounts.

Journal Entry — Multi-Currency Invoice Payment

Debit:  Cash/Bank          (base currency net amount)
Debit:  FX Loss 8500       (if unfavorable rate movement)
   OR
Credit: FX Gain 4300       (if favorable rate movement)
Credit: Accounts Receivable (base currency invoice amount)

02 Chart of Accounts & Auto-Seeding

Pain Point: New businesses don't know how to set up a proper chart of accounts. Manual setup is error-prone.
  • Hierarchical Structure: account_categoriesaccount_groupsaccounts with parent-child sub-accounts.
  • Auto-Seeded on Creation: Standard COA provisioned automatically with proper account types (Asset, Liability, Equity, Revenue, Expense).
  • System Accounts: Critical accounts (A/R, A/P, Sales Revenue, Sales Tax Payable) marked is_system_account and cannot be deleted.
  • Account Mappings: Logical roles (sales_revenue, sales_tax_payable, purchase_tax_input, sales_discount, default_expense, default_bank) mapped to GL accounts for automated journal entries.
  • Opening Balances: Dedicated onboarding step with entity locks preventing currency changes after balances exist.

03 Universal Tax Engine

Pain Point: Tax rules vary drastically by country (GST in India, VAT in UK, Sales Tax in US). Most tools are hardcoded for one region.

Three-Layer Architecture

Tax Components

Individual rates like CGST 9%, SGST 9%, VAT 20%

Tax Groups

Combinations: "GST 18%" = CGST 9% + SGST 9%

Supply Rules

Domestic, interstate, export, reverse charge scenarios

Behavior Classes

Standard, Reverse Charge, Zero-Rated

Country-Based Auto-Seeding

CountryTax Structure
🇮🇳 IndiaCGST, SGST, IGST at 0/5/12/18/28% + Reverse Charge + Export Zero-Rated
🇬🇧 United KingdomVAT Standard 20%, Reduced 5%, Zero-Rated, Reverse Charge
🇺🇸 United StatesState-level Sales Tax
🇦🇺 AustraliaGST 10%
🇦🇪 UAEVAT 5%

Additional Tax Features

  • Tax-Inclusive/Exclusive Pricing: Hierarchical default: Global → Client → Document. Reverse formula Total / (1 + Rate) for inclusive.
  • Tax After Discount: Sequence: Subtotal → Discount → Net → Tax → Total. Journal splits gross sales vs discount for P&L transparency.
  • Country-Specific Terminology: Dynamic labels — GSTIN (India), ABN (Australia), VAT Number (UK), EIN (US).
  • Tax Code Support: HSN/SAC (India), Commodity Codes (EU), HS Codes (US/AU/CA).

04 Bank Reconciliation

Pain Point: Matching book balances to bank statements is manual and error-prone.
  • Account-Level Reconciliation: Select any bank/cash account and reconcile against a statement.
  • Statement Import: Enter statement balance and date; system calculates difference.
  • Transaction Matching: Mark individual transactions as reconciled.
  • Difference Tracking: Shows opening balance, closing balance, statement balance, and outstanding difference.

05 Invoicing System

Pain Point: Creating professional invoices, tracking payments, and handling partial payments across currencies is complex.
  • Full Lifecycle: Draft → Pending → Paid / Overdue / Void
  • Line-Item Tax Breakdown: Each item has its own Tax Group; breakdown stored as JSON and aggregated in summary.
  • Multi-Currency: Currency auto-set from client; exchange rates locked at Pending.
  • Estimates/Quotations: One-click conversion to invoices preserving all line items.
  • Recurring Invoices: Template-based with configurable frequency, interval, day, max count, and end date.
  • Public Invoice Link: Shareable URL with token-based access; view tracking logs IP and timestamp.
  • Email Delivery: Send invoices and payment receipts directly via React-rendered email templates.

06 Invoice Branding & PDF Templates

Pain Point: Generic invoices look unprofessional. Businesses need branded documents.

4 Templates

Standard, Professional, Modern, Minimal — selectable in settings.

Company Branding

Logo upload, brand color, business name, address, tax IDs.

Text-Based PDFs

jsPDF for crisp, professional-quality text rendering (not screenshots).

Template-Aware

Downloaded PDFs dynamically apply the selected template's design.

Smart Branding Logic

  • Business Trade Name Priority: PDFs display the Business/Trade Name when available, falling back to the legal company name — ensuring invoices match the brand your clients recognise.
  • Globalized Tax Labels: Tax ID fields on PDFs use country-specific terminology (e.g. GSTIN for India, VAT Number for UK, ABN for Australia, EIN for US) instead of generic labels.

07 Recording Payments & Collections

Pain Point: Tracking partial payments, multiple methods, and multi-currency settlements is tedious.

Manual Invoice Payments

  • Partial Payments: Multiple payments per invoice; status auto-updates to Paid when fully settled.
  • Payment Methods: Bank Transfer, Cash, Check, Credit Card, Online, Other.
  • Account Selection: Choose deposit account (defaults to Checking Account 1010).
  • Multi-Currency: Separate payment exchange rate; FX gain/loss auto-calculated.
  • Voiding: Full reversal journal entries via void_invoice_payment RPC.

Stripe Online Payments (Pay Now)

Standard Payouts

Platform collects via EthiBooks' Stripe account, settles to tenant later.

Direct Payouts

Tenant connects their own Stripe account for direct deposits.

  • Dual Environment: Test and Live Stripe modes for safe testing before going live.
  • Customer Pays Exact Amount: No fee markup. Stripe fees (2.9% + 30¢) deducted from tenant's share.
  • Webhook Idempotency: Prevents duplicate records from Stripe retries.

Automated 3-Line Journal Entry

Debit:  Cash/Bank               (net amount after Stripe fee)
Debit:  Payment Processing Fee   (Stripe fee from balance_transaction)
Credit: Accounts Receivable      (full invoice amount)

08 Bills & Bill Payments

Pain Point: Managing vendor bills, tracking what's owed, and recording payments with proper accounting entries.
  • Full Lifecycle: Draft → Pending → Paid / Overdue / Void
  • Line-Item Detail: Description, quantity, price, expense category, expense account, tax group per item.
  • Multi-Currency: Currency from vendor profile; dual-value ledger with base currency equivalents.
  • Bill Payments: Record with method, reference, pay-from account, notes. FX gain/loss auto-calculated.
  • PO Integration: Approved POs convert to bills with pre-filled line items.
  • Recurring Bills: Template-based schedule, auto-generated via edge function.
  • Smart Scan Pre-Fill: AI-extracted data from scanned documents auto-populates vendor, dates, bill number, currency, and line items. Missing vendors and items are auto-created.

09 Purchase Orders

Pain Point: No visibility into vendor commitments before bills arrive.
  • Lifecycle: Draft → Approved → Received → Cancelled
  • Convert to Bill: One-click with line item preservation and purchase_order_id link.
  • Optional Workflow: Bills can be created directly without a PO.
  • PO vs Bills Report: Compare commitments against actual bills received.

10 Expense Management

Pain Point: Tracking spending, categorizing expenses, and identifying billable costs for re-invoicing.
  • Line-Item Expenses: Multiple items per expense with individual amounts.
  • Multi-Currency: Currency code, exchange rate, and base currency at header and line-item levels.
  • Billable Tracking: Mark as billable, assign to client, track invoiced status.
  • Account Mapping: Each expense maps to a specific GL expense account.
  • Void Support: Expenses can be voided with proper reversals.
  • Smart Scan Pre-Fill: Scan a receipt to auto-populate vendor, date, amount, currency, category, and payment method. Missing master data is created automatically.

10b AI Smart Scan (Document Scanner)

Pain Point: Manual data entry from receipts, invoices, and bills is slow, error-prone, and tedious — especially when items don't yet exist in the system.
Solution: AI-powered document analysis using the Lovable AI Gateway (Gemini). Upload or photograph a document and the system extracts structured data, auto-creates missing master records, and pre-fills the expense or bill form.

How It Works

Upload or Capture

Drag-and-drop, file picker, or camera capture. Supports JPG, PNG, WEBP, and PDF up to 10 MB.

AI Extraction

Edge function (analyze-document) sends the image to Gemini via tool-calling for structured JSON output.

Data Preview

Review extracted vendor, date, currency, amounts, tax, line items, and suggested category before proceeding.

Auto-Create & Pre-Fill

Missing categories, items, and vendors are created automatically. Form fields populate with actual DB references.

Extracted Fields

FieldDetails
Vendor NameMatched case-insensitively to existing vendors; new vendor created if unmatched.
Date / Due DateParsed from document text.
Currency & TotalISO currency code + total amount.
Tax AmountSeparated from subtotal when visible.
Invoice / Bill NumberReference number for cross-matching.
Line ItemsDescription, quantity, unit price, amount, tax per line.
Category SuggestionAI-suggested expense category; auto-created if new.
Payment MethodDetected from receipt (e.g., "Credit Card", "Cash").

Auto-Creation Logic

  • Categories: If category_suggestion doesn't match any existing category (case-insensitive), a new one is inserted into categories.
  • Master Items: Each line item description is matched against master_items. Unmatched items are created as type expense with the extracted unit price, linked to the auto-created category.
  • Vendors: Vendor name matched against vendors. Unmatched vendors are created with the document's currency.
  • Summary Toast: Users see a notification like "Auto-created 3 items, 1 category, 1 vendor from scan".

Security & Storage

  • Scanned Documents Bucket: Uploaded files stored in scanned-documents Supabase Storage bucket with RLS (company-scoped).
  • Rate Limiting: Edge function returns 429 when AI quota is exceeded; 402 when credits are depleted.
  • No External API Keys: Uses Lovable AI Gateway — no tenant-managed keys required.

10c Inventory Core & Costing Engine

Pain Point: Most SMB tools either ignore inventory entirely or treat it as a flat quantity counter — no real costing, no GL impact, no audit trail.
Solution: Full perpetual inventory engine with FIFO, LIFO, and Weighted Average costing methods, automatic COGS posting on every sale, and self-balancing GL entries.
  • Stock Movement Engine: Single RPC post_inventory_movement handles all in/out flows from invoices, bills, adjustments, transfers, and manufacturing — guaranteeing one source of truth.
  • Costing Methods: Per-item selection of FIFO, LIFO, or Weighted Average. FIFO/LIFO maintain layered inventory_cost_layers; weighted average updates on every receipt.
  • Automatic COGS: Every sale debits COGS and credits Inventory at actual layer cost. consume_cost_layers RPC enforces FIFO/LIFO order strictly.
  • Inline Landed Costs: Add freight, duty, and clearing costs directly on bills — distributed across line items by value or quantity. Posted via post_landed_cost_voucher RPC against the landed_cost_clearing account.
  • Inventory Revaluation: Periodic write-up/write-down via dedicated RPC, posting variances to revaluation gain/loss accounts.
  • Negative Stock Control: Per-company toggle allow_negative_stock blocks oversells when disabled.
  • Reorder Alerts: Per-item reorder level + low-stock dashboard widget for proactive replenishment.

10d Multi-Warehouse, Batches & Serials

Pain Point: Regulated industries (pharma, electronics, food) need batch/expiry tracking and serial-number traceability — usually requiring expensive ERP add-ons.
  • Multi-Warehouse: Unlimited warehouses with per-warehouse stock balances and movements.
  • Storage Locations: Hierarchical bins/zones inside each warehouse for granular put-away.
  • Stock Transfers: Inter-warehouse movement with full ledger tracking.
  • Batches: inventory_batches table tracks batch number, manufacture date, expiry date, and per-batch unit cost.
  • Serial Numbers: inventory_serials table tracks individual serial-number lifecycle (in stock, sold, returned, scrapped).
  • Strict Enforcement: post_inventory_movement raises an error if an item requires batch or serial tracking and the picker is empty.
  • Wired Everywhere: Traceability picker integrated into Invoice, Bill, PO Receive, and Stock Adjustment flows.
  • Near-Expiry Alerts: Dashboard widget surfaces batches approaching expiry within a 90-day horizon.

10e Inventory Intelligence & Reporting

ReportWhat It Shows
Stock on HandReal-time quantities by warehouse with valuation at current cost.
Inventory ValuationAs-of-date snapshot; auto per-item costing using cost layers (FIFO/LIFO) or weighted average. Warehouse + category breakdowns.
Movements / HistoryFull audit trail of every in/out movement with source document linkback.
Slow / Fast MovingUser-selectable window (30/60/90/180/365 days). Fast / Medium / Slow / Dead classification with dead-stock value-at-risk.
ABC AnalysisPareto classification by consumption value (A=80%, B=15%, C=5%) with cumulative contribution.
Reorder AlertsItems at or below reorder level with preferred vendor surfaced.

Dashboard widgets: Inventory Value, Top Moving Items (30-day), Near-Expiry Batches, and Low-Stock Alerts.

10f Bill of Materials & Light Manufacturing

Pain Point: Assembly businesses need to consume raw materials and produce finished goods at correct cost — without buying a full ERP.
  • BOM Definition: boms + bom_components tables. Define a parent finished-good item, output quantity, and the component items + quantities required.
  • Manufacturing Orders: Issue an MO that consumes raw-material stock (debit WIP, credit Inventory) and produces finished goods (debit Inventory, credit WIP) at rolled-up component cost.
  • Cost Roll-Up: Finished-good cost computed dynamically from current weighted-average / FIFO cost of components.
  • Multi-Level BOMs: Sub-assemblies supported — components can themselves have BOMs.

10g Stock Cycle Counts

Pain Point: System quantities drift from physical reality — without periodic counts, valuations and reorder logic become unreliable.
  • Count Sheets: Generate count documents per warehouse, optionally filtered by category or item subset.
  • Variance Detection: Side-by-side system quantity vs counted quantity with auto-calculated variance and value-at-risk.
  • Manual Adjustment Posting: Approve a cycle count to generate a corresponding stock adjustment with proper GL postings (Inventory Shrinkage / Surplus accounts).
  • Audit Trail: Counts retain who counted, when, and what was found.

10h Vendor Catalog & Multi-UOM

Pain Point: Different vendors quote different prices and lead times for the same item; purchases often happen in cases or cartons while stock is held in eaches.
  • Vendor Catalog: Per vendor + item record with negotiated price, currency, lead time (days), and a "preferred vendor" flag.
  • Auto-Pricing on Bills: Selecting a vendor on a bill auto-suggests the catalog price for each item, eliminating retyping.
  • Multi-UOM Conversion: Items can have a separate Purchase UOM and Stocking UOM with a conversion factor (purchase_uom_factor).
  • Bill Entry in Purchase UOM: Enter "5 cases" — system stores 60 eaches in stock automatically.
  • Preferred Vendor on Reorder: Low-stock alerts surface the preferred vendor for one-click PO drafts (planned).

10i Credit & Debit Notes

Pain Point: Returns, disputes, and pricing adjustments need formal documents that update both the customer/vendor balance and the GL — informal "fixes" break audit trails.
  • Credit Notes (Sales): Issue against an invoice or as a stand-alone customer credit. Reduces A/R, reverses sales revenue and output tax, and optionally restocks inventory.
  • Debit Notes (Purchase): Issue against a bill or as a stand-alone vendor debit. Reduces A/P, reverses expense / inventory and input tax.
  • Application to Documents: Apply outstanding credits to future invoices/bills via credit_note_applications and debit_note_applications tables.
  • Multi-Currency: Same dual-value ledger pattern — base currency amounts auto-calculated.
  • Public Share + PDF: Same template engine as invoices for branded credit/debit note PDFs.

10j Statement of Account

Pain Point: Customers periodically ask "what do I owe and what have I paid?" — assembling that from raw invoices is tedious.
  • Per-Client Ledger: Chronological view of invoices, payments, credit notes, and applications over a selected date range.
  • Opening + Closing Balance: Running balance with brought-forward opening balance.
  • Branded PDF + Email: Send the statement directly to the customer using the active invoice template's branding.
  • Aging View: Optional aging buckets (Current / 1-30 / 31-60 / 61-90 / 90+) inline.

10k Document Attachments

Pain Point: Auditors and finance teams need source documents (signed contracts, receipts, vendor invoices) attached to the transaction record — not lost in email threads.
  • Polymorphic Attachments: Single document_attachments table linked by entity_type + entity_id — supports Invoices, Bills, Expenses, and more.
  • Storage: Files stored in a private Supabase Storage bucket with company-scoped RLS.
  • Multi-File Support: Attach unlimited files per transaction with type, size, and uploader metadata.
  • In-App Preview: View image/PDF previews inline on the transaction detail screen.

11 Financial Reports

Pain Point: Business owners need real-time financial visibility without hiring an accountant.
ReportDescription
Profit & LossRevenue minus expenses. Credits − Debits for income. Handles reversals correctly.
Balance SheetAssets, Liabilities, Equity snapshot at a point in time.
Trial BalanceAll account balances — verify debits = credits.
General LedgerComplete transaction history per account in base currency.
Cash FlowCash inflows and outflows by period.
Aged ReceivablesOutstanding invoices by aging buckets (Current, 1-30, 31-60, 61-90, 90+).
Aged PayablesOutstanding bills by aging buckets.
Sales Tax ReportRegional compliance: India GST, UK VAT, US Sales Tax. Drill-down sheet.
Expenses by CategorySpending breakdown by category.
Purchases by VendorSpending breakdown by vendor.
Billable ExpensesUn-invoiced billable expenses by client.
PO vs BillsPurchase order commitments vs actual bills.
Audit TrailComplete history of all financial changes.
Ledger Integrity AuditSelf-service audit checking all transactions for balance integrity, rounding issues, and missing exchange rates. Health dashboard with CSV export.

12 Accounting Software Exports

Pain Point: Businesses need to share data with external accountants using different software. Manual re-entry is costly.
SoftwareFormatNotes
QuickBooks OnlineCSVStandard column mapping
QuickBooks DesktopIIFTransaction headers and splits
XeroCSVXero-compatible column structure
Tally PrimeXMLFull XML envelope with voucher formatting
SageCSV / QIFSage-compatible data structure

Reusable ExportDropdown component available on all report pages with specialized formatters in src/lib/exports/.

12b Customer Credits Report

Pain Point: Unapplied customer overpayments and unused credit notes silently accumulate — customers expect refunds or applications you've forgotten about.
  • Unapplied Balances: /reports/customer-credits aggregates customer credit-note balances and overpayment surpluses by client.
  • Drill-Down: Click a client to see contributing credit notes and payments.
  • Multi-Currency: Balances shown in client currency with base-currency totals.
  • Action Hooks: Apply credits to outstanding invoices directly from the report.

12c Plugins & Integrations Hub

Pain Point: Accounting is rarely the only system in use — businesses need to extend EthiBooks toward CRM, marketing, productivity, and storage tools without bloating the core product.
Solution: Per-company plugin registry (plugins + company_plugins tables) that lets tenants enable/disable optional integrations and hold per-tenant configuration.
  • Tenant-Scoped Enablement: Each company toggles plugins independently and stores their own credentials/config in company_plugins.config.
  • Catalog UI: Browse available integrations with status (Enabled / Available / Coming Soon) and quick-configure dialogs.
  • Designed for Productivity Partners: Foundation for CRM sync, calendar, document storage, e-signature, and country-specific compliance portals.

13 Subscription & Billing

Pain Point: Monetization with flexible tiers and promotional launch discounts.
  • Tiered Plans: Free, Growth, Professional, Enterprise with feature gating.
  • Feature Limits: Free tier caps on invoices, clients, vendors, items, expenses. Paid = unlimited.
  • PlanLimitsCheck: Wraps all "Create" buttons; shows UpgradeDialog when limits reached.
  • Stripe Checkout: Sessions for paid plans + customer portal for self-service.
  • Emotional Pricing: IP-based currency detection with psychological rounding (₹2,499 / $24.99). Billing in USD.

Soft-Launch Promo System

  • Promo Codes: promotions + promotion_redemptions tables. 1-100% discounts.
  • 100% Discount: Bypasses Stripe entirely via apply-free-subscription edge function.
  • Partial Discounts: Dynamic Stripe coupon creation at checkout.
  • Pre-seeded: LAUNCH100 code for all plans.

14 Multi-Tenant Architecture

Pain Point: Users operating multiple businesses need complete data isolation from one account.
  • Company Switching: Create multiple companies and switch between them.
  • Data Isolation: All tables scoped by company_id with RLS policies.
  • Per-Company Settings: Separate currency, country, tax config, COA, fiscal year per company.
  • Entity Locks: Country locks after creation. Currency locks after first transaction. Fiscal year changes apply to future periods only.

15 Guided 7-Step Onboarding

Pain Point: New users abandon accounting software because initial setup is overwhelming.
StepDescription
1. Company InfoName, type (Individual/Company), country, currency
2. Invoice SettingsPrefix, template, payment terms
3. Tax SettingsAuto-seeded from country; configurable rates and accounts
4. Chart of AccountsReview auto-seeded COA
5. Accounting PreferencesFiscal year, number formats
6. Opening BalancesEnter starting balances
7. CompleteCelebration modal → Dashboard

Sequential enforcement — no skipping. Dashboard shows persistent reminder (dismissable 3x) until complete.

16 User & Role Management

  • User Invitation: Invite team members by email with assigned roles.
  • Custom Roles: Granular permission matrices covering all modules.
  • Permission Matrix: Per-module CRUD (View, Create, Edit, Delete) for every feature area.
  • Role Duplication: Clone existing roles as starting points.
  • Super Admin: Platform-level admin with full cross-tenant access.

17 Admin Dashboard (Platform Level)

Global Overview

Total tenants, active subscriptions, revenue metrics.

Business Intelligence

Feature usage analytics, churn tracking, health scores.

Tenant Drilldown

Deep-dive into individual tenant activity.

Platform Revenue

Subscription revenue tracking and analytics.

18 Notifications

  • In-App: Bell icon with unread count and notification list.
  • Configurable Preferences: Users control which notifications they receive.
  • Auto-Reminders: Configurable invoice payment reminders.
  • Auto-Receipts: Automatic payment receipt generation and delivery.

19 Country-Specific Localization

FeatureImplementation
Tax TerminologyGSTIN (India), ABN (Australia), VAT (UK), EIN (US)
Tax CodesHSN/SAC (India), Commodity Code (EU), HS Code (US/AU)
Company TypesIndividual vs Company with conditional tax field visibility
Fiscal Year DefaultsCountry-based: Apr-Mar (India), Jul-Jun (Australia), Jan-Dec (US)
Currency DefaultsNew entities inherit host company's country and currency
Invoice LabelsCompany and client tax IDs use country-specific terminology on invoices

21 Technical Architecture

Frontend
React 18 + TypeScript
Build Tool
Vite
Styling
Tailwind CSS
UI Components
shadcn/ui + Radix
State
TanStack Query + Zustand
Backend
Supabase (PostgreSQL)
Edge Functions
Deno Runtime
Auth
Supabase Auth
Payments
Stripe Connect
PDF
jsPDF
Charts
Recharts
Exports
xlsx + Custom Formatters