Build Invoice Ninja

YESreplaces $14/mosaves $168/yrback to the verdict

0%0 of 24 items done

Saved on this device only. Tick prerequisites first, then work the phases in order · do not start one until the checks above it pass.

A small invoicing app for one freelancer: clients, invoices with line items and tax, numbers that never repeat, a snapshot frozen at send time so a sent invoice can never silently change, a clean PDF, email delivery, optional Stripe payment links, and a CSV your accountant can use. If you want the whole platform, Invoice Ninja itself is open source; this is the lighter option.

estimated effort weekendthe files for this build are in the project pack

RuntimeNode 22 with Express and better-sqlite3MoneyInteger centsPDFPuppeteer rendering an HTML templateHostinglocalhost, or a VPS behind Caddy

Before step 1

Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.

  1. installfree

    Why Everything in this build runs on it: the server, the scripts, the tests.

    Get it Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards. open ↗

    Verify node --version prints v22 or higher

  2. installfree

    Why Every step below is a command you type or a file you edit.

    Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗

    Verify You can open a folder and run a command in its terminal

  3. installfree

    Why History for your code, and the way most hosts deploy.

    Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗

    Verify git --version prints a version

  4. have readyfree

    Why Every PDF carries them: legal name, address, tax id if any, bank or payment details, payment terms, and a logo file.

    Get it Write them into config/business.json; a PNG or SVG logo at least 400px wide.

  5. installfree, 170 MB of disk

    Why PDF rendering needs a browser. npm install puppeteer downloads it; on a small server you may need extra system libraries.

    Get it npm install puppeteer downloads Chromium. On Ubuntu servers install the libraries Puppeteer's troubleshooting page lists. open ↗

    Verify node -e "require('puppeteer').launch().then(b=>b.close())" exits without error

  6. API keyfree tiers exist

    Why Phase 5 emails the PDF to clients.

    Get it Fastmail, Postmark or your mail host: host, port, user, password as an app password.

  7. API keyfree; fees per payment

    Why Phase 6 puts a pay-online link on each invoice.

    Get it dashboard.stripe.com > Developers > API keys. Use test mode until the flow works. open ↗

  8. decidefree

    Why This app does arithmetic on rates you type in; it does not know your jurisdiction. Decide the rates and the invoice number format now.

    Get it Write down the VAT or sales tax rates you charge and the prefix format, e.g. INV-2026-001.

Data model

Create these before the first phase that stores anything. Changing a table later is the expensive kind of change.

- `clients`: id, name, email, address, currency, default_rate_cents, notes
- `invoices`: id, number (unique), client_id, issue_date, due_date, currency,
  status ('draft' | 'sent' | 'paid' | 'void'), notes, terms, sent_at, paid_at,
  stripe_link, snapshot (JSON)
- `line_items`: id, invoice_id, position, description, quantity, unit_price_cents,
  tax_rate

`snapshot` is not optional. When an invoice is sent it must freeze the client's
name, address and every line as they were at that moment. Editing a client's
address must never change what a sent invoice says · that is a document you gave
someone, and silently rewriting history is the bug that ends in a dispute.

Environment variables

These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.

VariableNeededExampleWhere the value comes from
PORTrequired4840Bound to 127.0.0.1.
DATABASE_PATHrequired./data/invoices.dbSQLite file.
PDF_DIRrequired./data/pdfGenerated PDFs, kept forever.
SMTP_URLsecretrequiredsmtps://user:pass@smtp.fastmail.com:465From your SMTP provider.
MAIL_FROMrequired'You' <billing@yourdomain.com>From address on invoice emails.
STRIPE_SECRET_KEYsecretoptionalsk_test_...Stripe dashboard, test mode first. Empty disables payment links.
INVOICE_PREFIXrequiredINVPrefix for numbers: INV-2026-001.

The build, in order

  1. Clients

    Clients with currency and rate, and a delete that refuses to orphan invoices.

    1. clients (id, name, email, address, currency, default_rate_cents, notes), invoices (id, number unique, client_id, issue_date, due_date, currency, status, notes, terms, sent_at, paid_at, stripe_link, snapshot JSON), line_items (id, invoice_id, position, description, quantity, unit_price_cents, tax_rate).

      terminal
      mkdir invoices && cd invoices && git init && npm init -y && npm pkg set type=module
      npm install express@4 better-sqlite3@13
      mkdir -p data/pdf config && cp .env.example .env
    done when · tick each as it passes
  2. Invoices and line items

    Totals to the cent and numbers that never collide or reuse.

    1. Subtotal, tax and total in integer cents, rounding once at the end.

    2. INV-2026-001 style, never reused after a delete; gaps are fine, duplicates are not.

    done when · tick each as it passes
  3. Status and the snapshot

    Sending freezes the document; editing after requires a revision.

    1. Copy the client's name, address and every line into snapshot; render sent invoices from it only.

    2. The only way to change a sent invoice.

    done when · tick each as it passes
  4. PDF

    A clean one-page PDF from your template, byte-identical when regenerated.

    1. Logo, business details, line table, totals, terms and payment details from config/business.json.

      Files templates/invoice.html

      terminal
      npm install puppeteer@23
    2. Reuse one browser instance; close pages in finally.

    done when · tick each as it passes
  5. Email

    Sent means sent; failure leaves it a draft with the error visible.

    1. terminal
      npm install nodemailer@6
    done when · tick each as it passes
  6. Payment links

    A Stripe link per invoice, paid marked by hand.

    1. terminal
      npm install stripe@17
    done when · tick each as it passes
  7. Dashboard and books

    What is unpaid, and an export your accountant can use.

    1. The export is what makes this handover-able to an accountant.

    done when · tick each as it passes
  8. Backup and deploy

    Database and PDFs backed up together, one restore performed.

    1. terminal
      tar czf backups/invoices-$(date +%F).tgz data/
    2. The numbering rule, where PDFs live, and the tax disclaimer in plain language.

      Files README.md

    done when · tick each as it passes
what this build does not replace
after v1, if you want it

Need the files? The project pack on the verdict page hands your agent the whole brief · more finance & accounting.