AI Product · Lead Engineer

SarYin: AI Finance Agent

An AI accounting agent for small businesses: type a sale or payment in Burmese or English, and it drafts the balanced double-entry journal for the accountant to approve. Then ask for your P&L or balance sheet.

Next.js 16TypeScriptVercel AI SDKSupabasePostgreSQLRow-level securityVitest

My role  Lead engineer: ledger, AI agent, reports, permissions

Overview

SarYin is an AI finance agent for small businesses in Myanmar. Instead of filling in debit and credit columns, the owner or accountant writes what happened the way they would say it, in Burmese, English or both: "ဒီနေ့ KBZ ကနေ ဆိုင်ခ ၅ သိန်း ပေးလိုက်တယ်", paid the shop rent from KBZ today, 5 lakh. SarYin finds the right accounts, drafts a balanced journal entry, and explains it. Nothing is posted until a person approves it.

On top of the same ledger it produces the reports an accountant needs: Profit & Loss with comparatives, Balance Sheet, Trial Balance, Cash & Bank, receivables aging per customer, and the journal. One owner can run several businesses on one shared chart of accounts.

How it helps an accountant

  • Less typing, same rigour. Plain-language input becomes a proper double-entry journal (debit, credit, accounts, party, date), and the accountant reviews and approves it.
  • Always balanced. A deferred database constraint rejects any entry with fewer than two lines or where debits do not equal credits, whatever the UI or the AI sends.
  • Audit-ready by design. Months can be locked; corrections are made with reversing entries, never by editing history; every change on eleven tables is written to an audit log with who, when, before and after.
  • Answers in seconds. Ask "how much does Nova Mobile still owe?" or "profit vs last month" and get the answer from the books, not a guess.
  • Right access for each person. Owner, Accountant and Viewer roles on a permissions table, enforced with row-level security on every table.

How the AI agent works

  • Each turn the model returns exactly one action: read, propose, answer or ask. There is no action that writes to the books.
  • A proposal may only use accounts, customers or invoice lines that a lookup returned in the same turn, so the model cannot invent an account.
  • Amounts are taken from what the user typed, not from the model's reading. Burmese amounts such as ၅ သိန်း (5 lakh) are parsed in code, and an ambiguous figure is refused instead of guessed.
  • The user confirms the proposal card; only then does the ledger service post the entry in one transaction.
  • The provider is configuration: a local model through Ollama, or OpenRouter, Google or OpenAI. The prompts are written to work on small local models, and an evaluation harness scores the agent against a set of real-world phrasings.

Engineering

  • Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS 4 and shadcn/ui; Zod for validation.
  • Supabase Postgres and Auth; 19 SQL migrations with triggers for balance checks, period locks and the audit log.
  • Vercel AI SDK with pluggable providers.
  • About 80 Vitest test files running against a real local Postgres in CI (GitHub Actions), including row-level security and permission tests, and a golden test that replays a full set of real books and checks the totals.
  • Chart of accounts import and export with Excel.

Stack

Next.js 16, React 19, TypeScript, Tailwind CSS 4, Vercel AI SDK, Supabase (Postgres, Auth, row-level security), Vitest, GitHub Actions, Vercel.

← Back to Projects