gorbsky.com/workshop/center-of-gravity

Center of Gravity··6 min read

Production isn't the center of a taproom brewery

Brewery software assumes the brewhouse is the center of the business. For a small taproom-forward brewery it isn't, and building around that one idea changed the data model and most of the early decisions.

product managementpostgressupabaseclaude code

Gravity Brewing is a 10-barrel brewery on the Colorado front range, with a taproom that sells most of what we make and a wholesale business that we want to grow. The commercial brewery packages I looked at (Ekos, Ollie and their peers) all start from the same place. They are built around production: recipes, batches, tanks, inventory, the brew schedule. Everything else hangs off that.

For us that is backwards. Our head brewer runs the brewhouse well with a notebook. One or two batches a week is manageable. Ingredients arrive almost just in time. Nothing about the brewhouse was where we were losing hours or making mistakes.

The pain was in the business above the brewhouse. Filing federal and state excise reports that have to balance. Knowing whether a pint in the taproom or a case sold wholesale made us more money. Deciding how much of a limited batch to hold back for the taproom before promising the rest to wholesale accounts. Writing orders and getting invoices out. That is where the spreadsheets lived.

Stacked kegs in a dim brewery, one glowing amber keg circled by an orbit line, fermentation tanks behind and a bar with a ledger and a tablet of charts to the right.

What I built

Center of Gravity (COG) is operations software for a taproom-forward brewery. The name is the thesis. It treats production as a data input: it captures just enough about batches, ingredients and packaging to feed four things that matter more.

  • Compliance: the monthly federal Brewer's Report of Operations, the federal excise return, and state and local tax filings, drafted from the data and reviewed by our CPA.
  • Channel margin: what a beer really earns in the taproom versus wholesale, using real ingredient cost rather than a guess.
  • Allocation: how a limited supply of each beer is split between the taproom and wholesale, with a traffic light that says when to stop selling outside.
  • Wholesale orders and invoicing: commitments, availability, and the invoice that goes to the account.

It is a web app on Postgres and Supabase, built to be multi-tenant from the start, so a second brewery could use it without sharing a row with ours. My partner and I are the first users. I am the product manager, architect and reviewer. Claude Code writes most of the code.

How it works

The thesis is easy to say and easy to lose. A feature list written the usual way drifts back toward the brewhouse, because that is what brewery software looks like. So I wrote the product down first, and made the decisions that follow from it before there was much of a UI.

The requirements document ran to a versioned changelog and took about three days. It lists what COG will not do as carefully as what it will: it is not a brewery ERP, not a point of sale, not an accounting system, and it does not try to run the brewhouse floor. Those non-goals did more work than most of the goals.

A two-panel diagram. Left: production at the centre with everything else orbiting it. Right: compliance, margin, allocation and invoicing at the centre, with production as an input.

Then came a run of architecture decision records, one short dated page per choice, with the reasoning and the tradeoff written next to the decision. There were 23 of them before most of the interface existed. Three show how the thesis shaped the data.

Money is stored in whole cents. Taproom sales arrive from the point of sale in cents, and wholesale order lines are priced in cents. The margin engine compares the two channels, so one unit across all revenue keeps the comparison exact, with no rounding to reconcile between them. Dollars only appear at the display edge. The record also admits a wrinkle: ingredient costs already used decimal dollars, and it explains why that was left alone rather than leaving someone to wonder.

Corrections are new rows, not edits. Anything touching compliance, cost or beer movement is append-only. A finalized filing cannot be edited; a mistake becomes an amended filing. A purchase logged wrongly is offset, not rewritten. Beer that leaves a tank is a row in a ledger, and the ledger has four kinds of movement because the federal report has four lines. Loss and destroyed beer are physically the same act and different lines on a form, so they are different kinds. A generic sketch of the pattern:

-- Illustrative sketch, not the real schema.
create table beer_movements (
  id          bigint generated always as identity primary key,
  kind        text not null
              check (kind in ('receive','transfer','loss','destroyed')),
  from_vessel uuid,
  to_vessel   uuid,
  volume_out  numeric,
  volume_in   numeric,
  note        text,
  created_at  timestamptz not null default now()
);
-- No update or delete policy. A wrong entry is offset by a new row.

QuickBooks owns invoicing. COG had already grown a working invoice stack when I decided it should not own the invoice at all. Two invoice numbers and two PDFs for one document is a recipe for disagreement, and the accountant already lives in QuickBooks. So COG pushes each order there and QuickBooks assigns the number. The decision record also notes something I did not expect: QuickBooks cannot be limited to invoices only, so the restriction lives in what COG's code is able to call, not in the permissions. The guarantee is the absent code.

What went wrong

Two lines of work, and nobody knew. Development forked on one day and ran in parallel for two weeks. One line added QuickBooks invoicing and was merged and deployed. The other, a beer ledger with a real date field on every entry form, sat in commits that were never pushed. Neither side knew about the other. The merge was clean only because the two touched almost disjoint files, which is luck and not process. The cost was subtler than a conflict. The ledger work was treated as done while none of it had ever run in production, so the thing I thought was unblocked was still blocked. Claude Code is quick enough that unmerged work piles up quietly. A written rule that every line of work is pushed and named in the roadmap would have caught it.

The wrong day, after five o'clock. Every entry form defaulted its date to today in UTC. After 5pm in Denver that is already tomorrow, so an evening packaging run landed on the next day. At a month boundary that means the wrong reporting period, which is exactly the kind of error a compliance tool exists to prevent. It had been hiding in plain sight because the dates were not shown; it surfaced when they became something a person reads and trusts. The proper fix needs a timezone on the brewery's profile. Meanwhile the sales margin queries were moved to Denver days, and the date is at least visible and editable on every form.

A tax edge case, found by audit. I ran an end-to-end walk of the business, from raw materials to a filed return, against live data. It found that an invoice for a taxable account in a city we have no tax license row for quietly came out with zero tax. The only signal was a notice on the invoice page. The code did what it was told. The model was missing a case, and a quiet zero looks like a correct answer. The same audit showed the margin numbers were exact on the revenue side and stale on the cost side, because the cost side depended on production entries nobody had been making. I had cut production to the minimum, and had to admit that the minimum feeds everything else.

Lessons

  • Write the non-goals. A list of what the product will not do kept it from sliding back into a generic brewery ERP.
  • Decide the data shape before the screens. Cents, append-only records and a ledger whose kinds match the federal form were cheap on day one and expensive to retrofit.
  • Let the other system own what it already owns. Handing invoicing to QuickBooks removed a whole category of disagreement.
  • Audit coverage, not just bugs. A bug list tells you what is broken. A walk through the business tells you what the software cannot see.
  • A quiet zero is the worst output. Make missing cases loud, and treat a plausible-looking number with no input behind it as suspect.

Built with

  • Postgres on Supabase, with row-level security for multi-tenancy; a Next.js and TypeScript app.
  • Claude Code wrote most of the application code and migrations, working from the requirements document and decision records.
  • I wrote the requirements, made the decisions, reviewed every change and ran the audits.
  • QuickBooks Online and Square are connected through narrow clients, read-only where possible.
  • Our CPA reviews every compliance filing before it goes anywhere.