Max Schmitt

March 18 2021

How I Create Client Invoices from the Command Line using Node.js and Airtable

Note

This is my old workflow. These days I use Cakedesk, an invoicing app for creative freelancers.

I always enjoy behind-the-scenes looks into other peoples' businesses, so I thought I'd provide one of my own.

This is the workflow I've created to generate invoices for my clients:

1. Create Client and Project in Airtable

I keep two Airtables: "Clients" and "Projects".

My Clients Airtable contains important data for the invoice such as the client's address. My Projects Airtable contains a reference to the client and the project's price.

I input this data by hand when I start working with a client.

Screenshot of two Windows showing Clients and Projects in Airtable

2. Generate the Invoice via Node.js CLI

When it's time to create the invoice for the project, I use a little Node.js script to fetch the client + project data from Airtable and render the invoice from it it as HTML.

This gives me the freedom to take complete control over the content and layout of the invoice.

An animated GIF showing CLI prompts to gather invoice data

The script also uses Puppeteer to generate a PDF-version of the invoice that I can send out to the client.

A PDF invoice

I'm really happy that I invested the time to build this little system when I started freelancing. I can customize it completely to my needs and I don't need to fiddle around with spreadsheets or word processors.

Some More Details

  • Depending on the client's language (which I also keep in Airtable), the invoice can be generated in English or German
  • To generate the prompts during the invoice generation, I use Inquirer.js
  • For the invoice template, I use Pug (formerly Jade) and plain CSS
  • My Airtable setup isn't optimal because each project can have multiple invoices associated with it – I'll improve this in the future :)