fair cost السعر الحقيقي

What it costs to get it to Bahrain, counted to the fils.

A shelf price is only part of the bill. fair cost takes one search, checks shops in Bahrain, stores that ship here and parcel forwarders, then adds shipping, customs and VAT so every option shows the price at your door.

3routes priced per search
144unit tests passing
EN/ARwith right-to-left layout

Try the price engine. Pick a product and a route.

FAIR COST · BAHRAINLanded price, BHD
Price at your door

Prices from the app's demo catalog. Rates are the app's config values.

Three ways a parcel reaches Bahrain

Each search runs all three at once and streams them in as they finish, so shops in Bahrain usually appear first. Every total comes from one file, lib/pricing.ts, in whole fils. The AI never adds anything up.

In Bahrainمحلي
From
Shops and sites selling in BHD
Arrives
Today or tomorrow
Found by
Claude web search, then each store page is opened and its price read from the page's own data

total = shelf price (VAT included)
  + delivery (BD 1.000 if not stated)

Ships hereمباشر
From
International stores that deliver to Bahrain
Arrives
A few days to two weeks
Found by
Google Shopping for the UAE and US, through SerpApi

total = item + shipping
  + customs 5% of item + shipping, above BD 300
  + VAT 10% of all of that

Forwarderوسيط
From
Stores that don't ship here, via Shop & Ship, MyUS or Aramex
Arrives
One to two weeks or more
Billed on
The heavier of real and volumetric weight, rounded up to the next half kilo

total = item + shipping to warehouse
  + first half kilo + each extra half kilo
  + customs + VAT

  • Estimates are marked. A guessed weight, shipping fee or delivery time carries a flag that shows up as "Estimated" on the card.
  • Rates are config, not code. VAT, customs, thresholds and forwarder prices live in config/, each marked to be checked against official sources.
  • Forwarded orders carry warnings. Every one says the warranty may not apply in Bahrain and that returns go back abroad at your cost.
  • Batteries and bulk change the route. Lithium batteries are flagged per forwarder. Perishable items like flowers and cakes skip imports entirely.

The real app, running on demo data

With no API keys, fair cost runs in demo mode: an in-memory database with seeded history, a built-in catalog and a rule-based summary. These screens were captured from that mode. The live site uses the same screens with real searches.

What happens after you press search

One request to /api/search, answered as a stream of events, tier by tier. Times are typical of live runs measured during an audit of the app.

  1. Signed in, not too fast

    Sign-in is checked, then a sliding window allows 8 searches a minute per user.

  2. Daily plan limit

    Free accounts get 5 searches a day, premium 30, unlimited stops at a safety cap of 500. The day resets at midnight Bahrain time.

  3. Is it a product?

    A keyword blocklist runs first. Then Claude Haiku cleans up the query, or answers that it is ambiguous, not a product, or prohibited. A stopped query costs no search.

  4. Cache

    The same normalized query within a few hours is answered from the cache.

  5. Product profile

    Claude describes the exact product, its editions and variants, so each result can be labelled the right model or a different one.

  6. Three routes stream in

    Offers are matched (accessories, used items, other variants and price outliers dropped), priced, scored and sent as each tier finishes.

  7. Best deal and summary

    The cheapest exact match from a trusted seller is headlined, then a short AI summary arrives, checked number by number.

  8. Saved to history

    The search and its answer are saved as a chat you can reopen later.

The intent check

Every query is classified before any paid price search. The AI can block a query but can never unblock one the blocklist caught.

You typeWhat happens
iphone 16Product searched as a cleaned-up name
ps5Ambiguous asks which one you mean first
red rosesProduct perishable, so Bahrain shops only
vapeRestricted searched, with a warning
replica rolexProhibited stopped by the blocklist, no AI call

Honest local prices

A Bahrain price found on the web is shown as verified when the store's page says the same thing, unconfirmed (and labelled) when the page can't be read, and dropped when it is in another currency or sold out. fair cost does not get around stores' bot protection.

The AI writes the advice, not the numbers

Claude gets only finished, engine-priced offers. Before its summary is shown, validate.ts pulls every number out of the text and checks it against the numbers the engine produced. One stray number and the whole answer is replaced by a rule-based summary.

Claude summary, iPhone 16

Numbers the AI may use

Totals, delivery days, trust scores, offer counts and anything already in the product name. Digits stuck to letters, like a model number, are names and are ignored.

The same check confirms that every offer the AI picks exists and sits in the tier it claims.

A perfect rating from three reviews isn't proof

Seller trust is a Bayesian average: every rating is pulled toward 3.8 stars as if it had 40 extra reviews. Few reviews barely move it; thousands do. The best deal is the cheapest exact match from a seller scoring at least 55.

5.0 stars, 3 reviewsNew seller, all five stars
72trust
4.6 stars, 3,000 reviewsEstablished seller
90trust

trust = ((3.8 × 40 + rating × reviews) ÷ (40 + reviews) − 1) ÷ 4 × 100
best value = 60% price + 20% speed + 20% trust, each against the best offer in the search

How it is built

Money in whole fils

A Bahraini dinar has 1,000 fils. Every amount is an integer of fils, converted once from USD, AED, SAR, EUR or GBP, and formatted only at the edge as BD 289.500.

One data layer, two backends

Routes talk to one repository interface. With Supabase keys it is Postgres with row level security on all 13 tables; without them it is an in-memory store, so the whole app runs with no accounts at all.

Keys stay on the server

Claude, SerpApi and the Supabase service key are read only in server code. Users can't change their own role or plan, and limits are enforced in the API route, not the page.

An admin who can see costs

Searches today and this month, projected monthly use against each provider's quota with a warning at 80%, cache hit rate, cost per search, top products and user management.

Arabic and English

A full right-to-left layout, Arabic terms and privacy pages, localized errors and summaries, plus light and dark themes.

Measured, not guessed

144 unit tests cover pricing, scoring, limits, matching and AI guardrails. 121 more run against the live services on demand, including a 66-query evaluation set across gadgets, furniture, food and flowers.

Next.js 16React 19TypeScriptTailwind CSS 4MotionSupabasePostgres + RLSClaude Haiku 5.5SerpApiZodVitestCloudflare WorkersOpenNext

Still open

  • Every customs, VAT and forwarder rate is a working assumption until checked against official sources.
  • Local prices depend on web search and page checks; official store feeds would be better.
  • Sign-up emails need a custom sender, and error monitoring isn't connected yet.