# How to Vibe Code Your Own FreeAgent (and Stop Paying for It)

> Accounting software for every small business

- Site: https://freeagent.com
- Category: Accounting & Finance SaaS
- Platforms: Web app, iOS app, Android app
- Verdict: **Don't bother** (12/100 vibecodeable)
- Estimated effort: 6+ months of full-time work

## Verdict

Keep paying for FreeAgent or switch to a commercial alternative; building a personal clone is a compliance nightmare.

While building a generic invoice generator and expense tracker as a weekend project is straightforward, replicating FreeAgent means implementing strict double-entry accounting rules, multi-currency ledgers, payroll tax algorithms, and legally mandated HMRC Making Tax Digital (MTD) OAuth API submissions. An AI coding agent will breeze through the Next.js UI scaffolding and SQLite database models, but it cannot legally certify or maintain HMRC tax gateway connections, nor can it guarantee your fiscal calculations comply with UK tax legislation. Unless your goal is an educational deep dive into accounting theory and government API cryptography, the effort is entirely disproportionate to the modest monthly subscription.

### What you can't replicate

- Official HMRC software recognition and automated digital tax compliance submissions
- Direct institutional Open Banking API agreements with high-street banks
- The NatWest/RBS distribution partnership and accountant practice network

## What it does

Cloud accounting, invoicing, expense tracking, and HMRC-recognised Making Tax Digital (MTD) tax compliance platform for freelancers and small businesses.

### Core features

- Double-entry bookkeeping engine with general ledger and trial balance
- Invoicing with custom branding, PDF generation, and payment links
- Bank feed ingestion via Open Banking APIs with smart transaction matching
- AI receipt scanning and data extraction (Smart Capture)
- HMRC Making Tax Digital (MTD) OAuth integration for VAT and Income Tax quarterly updates
- HMRC Real Time Information (RTI) payroll engine calculating PAYE, National Insurance, and pensions
- Project time tracking, expense recording, and cash flow forecasting
- Multi-currency transaction handling with daily exchange rate sync

## The business

### Pricing

- UK Limited Company: £33/mo — Standard monthly pricing for limited companies (excl. 20% VAT)
- UK Sole Trader: £19/mo — Standard monthly pricing for sole traders (excl. 20% VAT)

### Funding

£1M raised.
- Crowdfunding
- IPO (AIM Market, 2016)
Investors: NatWest Group (Acquired for ~£53M in 2018)

Founded 2007.
Team size: 200-300+.

## The hard parts

- Government compliance gateway integrations (HMRC MTD/RTI APIs require strict OAuth security, digital signatures, and continuous adaptation to changing tax laws)
- Double-entry ledger accuracy where ledger mutations must balance atomically with zero rounding errors across fiscal years
- Open Banking API integrations with multi-institution token persistence, background re-consent flows, and webhook reliability
- Complex payroll tax algorithms handling PAYE thresholds, student loan deductions, and pension auto-enrolment rules

## How to vibe code FreeAgent

### Prerequisites

- Node.js (free): Runtime for building the full-stack TypeScript web application.
- GitHub (free): Version control and CI/CD deployment pipeline.
- HMRC Developer Account (free): Required for sandbox and production access to Making Tax Digital and PAYE APIs.

### Recommended AI tools

- Claude Code: Best-in-class multi-file agentic coding tool for scaffolding complex relational database schemas and backend logic.
- Cursor: AI code editor for iterative frontend UI polish and accounting form components.

### Stack

- Frontend: Next.js with Tailwind CSS and shadcn/ui
- Backend: Next.js Server Actions and API Routes
- Database: Turso (SQLite at the edge)
- Auth: better-auth
- Payments: Stripe
- Other: Resend for transactional emails, OpenAI API for receipt text extraction

### Hosting

- Cloudflare (Hosting Next.js frontend and serverless API endpoints on the edge network): $0-5/mo
- Turso (Serverless SQLite database storage for double-entry ledger transactions): $0/mo

