Discourse Brewing
This is the back-office app I built for Discourse Brewing, a craft brewery with a taproom. It forecasts when each beer will run out and when the next batch has to start, from hand-counted inventory and sales imported from Square each morning.
- Client
- Discourse Brewing
- Started
- August 2024
- Status
- In production
- Stack
- Laravel 13, Filament 5, Livewire 4, Square, MySQL
- Screenshots
- Demo data
Run-out forecast
Each beer shows the ounces on hand, how fast it's selling per week, the weeks left before a new batch has to start and the weeks until it's empty. The beers list flags any beer with under three weeks left.
How it's built: The sales rate is the volume sold since the keg date of the batch the brewer picks, divided by the weeks since. WeekMarkersCalculator takes the volume on hand, that rate, the safety stock and the brew lead time, and returns three week counts as a readonly value object. Two queued jobs store the results on the beer, so the list sorts and filters without recomputing. They run daily, and whenever a count, a batch or a beer's settings change.
Sales charts
The Sales page charts weekly net sales in total and by packaging, as dollars, quantities and share of the week. A second page breaks the same weeks down by beer category. Each chart filters by date range.
How it's built: Filament chart widgets that share one date-range trait. Weeks are bucketed in SQL, Monday to Sunday in the brewery's time zone, and share of the week is a window function. The Chart.js options live in plain JavaScript files passed as RawJs, so tick and tooltip callbacks are real functions.
Also in the app
Sales from Square
Each morning the previous day's Square orders are in the app, matched to a beer and a packaging.
How it's built: A scheduled command imports Square's completed orders into raw tables, then builds the sales table from them. sales is derived, so it can be rebuilt without calling Square, and re-importing a day is idempotent. A mapping screen ties each Square item variation to a beer and packaging.
Inventory counts
The count page has one row per beer and packaging, with a number field and plus and minus buttons. It stacks to fit a phone.
How it's built: A Filament table widget with TextInputColumn and a layout that stacks below the md breakpoint. A model observer queues the forecast jobs on every saved count.
Production batches
Each batch records its brew, ready-by and keg dates, malt and hops, yield and cost per barrel. The Brewing page lists the batches not yet kegged.
How it's built: Total yield is a virtual generated column.