- Internationalisation
- Billing
- Architecture
One codebase, five tax systems: GST, VAT and BTW without forking the product
Fravolo was born in an Indian kitchen, and the first version spoke only Indian GST: CGST plus SGST, a financial year that starts in April, rupees grouped in lakhs. Taking it abroad could have meant a fork per country. Instead, everything that differs between countries now lives in one registry, and the rest of the code asks the restaurant’s market rather than assuming India.
A market is a value, not a branch in the code
A market is a Go struct: country code, currency and its minor digits, locale, IANA time zone, dialling code, the language bills print in, the tax’s name, default rate and allowed rates, what the tax registration number is called and what shape it has, the documents a restaurant must provide at sign-up, whether menu prices include tax by default, whether the tax is split in two, and the month the financial year starts. Five markets have full local tax work today:
| Market | Currency | Tax | Rates | Registration | Year starts |
|---|---|---|---|---|---|
| India | INR | GST (CGST + SGST, or IGST) | 0 / 5 / 12 / 18 / 28% | GSTIN | April |
| United Arab Emirates | AED | VAT | 0 / 5% | TRN | January |
| United Kingdom | GBP | VAT | 0 / 5 / 20% | VAT number | January |
| Singapore | SGD | GST | 0 / 9% | GST registration number | January |
| Netherlands | EUR | BTW | 0 / 9 / 21% (9% food, 21% alcohol) | BTW-id | January |
Netherlands = Market{
Code: "NL", Currency: "EUR", MinorDigits: 2,
Locale: "nl-NL", Timezone: "Europe/Amsterdam", DialCode: "+31", Lang: "nl",
Tax: Tax{
Name: "BTW", RateBp: 900, Rates: []int64{0, 900, 2100}, Inclusive: true,
RegLabel: "BTW-id", RegRe: regexp.MustCompile(`^(NL)?[0-9]{9}B[0-9]{2}$`),
},
FYStartMonth: 1,
}Beyond those five, 58 more countries are generic markets. They get their own currency, clock, dialling code and tax word — sales tax, IVA, KDV — with the rate set by the restaurant within a sensible range and any reasonable registration number accepted. Outside India, where there is no official registry we can ask, every application — full market or generic — is reviewed by a person rather than approved automatically. That lets a restaurant in a country we have not studied in depth start properly, without pretending we know its tax law.
Tax: dual in India, single everywhere else
Indian GST is unusual. Within a state it is split into equal central and state halves; across states it is one integrated tax; and which applies depends on the place of supply, not just on who the buyer is. Almost every other system is a single tax at a rate.
Billing takes a regime derived from the market. India’s is dual. Every other market’s is single: the whole tax sits in one column, the central and state halves are zero, and the totals carry the tax’s name so every printed slip reads “VAT @5%” or “BTW @9%”, one line per rate. One compute function serves both; the only branch is on the regime, not on a country code.
Storing a single tax in the integrated-tax column was a deliberate compromise. Every Indian bill already in the database stays byte-for-byte the same, reports keep one shape, and India’s tax name is left empty so old bills render as they always have. A Dutch invoice with both 9% and 21% lines splits its tax by rate, as Dutch invoices must.
India-only features stay India-only, explicitly. The monthly GSTR-1 export answers “not applicable” outside India rather than producing an empty file. The set-up checklist leaves out UPI, online payments through India’s payment gateway and India’s delivery platforms in other markets. And the registry checks we run against India’s tax registries are marked “not applicable” elsewhere rather than “passed”.
Money: integers in, words out
Amounts are integer minor units everywhere, in every market. Formatting happens in exactly one place per side: a Go package for slips, bills and messages, and one TypeScript module in the console. Each knows the currency’s symbol and grouping. India groups in lakhs and crores — 12,34,567 — and everywhere else in thousands.
// group writes a whole number with separators:
// 12,34,567 in India, 1,234,567 elsewhere.
func group(n int64, indian bool) string {
s := strconv.FormatInt(n, 10)
if len(s) <= 3 {
return s
}
head, tail := s[:len(s)-3], s[len(s)-3:]
step := 3
if indian {
step = 2
}
var parts []string
for len(head) > step {
parts = append([]string{head[len(head)-step:]}, parts...)
head = head[:len(head)-step]
}
return strings.Join(append([]string{head}, parts...), ",") + "," + tail
}Indian invoices also print the amount in words, in lakhs and crores — “Rupees One Lakh Twenty Four Thousand Five Hundred Only”. Other currencies get thousands and millions, with the currency’s own unit names. An unknown currency code prints as the code and the number, so nothing is ever labelled as rupees by accident. In the console, product code is not supposed to write a currency symbol, a locale or a time zone literally — a rule in our contributor guide — and asks the restaurant’s market instead.
Time: the restaurant’s clock
Times are stored in UTC. Everything a person sees or a rule depends on uses the restaurant’s zone, read from its market when the request is scoped: the business day (which runs from early morning to early morning, because a restaurant’s Saturday ends well after midnight), daily closures and reports, order codes, report buckets, WhatsApp quiet hours. A Dubai restaurant’s day closes on Dubai time; an Amsterdam restaurant’s on Amsterdam time. Reservations, expense dates and referral dates follow the same clock — each of those once defaulted to a fixed zone, and each was caught in review.
The exceptions are on purpose. India’s monthly return periods and its April financial year stay on Indian time, because they belong to India’s tax system, not to the restaurant’s clock.
Language: where it matters most
We translated from the guest’s side inwards. Bills, kitchen tickets, the kitchen display, the POS and the captain’s phone speak English and Dutch today; a Dutch restaurant’s bills always print in Dutch. The owner’s back office is still English. Two other places are deliberately multilingual: the WhatsApp consent and rating parser understands Hindi and Hinglish replies, and Ask Fravolo answers in whatever language the owner asks in.
Printed slips are rendered on the server, so the slip vocabulary is mirrored in Go. That duplication is small, and it means a Dutch kitchen printer gets Dutch without the printer client knowing anything about languages.
Testing a country: a demo restaurant per market
The best test of a market is a restaurant that lives in it. One demo engine fills ninety days of believable trade from a pack: a country’s restaurant, outlets, menus with local tax rates, staff, guest names, floor plan, invoices, expenses, stock and reviews. There are packs for the UAE, the UK, Singapore, the Netherlands — an Amsterdam food hall with beer at 21% and food at 9% — and France, as a generic market. A new country is a new pack, not new code; and running every screen against it is how we find the places that still assume India.
Where it still has an Indian accent
- Two decimal places everywhere. Every market we support today has two minor digits, and some formatting still divides by 100. The registry already records minor digits per currency; the code has to follow it before we add a three-decimal currency such as the Kuwaiti dinar.
- Offline bills copy the server’s rules. The counter’s offline mode follows each market’s tax split and series year by mirroring the server’s rules in the browser, as we wrote in the invoice-numbering post; two copies of a rule need a shared test to stay in step.
- Generic markets get less polish. A generic country’s restaurant gets correct money, clock and tax rate on its bills, but parts of the console still borrow India’s tax wording for it. Making the console look up the full world list, not just the five markets, is a small change we are making next.
- Day boundaries are not uniform yet. Business days follow the restaurant’s clock; a few daily allowances still roll over on a fixed clock. Harmless, but untidy, and worth one definition of “today” per restaurant.
- Tax totals had to follow the regime everywhere. Counter bills outside India once stored their VAT on the bill but not in the order total that reports and Ask read, because that total added only the two Indian halves. Settle now stores the whole tax, and a migration backfilled older orders. One more place where “tax” quietly meant “GST”.