Niro3D: one price in the browser and on the server

The price you see while configuring has to be the price at checkout. One package does both.

A vase being 3D printed layer by layer next to an identical outline of the same vase.

Niro3D sells 3D prints. You can configure a product, like a keychain with your name on it, and see the price change as you go.

That price has to be the one you pay at checkout. And I didn't want a server call every time someone changes a setting.

One package, two places

The pricing rules are a shared package. It runs in the browser for the live price and on the server to validate the order. To make that work it is pure TypeScript with no DOM and no Node globals, so it can run in either place unchanged.

The customer app, the admin and the scripts all use the same package in one monorepo, so a change that doesn't fit gets caught at compile time.

The rules add up

A price is built from rules that combine: a cost per character, size tiers, optional add-ons, dropdown surcharges, a fee for processing an uploaded image and a multiplier per material. Then minimum charges and volume discounts.

There were more edge cases than I expected, which is why it's a rule engine and not a formula.

What it doesn't cover

Uploaded models are different. Their price depends on the geometry, so a slicing service in Go works out the weight, print time and cost, and the result comes back when it's ready. Only configured products are priced by the shared package.

Quoting and ordering run on their own. A person still prints and ships.

More posts

All posts →
  1. 02 Nov 2026

    Ask for a role, not a model: the small AI gateway behind my sitesCode asks for “summarise” or “translate”, never for a model name. One table decides the rest.

    AI · 14 min
  2. 16 May 2026

    Why AI-generated websites all look the same, and what I built to stop itA hundred prompts, the same page a hundred times. The seeds and checks I used against it.

    AI · 3 min
  3. 22 Apr 2026

    Meridia: getting places out of news textNews says "the region" and "local authorities". A map needs a place.

    Projects · 1 min