The workshop job system: job cards, invoices, texts and backups
My own job system for a small repair workshop: job cards, GST invoices, payments, counter sales, customer texts and printing, in Docker on SQLite.
- Difficulty
- Advanced
- Parts cost
- The software is free. You need an always-on PC, a printer and an SMS account
- Build time
- Built up from early 2026, then a full rebuild in July
- Skills
- Node.js, React, SQLite, Docker
The problem
A workshop runs on job cards. Something comes in, someone writes down who owns it and what’s wrong with it, the work gets done, the customer gets told it’s ready, they pay, and you hand over an invoice with the GST on it. Then at the end of the quarter you have to add all of that up for the tax office.
I wanted all of that in one place that I owned, that my own other tools could talk to. The counter sign-in kiosk drops jobs into it. The AI receptionist books jobs into it from phone calls and texts. So I wrote my own job system: job cards, invoices, payments, counter sales, customer texts and printing, all in one web app.
The first version did the job, but when I sat down and audited it properly in July, the money side was weak. There was no invoices table: the invoice number was just the job number, and that could change. There were no credit notes or refunds, no record of who changed what, and money was stored as floating point numbers (the kind that can’t hold 0.10 exactly). The GST figure for my quarterly business activity statement was a divide-by-eleven guess. So I rebuilt the office side from the ground up, on the same database, and kept the old app running alongside it for the parts that still needed it. I did the 2026 rebuild with a lot of help from an AI coding assistant, checking every step myself and running it on real jobs as I went.
This guide is the whole system, warts and all. The best bits are in the lessons at the bottom: I lost real jobs to a Docker mistake, and a printer that said “OK” when no paper came out.
How it works
It’s a web app: a React front end, served by nginx (a small web server), and a Node.js (Express)
back end that talks to a SQLite database through better-sqlite3. SQLite is a whole database in one
file, which suits a small workshop: nothing extra to install or look after. It all runs in Docker on the
workshop PC.
A job’s life goes through four statuses:
- pending. The job exists. It came from the kiosk, the AI receptionist, or someone at the desk.
- in-progress. It’s on the bench.
- completed. The work is done. Marking it complete also queues the “your job is ready” text.
- paid. The customer has paid in full.
Every job also records where it came from (walk-in, ai-sms or ai-phone), so I can see what the
receptionist is actually bringing in.
When a customer comes to pick up, I open the job and press Record Payment: pick EFTPOS, cash or bank transfer, type the last four digits off the EFTPOS receipt (or the bank transfer reference), check the amount, and press OK, Save & Print. That one press creates the invoice, issues it, records the payment against it, and prints it on the workshop printer with a PAID stamp, the payment method, the reference and the date. Part payments work too: the system adds up what’s been paid, and only marks the job paid when the total is covered. The amount box shows a deposit warning, so a part payment isn’t mistaken for the whole lot.
Counter sales are for parts sold over the counter with no job at all. A New Sale window lets me search the stock, set quantities and pick the payment method. The sale takes the parts out of stock and goes into the same reports as job income, including the GST.
Texts to customers go through a queue. Completing a job queues two texts: a “ready to collect” message with the itemised prices and total, and a follow-up a week later asking for a Google review. Nothing goes out by itself at first. I send the ready text from the SMS Queue page, and that’s what starts the seven-day clock on the review request.
What you need
- An always-on PC. Mine is the workshop PC, the same one that runs the kiosk. It started out on an old server and moved later.
- Docker with Docker Compose.
- Node.js for the back end, with
expressandbetter-sqlite3. The rebuilt back end is TypeScript on Node 22. - React for the front end, and nginx to serve it.
- A printer. Mine is a Canon G4070. It prints job cards and paid invoices.
- An SMS account. Mine is Twilio (a service that rents you a phone number your code can send texts from). The texts go out through Twilio’s Node.js library.
- Two backup disks that are not the PC’s main drive. Mine are a USB stick in the workshop PC and a drive on another computer on the network.
- Someone who knows tax. My bookkeeper decides how the GST is reported. I’m a mechanic, not an accountant. Get your own invoices and tax figures checked by someone who is.
How it’s put together
There’s no wiring, but there are a few moving parts, and how they connect is where every lesson below came from.
| Part | Runs where | Talks to |
|---|---|---|
| Front end (React, served by nginx) | Docker, workshop PC | The browser on the counter PC; sends /api/... calls to the right back end |
| New back end (the rebuild) | Docker, workshop PC | The database; owns invoices, payments, credit notes, reports |
| Old back end (the first version) | Docker, workshop PC, not reachable from outside | The same database; still runs the kiosk, the SMS sending and the invoice PDF |
| SQLite database | A data/ folder on the PC’s own disk, mounted into the containers |
Both back ends |
| Print receiver | A small service on the workshop PC, outside Docker | The printer |
| Twilio | The internet | Customers’ phones |
| Backup disks | A USB stick in the PC, and a drive on another computer | A copy of the database, signatures and job photos every night |
Two back ends sharing one database sounds odd, so here’s why. The old back end had about fifteen pieces
of code that depended on other things (AI models, email logins), plus the kiosk and the workshop screens,
and rewriting all of that at once was a much bigger risk than leaving it be. So nginx sends the new /api/v2/... routes, and the receptionist’s
“create a job” route, to the new back end, and everything else under /api/ to the old one. SQLite in
WAL mode (more on WAL below) is fine with two programs reading and writing the same file.
The invoice PDF is the old back end’s, on purpose. It already made the invoice I was used to and already knew how to print it, so the new side calls it rather than having two.
Config and code
The jobs table
This is the core of it, the whole table as it stands. The REAL money columns are from the first version.
The rebuild keeps them in step for the old app, but the invoices themselves are stored in whole cents (see
below). You can see the history in it: columns added one at a time as I needed them, some of which overlap
(kms_at_service and odometer_reading, for one).
CREATE TABLE jobs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
job_number TEXT UNIQUE NOT NULL, -- e.g. A261013-001: prefix, date, number for the day
customer_id INTEGER NOT NULL,
vehicle_id INTEGER NOT NULL,
work_description TEXT NOT NULL,
kms_at_service INTEGER,
status TEXT DEFAULT 'pending', -- pending, in-progress, completed, paid
labor_hours REAL DEFAULT 0,
labor_rate REAL DEFAULT 65.00,
total_parts_cost REAL DEFAULT 0,
total_labor_cost REAL DEFAULT 0,
total_cost REAL DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
completed_at DATETIME,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
tech_hours REAL DEFAULT 0, -- hours actually spent
billed_hours REAL DEFAULT 0, -- hours charged
serial_number TEXT,
odometer_reading INTEGER,
tech_notes TEXT,
source TEXT DEFAULT 'walk-in', -- walk-in, ai-sms, ai-phone
payment_method TEXT, -- eftpos, cash, bank_transfer
transaction_id TEXT, -- last 4 digits off the EFTPOS receipt
payment_date DATETIME,
amount_paid REAL DEFAULT 0, -- running total, so part payments work
collected_at DATETIME,
business TEXT NOT NULL, -- which side of the business the job belongs to
discount_percent REAL DEFAULT 0,
discount_amount REAL DEFAULT 0,
urgency TEXT,
needed_by_date DATE,
triaged_by TEXT,
triaged_at DATETIME,
priority TEXT DEFAULT 'normal'
CHECK (priority IN ('low','normal','high','urgent')),
archived_at DATETIME,
FOREIGN KEY (customer_id) REFERENCES customers(id),
FOREIGN KEY (vehicle_id) REFERENCES vehicles(id)
);
CREATE INDEX idx_jobs_business ON jobs(business);
CREATE INDEX idx_jobs_archived ON jobs(archived_at);
Counter sales have their own pair of tables, counter_sales and counter_sale_items, so a sale doesn’t
need a fake job or a fake customer.
The invoices (the rebuild)
The rebuild added proper money tables: invoices, invoice_lines, ledger_payments, credit_notes,
refunds and finance_audit_log. Every amount in them is a whole number of cents, never a decimal.
There’s also a rule in the database that a job can only have one live invoice at a time.
The rules they follow:
- An invoice goes draft, then issued, then paid. Payments can’t add up to more than the invoice. A credit note can’t be bigger than what’s left, counting what’s already been paid. An invoice can only be voided if nothing has happened to it yet.
- Prices include GST, and the invoice shows the total “inc. tax”. GST is worked out line by line and added up, not worked out once on the total, so the same invoice always gives the same GST however you get to it.
- GST is reported when the invoice is issued, not when it’s paid. That’s called the accrual basis, and it’s what my business uses. Ask your bookkeeper which one yours uses.
- Payment is due on pickup. Only business customers can have an account with payment terms, 14 days unless I set something else for that customer.
- Saving a payment is one database transaction. Create the invoice, issue it, record the payment: all of it happens, or none of it does. A half-done sale (an issued invoice with no payment, or a payment with no invoice) would quietly throw the profit and loss out, and there’s a test that proves a failed payment leaves nothing behind.
The reports come out of these tables: income and expenses, the quarterly GST figures for each side of the business, who owes what, and printable statements. On the first of each month the system emails my bookkeeper a pack: a PDF summary and the month’s figures as spreadsheets.
When I switched over, I turned the old paid jobs into invoices too, with the job number as the invoice number, then ran five checks that the old figures and the new ones agreed. They all passed with nothing out.
The API routes the other tools use
The kiosk page and the receptionist don’t touch the database. They call the job system like any other web app. These are the old back end’s routes, kept the same through the rebuild so nothing that called them broke:
| Route | What it does |
|---|---|
GET /api/jobs/ |
List all jobs |
POST /api/jobs/quick-create |
Make a job from customer_name, customer_phone, work_description and source. The receptionist uses this |
POST /api/jobs/:id/status |
Change a job’s status |
POST /api/jobs/:id/record-payment |
Record a payment from payment_method, transaction_id and amount_paid. Prints the invoice when it’s paid in full |
GET /api/counter-sales |
List counter sales |
POST /api/counter-sales |
Make a counter sale: takes the parts out of stock and works out the totals |
POST /api/kiosk/submit |
The kiosk’s sign-in form (see the kiosk guide) |
quick-create is open to other programs, so it has a rate limit on it, and so does the login.
To make a test job by hand ($JOBS_API is wherever your job system answers):
curl -s -X POST "$JOBS_API/api/jobs/quick-create" \
-H "Content-Type: application/json" \
-d '{"customer_name":"Test Customer","customer_phone":"<your own mobile>","work_description":"TEST - delete me","source":"walk-in"}'
Docker: mount the folder, not the file
This is what my back end’s volumes looked like at first. It looks right. It lost me jobs.
# DON'T: the database mounted as a single file
volumes:
- ./jobs.db:/app/jobs.db
- ./inventory.txt:/app/inventory.txt
- ./logo.png:/app/logo.png
SQLite in WAL mode (write-ahead log) doesn’t write changes straight into the database file. It writes
them to a second file next to it, jobs.db-wal, with a third, jobs.db-shm, keeping track, and folds them
into the main file later. Mount only jobs.db and those two files live inside the container, and a
container rebuild throws them away. This is the fix: put everything in one folder and mount the folder.
# docker-compose.yml, back end service
services:
backend:
environment:
- TZ=Australia/Sydney # your own time zone. See the lessons for why this matters
volumes:
- ./data:/app/data # jobs.db, jobs.db-wal, jobs.db-shm, the logo, signatures/
The back end looks for the data/ folder and uses it if it’s there, and falls back to a database next to
the code when I’m working on it on my laptop. Cut down to the idea:
// database.js
const fs = require('fs');
const path = require('path');
const Database = require('better-sqlite3');
const dataDir = path.join(__dirname, 'data');
const DB_PATH = fs.existsSync(dataDir)
? path.join(dataDir, 'jobs.db') // in Docker: the mounted folder
: path.join(__dirname, 'jobs.db'); // on my laptop
const db = new Database(DB_PATH);
db.pragma('journal_mode = WAL');
module.exports = { db };
Whatever else writes into that folder goes in it too. The kiosk’s signature pictures live in
data/signatures/, so they get backed up with the database.
Printing
The back end doesn’t talk to the printer directly. It sends the PDF as an ordinary web upload (an HTTP
POST, multipart/form-data) to a small print receiver service that runs on the workshop PC and feeds the
printer. If the send fails it tries three times, waiting 1, 2 and then 4 seconds. Job cards
print when a job is made (there’s a tick box for it, on by default), and there’s a reprint button on every
job. Paid invoices print by themselves.
The print receiver has no health check address, so the back end’s “is the printer there?” check is switched off and always says yes. Which is why the next part matters: check the answer the print request sends back, not just that it was answered. See the lessons.
The job system and the printer ended up on the same PC, and I kept the print receiver anyway. The job system still posts every print job to it, and it stays the only thing that talks to the printer.
Texts
Completing a job writes two rows into an sms_queue table:
- The ready text. Tells the customer the job is ready to collect, with the itemised prices and the total, and a line at the bottom: “Please do not reply to this number. If you have any questions please contact” and the workshop’s real number.
- The review request. Asks for a Google review, with the link. It’s queued with a send time 100 years in the future, so it can’t go out by accident.
On the SMS Queue page I check the ready text and press send. There’s a confirm box first, because you can’t take a text back. Sending it moves the review request to seven days later. An hourly job on the old back end sends anything that’s due. If I don’t want the review request for a particular customer, I delete it from the queue.
Two small rules keep it sane. Completing a job twice doesn’t queue the texts twice: if there’s already an
unsent text of that type for the job, it doesn’t add another. And every time in that table is local time,
written by SQLite’s datetime('now','localtime'), which is only right if the container knows its time zone.
Step by step
- Start with the database layout. Customers, vehicles, jobs, then money tables in whole cents. Put the
database in a
data/folder from day one. - Write the Docker Compose file with
./data:/app/datamounted andTZset on every container that writes to the database. - Set up the backups before there’s any real data in it. Mine run every night at 1am. Don’t copy a
live database with
cp: SQLite’s own.backupcommand makes a clean copy while the app is still writing, with whatever is sitting in the WAL file included. Each copy is checked withPRAGMA integrity_checkand has to be over a minimum size, because a backup of the wrong, nearly empty database passes the integrity check just fine. The copy goes to two disks, a USB stick in the workshop PC and a drive on another computer on the network, along with the signatures and job photos, and each disk keeps 30 days. The two copies are made separately, so one disk dropping out doesn’t stop the other, and any failure emails me that night. - Build the job pages: a list with status chips, a job page with parts and labour, and the status buttons.
- Add Record Payment and the invoice PDF, then printing. Test it with the printer switched off.
- Add counter sales, and make sure the reports pick them up.
- Add the SMS queue. Leave sending manual until you trust the wording.
- Add the
quick-createroute with a rate limit, for anything else that needs to make jobs. - Before every change from then on, take two backups, one to each disk, named for the change and the time, so you know which one to roll back to.
Testing it
-
The WAL files are on the host, not in the container. With the app running:
sqlite3 data/jobs.db "PRAGMA journal_mode;" # should print: wal ls -la data/ # jobs.db-wal and jobs.db-shm should be hereThen the real test: make a test job, rebuild the containers, and check the job is still there.
-
Walk a job all the way through. Make it, move it through the statuses, record a part payment (it should stay completed), then the rest (it should go paid and print). Delete the test job after.
-
Switch the printer off and record a payment. The payment should still save, and nothing should claim it printed. If something does, your code is trusting the wrong thing.
-
Check the SMS queue after completing a test job, without sending anything. The ready text should be there and the review request should be parked a long way in the future. Complete it again and check you still only have two.
-
Check the times. A row written just now should show the time on the wall clock, not a few hours off.
-
Open a backup. Copy the latest backup somewhere else, open it with
sqlite3, and check the newest job is in it. Count the signature and photo files at both ends withfind data/signatures -type f | wc -l.ls | wc -lonly counts the top level, so it misses anything in subfolders.
Lessons learnt
Mounting the database as a single file lost me five or six jobs. Docker was mounting just the
database file into the container. SQLite in WAL mode keeps recent changes in a separate -wal file next
to the database until it folds them in, and that file was living inside the container. One rebuild of the
container and the changes that hadn’t been folded in yet were gone. Five or six real jobs. The fix was to
put the database, and everything else the app writes, in one data/ folder and mount the whole folder.
Never bind-mount a single SQLite file.
Printer settings inside a container get wiped. The first version printed through CUPS (the standard Linux print system), set up inside the Docker container. Every rebuild wiped the printer setup. Anything you configure inside a container is gone the next time it’s rebuilt, unless it’s in a mounted folder or the image itself. I moved printing out to the small print receiver program on the PC with the printer, and the back end just sends it the PDF.
The printer said “OK” when no paper came out. The old invoice-printing route answers with a normal
success code (HTTP 200) even when the printer can’t be reached. The bad news is inside the answer:
{"success": false}. My new code checked the success code, so it would have happily reported a print
when nothing printed. Check what the answer actually says. I also made printing best effort: a failed
print never makes a saved payment look like it failed.
A new container without a time zone wrote the wrong times into a shared table. The old back end had
its time zone set. The new one didn’t, so when it wrote “now, local time” into the SMS queue, SQLite wrote
UTC (world time) instead, a few hours off, into the same table the old back end was writing local times
into. I set TZ on the new container and corrected the rows it had already written. Any container that
writes times another program reads needs the same time zone set.
Money as decimals, and a test that only knew one kind of labour. The first version kept money as
REAL numbers, and old rows carry tiny rounding leftovers on the end. The rebuild uses whole cents
everywhere, and reads totals from the job’s own total, never by adding up the old line prices. Then
“Create Invoice” crashed on every tyre job. The old app stores flat-rate labour (a fixed price for a job,
not hours) with the hours left empty and the whole fee in the price, and the new code used hours as the
quantity. My tests only ever made hourly labour. Fixed: flat-rate labour is quantity 1. If you write tests
for money, feed them every shape of data the real database holds.
Running the old app next to the new one: the address bar lied. For a while, the SMS Queue page was still the old app’s page. Click it, and you’d land in the old app, and every page after that stayed in the old app even though the address bar said otherwise. The old app moves between its pages inside the browser, without asking the server, so once you were in, you stayed in. That wasn’t just ugly: the old app’s sales and quotes pages wrote straight to the database and skipped the new invoice records. I rebuilt the SMS Queue page in the new app. If you run two versions side by side, make sure nothing can lead a user from the new one back into the old one.
The rebuild added clicks, and that’s a fault too. The new invoicing first needed Complete, then Create Invoice, then Issue, then Record Payment. That’s more clicks than the old app took, at the counter, with a customer waiting. I put the one-step flow back: Record Payment on the job, one press, invoice made, paid and printed. Make the common job the shortest one.
A database with no clean-up grew until the app stopped answering. This one was the fleet dashboard,
another of my Node.js and SQLite apps on the same server, but the job system is built the same way. It
wrote a row for every check it made and never deleted any. It got to 861 MB, five million rows in one
table and an 84 MB WAL file, and pages that should load instantly took 20 to 60 seconds. better-sqlite3
is synchronous: while a query runs, Node can’t do anything else, so one slow query stalls every page. I
stopped the app, deleted the old rows, ran VACUUM (which rebuilds the file to give the space back) and
PRAGMA wal_checkpoint(TRUNCATE) (which folds the WAL file in and empties it). Then it stayed slow, for a
second reason: a “latest row for each service” query that worked it out again for every row. On that much
history it took 130 seconds. Rewritten to fetch one row per service, newest first, using an index, it took
54 milliseconds. Any table you write to on a timer needs a clean-up rule from day one, and test your
queries on a lot of data, not a little.
Questions and comments
Loading comments…