Chocolate Materials and Cost App: Automatic Pricing from Recipe to Carton
A light web app for a chocolate workshop: raw materials and semi-finished, final and carton recipes, with chained price updates and a price inquiry page.
Overview
A simple web application for a chocolate workshop that keeps raw materials, recipes and the cost of every product in one place. Before it, these calculations lived in Excel files, and every time the price of a material changed it had to be fixed by hand in several tables. In this application you change the price of a material and the price of every recipe and product that uses it is refreshed automatically. At the end you can quote the price of a carton or of any number of kilograms to a customer. I built this application in 2025.
The pictures on this page were made with sample data.
Features
Raw materials: a list of materials with a code, a name and a price (per kilogram). Add, edit in place and delete. Persian and Arabic digits are converted to English automatically, so the accounting works with any keyboard.
Semi-finished products: like a chocolate mass. A recipe is built by choosing the materials and the amount of each, and the cost of each row, the cost of the whole batch and the price per kilogram are calculated. If the real weight of the output differs from the total of the materials (for example because of waste), the real weight can be entered so that the price per kilogram follows it.
Packaged final products: a combination of semi-finished products and materials (like hazelnuts, foil and labels) with the weight of every part, and the price per kilogram and per batch.
Carton products: the contents of a carton from final products and packaging supplies (like the carton itself). The price of the carton, and the price per kilogram of the chocolate alone (without packaging), are calculated separately.
Price inquiry: a simple page for sales: you pick the product, enter the "number of cartons" or the "weight in kilograms", and see the final price at once.
Prices stay in sync: changing the price of a material recalculates, in a chain, the semi-finished recipes, final products and cartons that depend on it. The pages are not cached, so the price is always fresh.
The diagram below shows the chain of the calculation.
Design
The interface is Persian and right-to-left, with the Vazirmatn font, and every section has its own colour (materials in green, semi-finished in orange, final products in blue and cartons in purple) so the user knows where they are. The price inquiry page is compact and readable on both mobile and a computer and, as the home page, takes the user straight to the price. The admin panel is behind a button.
How it works
A Python and Flask server, with a SQLite database that is a single file and needs no separate setup.
Costs are calculated with SQL queries and aggregation, and every change recalculates only the rows that depend on it.
Pages use Jinja templates, and plain HTML, CSS and JavaScript for the inputs and the inquiry.
Tools
Python, Flask, SQLite
HTML, CSS, JavaScript, the Vazirmatn font
Result
A light and simple tool that turns the cost accounting of chocolate from several Excel files into an always up-to-date application, and brings quoting a price down to a few seconds.
Gallery
Questions about this project?
If you have questions about this project, or a similar one in mind, I would be glad to hear from you.