### Build guide

1. **Project Scaffolding and Database Schema** — Initialize the Next.js project with Tailwind CSS, configure Turso SQLite with Drizzle ORM, and set up better-auth for secure user authentication.

```
Create a new Next.js project with TypeScript, Tailwind CSS, and App Router. Set up Drizzle ORM configured for Turso SQLite. Define the foundational database schema for multi-tenant accounting: users, organizations, accounts (chart of accounts with types like asset, liability, income, expense, equity), journal_entries, and journal_lines. Ensure the sum of debit and credit lines equals zero on every journal entry transaction via application-layer validation and database constraints. Integrate better-auth for secure email/password and session management with multi-tenant organization switching.
```

2. **Double-Entry Ledger & Chart of Accounts Engine** — Build the core accounting engine capable of recording balanced journal entries and generating trial balances and profit & loss statements.

```
Build the double-entry bookkeeping ledger engine in Next.js server actions. Implement a robust transaction creation form where users can record bills, invoices, and manual journal entries. Write SQL aggregation queries and helper functions to dynamically generate a Trial Balance, Profit & Loss statement, and Balance Sheet for any selected fiscal year-end date range. Add unit tests verifying that unbalanced journal entries are rejected and account balances update accurately.
```

3. **Invoicing & Client Management Module** — Develop client management, itemized invoice creation, PDF rendering, and Stripe payment link integration.

```
Create an invoicing module in Next.js. Build CRUD views for clients, billable items, and branded invoices with line-item tax calculations (including standard 20% VAT). Implement a server-side PDF generator using react-pdf to export professional invoice documents. Add Stripe Checkout integration so that paying an invoice automatically posts a balancing debit to bank/cash and credit to accounts receivable in the double-entry ledger.
```

4. **Expense Tracking & AI Smart Capture** — Implement expense recording and an AI-powered receipt scanning feature using OpenAI Vision API.

```
Build an expense tracking interface supporting out-of-pocket expenses and bill uploads. Integrate the OpenAI API (or Anthropic API) to parse uploaded receipt images and extract vendor name, date, total amount, and VAT breakdown into structured JSON. Automatically map parsed data to the appropriate expense category in the chart of accounts and generate the corresponding journal entry.
```

5. **Open Banking Feed Simulator & Transaction Explanation** — Create bank account management, statement imports via CSV/OFX, and smart transaction explanation rules.

```
Develop a bank accounts module allowing users to connect and view bank balances. Implement CSV and OFX statement import parsers to ingest bank feeds. Build a transaction explanation workflow where raw bank statement lines can be matched and explained against existing invoices, bills, or out-of-pocket expenses, automatically posting the clearing journal entries to the ledger.
```

6. **HMRC Making Tax Digital (MTD) Integration Stub** — Build the HMRC MTD OAuth authentication flow and quarterly VAT return calculation engine.

```
Implement an HMRC Making Tax Digital (MTD) module. Set up the OAuth2 authorization code flow connecting to the HMRC Developer Hub sandbox environment. Build a VAT return calculator that queries ledger transactions for a 91-day taxable period, aggregates Box 1 through Box 9 figures according to UK VAT rules, and provides a structured JSON payload preview ready for submission to the HMRC VAT API.
```

### Cost vs paying

**Starting costs (one-time):**

- AI Coding Assistant (Claude Pro): $20
- Total: ~$20 one-time

**Ongoing costs (monthly):**

- Cloudflare & Turso Hobby Hosting: $0/mo
- Total: ~$0/mo

- Paying for the SaaS instead: £33/mo (~$42/mo)
- Build time: 120-160 hours
- AI tool credits: $20
- Break-even: Not viable (regulatory liability and maintenance burden outweigh cost)

## Sources

- [FreeAgent Official Website](https://freeagent.com)
- [NatWest Group Acquisition & Overview](https://www.natwest.com)