AI Bookkeeper & Tax Prep Platform
Self-hosted AI bookkeeping and tax prep starter scaffold for transaction categorization, receipt matching, deductible flagging, and CPA-ready period-end workpapers.
01. Problem & Context
Small businesses and finance operators spend weeks at month-end and tax season categorizing bank feeds, chasing missing receipts, flagging potential business deductions and 1099 vendor thresholds, and assembling auditable trial-balance workpapers for CPAs.
02. Engineering Solution
Initialized the Phase 3 self-hosted starter scaffold pairing a FastAPI + Pydantic v2 backend (`/api/v1/health{,/live,/ready}`, pure ASGI security-header middleware, fail-fast production secret validation) with a React 18 Vite/Tailwind workspace, PostgreSQL (`pgvector`) + Redis Compose stack, and GitHub Actions CI. Establishes the verified runtime baseline for planned `categorization/`, `receipts/`, `tax_rules/`, and `workpapers/` modules extending `ai-finance-ops`.
03. System Architecture
Verified starter runtime (`backend/app/main.py`, `core/config.py`, `core/middleware.py`, `api/v1/health.py`) paired with a React 18 TypeScript dashboard (`frontend/src/App.tsx`), Docker Compose (`postgres` pgvector, `redis`, `api`, `frontend`, `ollama` profile), and CI pipeline (`ruff`, `mypy`, `pytest`, `tsc`, `vitest`, `vite build`, `npm audit`, Trivy) ready for the four planned bookkeeping modules in `docs/ARCHITECTURE.md`.
Core Architectural Components
Verified Starter API, Security Baseline & UI Shell (`/api/v1/health*`)
Shipped FastAPI application with versioned `/api/v1/health`, `/live`, and `/ready` probes, ASGI security-header injection (`X-Request-ID`, `nosniff`, `DENY`), fail-fast `validate_production_security()`, offline `mock`/Ollama/Gemini routing settings, and React 18 live health console.
Planned Domain Module: Transaction Categorization (`categorization/`)
Blueprint for bank/card ledger ingestion, deterministic vendor-rule matching, Chart-of-Accounts classification with confidence thresholds, and split-transaction support.
Planned Domain Module: Receipt & Bank Matching (`receipts/`)
Blueprint for OCR receipt field extraction matched deterministically and fuzzily to ledger lines with automated missing-receipt reminders.
Planned Domain Modules: Tax Rules & Workpapers (`tax_rules/`, `workpapers/`)
Blueprint for deductibility classification, 1099 vendor threshold tracking, trial-balance tie-outs, and immutable SHA-256 CPA workpaper packs behind human sign-off.
04. Notable Engineering Decisions
Human & CPA Sign-Off Gates on Ledger Entries and Tax Flags
Accounting classifications and deductibility flags carry regulatory and tax consequences, so automated proposals require explicit review states and immutable audit trails.
Privacy-First Financial Data Handling with Local Ollama & PII Redaction
Bank statements, vendor TINs, and receipts contain sensitive financial PII; local Ollama routing and `LLM_REDACT_PII_FOR_CLOUD=true` keep sensitive ledger data self-hosted.
Focused Bookkeeping & Tax Prep Extension to `ai-finance-ops`
Separating daily transaction categorization, receipt matching, 1099 tracking, and CPA workpapers from `ai-finance-ops` (3-way PO/GR/invoice reconciliation & 13-week cash modeling) keeps both codebases modular.
05. Engineering Challenges & Solutions
Challenge: Ensuring financial starter infrastructure refuses unsafe defaults before handling real ledger imports.
Engineering Solution: Built fail-fast production secret and CORS validation, pure ASGI security headers, non-root containers, and automated `ruff`/`mypy`/`pytest`/`vitest` CI verification.
Challenge: Balancing deterministic Chart-of-Accounts rules with ambiguous merchant descriptions.
Engineering Solution: Structured the planned `categorization/` and `tax_rules/` modules to apply deterministic vendor rules and threshold checks first before falling back to confidence-scored LLM suggestions.
06. Implementation Highlights
- Verified FastAPI starter with `/api/v1/health`, `/live`, and `/ready` probes plus fail-fast `APP_ENV=production` secret and CORS validation
- Pure ASGI `SecurityHeadersMiddleware` injecting `X-Request-ID`, `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, and production HSTS
- React 18 + TypeScript + Vite + Tailwind starter dashboard with live `/api/v1/health` status check and Vitest + Testing Library unit tests
- PostgreSQL (`pgvector`) + Redis + optional Ollama Docker Compose stack with non-root API and unprivileged Nginx containers
- Documented Phase 3 `docs/ARCHITECTURE.md` blueprint for `categorization/`, `receipts/`, `tax_rules/`, and `workpapers/` modules behind GitHub Actions CI