A small, self-hosted tool for estimates and invoices. A team signs in, writes estimates, gets them approved, converts them to invoices, records payments, and prints any of it to a polished PDF.
It is one Node.js process and one PostgreSQL database: the server provides the API and also serves the web app, so there is a single thing to deploy.
- Users and roles: admins, members and viewers, each signing in with their own password. See Users, roles and sign-in.
- Approval: every estimate and invoice is a draft until it is submitted and an admin approves it. See Document workflow.
- Activity history: each document has an Activity tab listing who created, edited, submitted, approved, rejected or reopened it, and when, with the reason where one was given.
- Customers: a list you pick from, each with its own currency and country. A new customer can be added from inside an estimate or invoice without leaving it.
- Items: a catalogue of reusable line items. Typing an item's name on a line fills in its description and rate, which can then be edited for that document.
- Estimates → invoices: an approved estimate converts to an invoice through the invoice form, so the terms, lines and dates can be adjusted before it is saved. The conversion copies the line items, so the two documents never share rows.
- Payments: record payments against an approved invoice, with the mode, reference and any bank charges. The balance due updates, and the invoice becomes Paid when it reaches zero. Every payment gets a running number and is listed under Payments received. Up to five files of 15 MB each (a remittance advice, a bank slip) can be attached to a payment; they are stored in the database.
- Reference, project and subject: optional fields on every estimate and invoice. Converting an estimate carries the project and subject over and sets the invoice's reference to the estimate number unless the estimate had its own.
- Status ribbon: each estimate and invoice shows its status across its top-left corner on screen. The ribbon never prints.
- Home: what is owed on approved invoices, split into current and overdue and kept separate per currency; a chart of what was invoiced and received each month over the last year; the estimates waiting on someone; and what changed recently.
- Print-ready PDFs: a dedicated print view with A4 page margins, a repeating table header, page numbers, and a rule at the foot of every page. Save it with the browser's own Print → Save as PDF; the file name defaults to the document number. A document that is not yet approved prints with a faint "Yet to be Approved" watermark on every page.
- Reports: sales by customer and by item, receivables aging (summary and details), customer balances, payments received, time to get paid, estimate conversion, an income summary on an accrual or cash basis, and an activity log. Each has date-range presets, prints, and exports to CSV. Every currency is reported on its own. See Reports.
- CSV export and import: customers, items, estimates, invoices and payments, in the same columns as another system's export, so a business can move its history here.
- Custom numbering: a format per document type, such as
INV-{seq}orEST-{YYYY}{MM}-{seq:2}. - Discounts and charges: a flat discount per line, plus any number of named charges added to the subtotal (e.g. "Bank Charges"). A negative charge works as a whole-document discount.
- Bold text: wrap words in
**double asterisks**in any multi-line field to print them bold, e.g.* **Account number**: 12345678.
| Layer | Choice |
|---|---|
| Web app | Vite + React + TypeScript, Tailwind CSS, react-router-dom |
| Server | Node.js 24 + Hono, TypeScript run directly by Node (no build step) |
| Database | PostgreSQL 13 or newer, plain SQL migrations, pg |
| Auth | Email and password, scrypt hashes, server-side sessions in an HttpOnly cookie |
| The browser's print-to-PDF, from a dedicated print view |
src/ the web app
server/ the API: src/routes/*.ts, and migrations/*.sql
shared/ types, money maths, numbering and the role table, used by both
You need Node.js 24 or newer and a PostgreSQL database.
npm install
cp .env.example .env # then set ADMIN_EMAIL and ADMIN_PASSWORD
npm run dev:db # start a local PostgreSQL (see below)
npm run dev:server # the API, on http://localhost:8787
npm run dev # the web app, on the URL Vite printsOpen the web app and sign in with ADMIN_EMAIL and ADMIN_PASSWORD. You are asked to choose a new
password straight away. Then start in Settings: enter your business details, logo, number
formats, and the default notes, payment details, and terms that new documents copy.
The database. npm run dev:db starts a private PostgreSQL on port 5433 from the PostgreSQL
binaries installed on your machine, without Docker or root; scripts/dev-db.sh stop stops it and
scripts/dev-db.sh reset deletes its data. If you prefer Docker, run docker compose up -d db
and use DATABASE_URL=postgres://invoice:invoice@localhost:5433/invoice. Any other PostgreSQL works
too: point DATABASE_URL at an empty database. The server creates its tables on startup.
| Role | Can do |
|---|---|
| Admin | Everything a member can, plus approve or reject documents, delete estimates, invoices and payments, manage users, change settings |
| Member | Create and edit customers, items, estimates and invoices; submit them for approval; record payments; export and import CSV |
| Viewer | Read and print everything; change nothing |
The table lives in shared/permissions.ts. The server enforces it on every request; the web app
reads the same table only to decide which buttons to show.
- The first admin is created on startup from
ADMIN_EMAILandADMIN_PASSWORD, but only while no user exists. That password must be changed at first login, and until it is, the account can do nothing else. - Adding a user: an admin enters their email, name and role on the Users page and gets a one-time invite link to pass on. The user opens it and chooses their own password, so the admin never knows it. The link works once and expires after 7 days.
- Forgotten password: an admin issues a reset link from the same page (valid 24 hours). No email is sent by the app, so it needs no mail server.
- Disabling a user signs them out everywhere at once. Users are disabled rather than deleted, so the activity history keeps their name.
- Protection: passwords are stored as salted scrypt hashes and must be at least 10 characters. Five failed sign-ins lock the account for 15 minutes. Sessions last 7 days, live in an HttpOnly, SameSite cookie, and are stored hashed in the database. Requests that change anything must come from the app's own origin.
Estimates and invoices move through the same states:
Draft ──submit──▶ Pending approval ──approve──▶ Approved ──▶ Invoiced (estimate, once converted)
▲ │ │ └─▶ Paid (invoice, once paid in full)
└──reject (reason)────┘ │
└──────────────convert to draft (reason)────────┘
- Only a draft can be edited. Members submit; an admin approves or rejects with a reason. An admin can submit and approve their own documents.
- Convert to draft reopens a submitted or approved document. It keeps its number and must be approved again. Undoing an approval requires a reason, which is kept in the activity history. An estimate that has been invoiced, and an invoice with payments, can no longer be reopened.
- Only an approved estimate converts to an invoice, and only once. Voiding that invoice frees the estimate to be converted again.
- An invoice's status follows its payments: "Approved" until a payment is recorded; "Due in 12 days" or "Due today" once part of it is paid; "Overdue by 40 days" when the due date has passed with a balance left; then "Paid".
- Admins can delete an estimate or invoice for good, in any status, after confirming. An invoice with payments cannot be deleted until its payments are; admins can delete a payment from the invoice or from Payments received, and the invoice's balance and status follow. Deleting an invoice made from an estimate makes the estimate convertible again; deleting an estimate leaves its invoice. Numbers are not reused. Void remains for keeping a cancelled document on record.
- Approval freezes the business and customer details onto the document. Editing a customer's address later doesn't change a document that was already approved.
Reports in the menu lists them by group. They are worked out from the documents and payments as they are when the report is run, and store nothing.
- What counts as a sale: an invoice that is approved or paid. Drafts, pending, rejected and void invoices are left out.
- Periods: presets from Today to Previous year, Last 12 months, or any two dates. The aging and balance reports take a single "as of" date and count only payments made by then.
- Currencies are never added together: each report has one table per currency.
- Income summary splits sales (line amounts before discount), discounts and named charges. On a cash basis each payment received in the period is split in the same proportions as its invoice.
- Aging counts days past the due date, or past the invoice date when there is none, in the buckets current, 1–15, 16–30, 31–45 and over 45 days.
- The period is kept in the address, so a report can be bookmarked or sent. Viewers can read reports; exporting them to CSV is for admins and members, like the other exports.
The Customers, Items, Estimates, Invoices and Payments received pages each have Export CSV and Import CSV buttons, for admins and members (viewers see neither). An exported file can be edited and imported back, and the same columns are read from another invoicing system's export, so moving here is a matter of importing its files.
- Import in this order: customers, items, estimates, invoices, payments. Each file finds what it refers to by what came before: an estimate its customer, an invoice its customer and estimate, a payment its invoice (by number).
- Importing the same file again updates instead of duplicating. Each row's id (
Contact ID,Item ID,Estimate ID,Invoice ID,InvoicePayment IDorCustomerPayment ID) is kept, and a file exported here carries the record's own id. - Estimates and invoices have one row per line item; the document's columns repeat on each of its rows.
- Statuses are kept. An imported approved estimate stays approved, a void invoice stays void, and an invoice becomes Paid when its imported payments cover it. Approved documents are given the business and customer details as they are at the time of the import. Each imported document says so in its Activity tab.
- Totals are recomputed from the lines. Prices are kept to two decimals, so a line priced to three decimals elsewhere can come out a cent away from the total the customer was sent; the import then adds a "Rounding" charge for the difference and lists the document in its report.
- Numbers are kept, payment numbers too when they are free. Set the next numbers in Settings so new documents continue after the imported ones.
- Attachments are not part of a CSV. The payments export lists their file names only.
- Text that a spreadsheet would run as a formula (starting with
=,+,-or@) is written with a leading apostrophe, and the apostrophe is removed again on import.
| Main columns | |
|---|---|
| Customers | Contact ID, Display Name, First Name, Last Name, EmailID, Phone, Billing Address (+ Billing Street2, City, State, Code), Billing Country, Currency Code, Tax ID, Notes, Status |
| Items | Item ID, Item Name, Description, Rate, Currency Code, Status |
| Estimates | Estimate Date, Estimate ID, Estimate Number, Estimate Status, Customer ID, Customer Name, Expiry Date, PurchaseOrder, Currency Code, Total, Adjustment + Adjustment Description or Charges, Notes, Terms & Conditions, Subject, Project Name, Show Total, then per line Item Name, Item Desc, Quantity, Item Price, Discount Amount |
| Invoices | As estimates, with Invoice … and Due Date, plus Estimate Number, Payment Details Title, Payment Details |
| Payments | CustomerPayment ID / InvoicePayment ID, Payment Number, Date, Mode, Amount Applied to Invoice (or Amount), Bank Charges, Reference Number, Description, Invoice Number |
Column names are matched ignoring case, spaces and underscores. A customer or item field is only
overwritten when the file has a column for it. Charges holds any number of named charges, one per
line as label | amount; files with a single Adjustment column are read too.
npm run dev # the web app, with /api proxied to the server
npm run dev:server # the API, restarting on changes
npm run build # type-check everything and build the web app into dist/
npm run start # the server, which also serves dist/ when it exists
npm run lint # oxlintThe data model is in shared/types.ts and server/migrations/, the API in server/src/routes/, and
the printed layout in src/pages/documents/DocumentPrint.tsx plus the print section of
src/index.css.
Schema changes are numbered SQL files in server/migrations/. Each is applied once, in name
order, in its own transaction, when the server starts. Add a new file; never edit an applied one.
Blank page in dev, with 504 (Outdated Optimize Dep) in the console. Vite's pre-bundled
dependency cache is stale, usually because a second vite process started against the same folder
(Vite rebuilds the cache before it checks whether the port is free). Stop the dev server and run
npm run dev -- --force.
Running under WSL with a Windows browser. If http://localhost:5173 refuses to connect, start
the server with npm run dev -- --host and open the Network: address Vite prints. If the project
lives on a Windows drive (/mnt/c/...), file changes don't reach the watchers: restart the dev
server and the API after editing, or keep the project in the Linux filesystem.
Money is plain numbers, not integer cents. Amounts are ordinary JavaScript numbers rounded to 2
decimals at each step (shared/money.ts) and stored as numeric(14,2). Each line is rounded before
summing, so the printed total always equals the sum of the printed lines. The server recomputes
every total itself; it never trusts one sent by the browser.
There is no tax. Lines are priced as Amount = Qty × Rate − Discount, and
Total = Σ Amount + Σ charges. Adding tax later means a new field and a migration.
A document is priced in its customer's currency. Settings holds the default currency, used for new customers and for any customer without one.
Estimates print no total unless asked. By default an estimate's PDF lists its line items without a subtotal or total, because the customer often chooses which items to take. Tick Show the total on the PDF under the estimate's total to print Sub Total, charges and Total. Invoices always print Sub Total, charges, Total, and Balance Due.
Numbers are assigned when a document is first saved. Leaving the number field blank takes the next one from a per-type counter, inside the same transaction as the save, so two people saving at once cannot get the same number. A number can also be typed in; that leaves the counter alone. The counters are editable in Settings, so you can continue an existing series.
- Page numbers use CSS page margin boxes (
@page { @bottom-right { content: counter(page) } }). Defining margin boxes also stops Chromium from printing its own date, title, and URL in the page margins. - Chromium keeps printed content inside the page area. It shrinks the whole page to fit anything wider, and moves a fixed-position element that pokes into the margin onto the next page. The page-foot rule therefore sits at the very bottom of the page area, and the watermark is clipped to it.
- Colors print exactly (
print-color-adjust: exacton the root). Without it, Chrome drops background colors when "Background graphics" is off, and darkens light text such as page numbers. - The Discount column only appears when a line has a discount, and line items never split across pages.
- Generating PDFs with headless Chrome on Linux? Launch it with
--font-render-hinting=none. By default it rounds glyph widths to whole pixels, which widens small text by up to ~5% and moves line breaks. Desktop Chrome on Windows and macOS already positions text fractionally.
The Dockerfile builds one image containing the server and the built web app:
docker build -t invantra .
docker run -p 8787:8787 \
-e DATABASE_URL=postgres://user:password@host:5432/invoice \
-e ADMIN_EMAIL=you@example.com -e ADMIN_PASSWORD=change-me-at-first-login \
invantraOr run the app and a database together with docker compose --profile app up -d --build.
| Variable | Purpose |
|---|---|
DATABASE_URL |
PostgreSQL connection string. Required. |
PORT |
Port to listen on. Default 8787. |
ADMIN_EMAIL, ADMIN_PASSWORD |
The first admin; only read while no user exists. |
COOKIE_SECURE |
Defaults to true when NODE_ENV=production. Set false only to serve plain HTTP, or auto behind a proxy that sets X-Forwarded-Proto and serves both. |
STATIC_DIR |
Where the built web app is. Default dist. |
- Serve it over HTTPS. In production the session cookie is marked Secure, so sign-in does not
work over plain HTTP unless
COOKIE_SECURE=false. - Keep the
Hostheader intact in any reverse proxy, since the server compares it with the request'sOriginto refuse cross-site requests. - Health check:
GET /api/healthreturns 200 once the database is reachable. - Migrations run on startup under a database lock, so several replicas can start together.
- Back up the database. Everything the app stores, the logo included, is in PostgreSQL.
Email delivery, recurring invoices, tax, single sign-on, custom roles, and a template editor (branding is customizable; the layout is not).
MIT © Meetrix Pty Ltd