Inspiration
A shopper can find a price and still buy on a bad day. The store page shows one number. It does not say that the same product was cheaper a few days ago, or that another store is cheaper right now. I wanted one screen that answers two questions before anyone pays: who has the lowest price today, and is today a good time to buy?
That became Paywise. Compare the US offers, read the recent price range, and pay only when the price is near the low.
What I learned
The gauge looks like a prediction. It is arithmetic. Today’s price is the lowest offer. The score is where that price sits between the low and the high of the window you pick. At the low, the score is 100. At the high, it is 0.
$$ \text{score} = \mathrm{clamp}!\left(100 \cdot \left(1 - \frac{p - p_{\min}}{p_{\max} - p_{\min}}\right) + b,\, 0,\, 100\right) $$
\(p\) is today’s lowest offer. \(p_{\min}\) and \(p_{\max}\) are the low and high inside the selected window. \(b\) is \(+6\) for buy, \(-6\) for wait, and \(-12\) for set an alert. A price within 4% of the low is treated as a buy. A price at or above the higher of 6% over the average, or 62% of the way from the low to the high, is treated as high.
I also learned that a live price feed and a live history feed are not the same series. The number at the top of the page is the cheapest offer right now. The chart is a daily history. They can disagree, and a bad history point will move the needle if you plot it raw.
How I built it
Paywise is a Next.js app. Channel3 supplies search, store offers, and up to 90 days of price history. AG Grid draws the offer table. The gauge runs the formula above in the browser for three windows: 2–3 days, 1 week, and 1 month. A price alert is saved on the server, and Resend sends the confirmation email. The watchlist calendar is Bryntum. Anthropic can write a timing note for that calendar. That note does not move the gauge. The dashboard is an AG Studio report over the PayPal sandbox account, with the assistant on OpenAI. Checkout creates a PayPal sandbox order in US dollars, captures it when the buyer returns, and records the purchase in the Wallet. The app is deployed on Render.
Challenges
The first Render build failed before the app compiled. next-auth declares support through Next 15, and the app uses Next 16, so npm install stopped on a peer-dependency conflict. Render runs that install before the build command, so a flag only inside the build command never ran. A project .npmrc with legacy-peer-deps=true fixed it. The production build then failed because the unused NextAuth email login imports nodemailer, which was not installed. Price alerts already go through Resend, so that login path came out. The TypeScript check failed next: a product mapper was passed straight into .map(), and TypeScript treated the array index as price history.
The data had its own traps. Channel3’s history for a Lenovo Chromebook tablet was $334 on almost every day, and $4.99 on three days. A tablet did not sell for $4.99. The chart was copying every point through, so one bad day could drag the low down and shove the needle toward red. The default 2–3 day tab also never prints the older price. It only shows today’s offer, which is why a backpack at $90 looked flat even when an earlier day was $75.
PayPal sandbox checkout succeeded once. Later attempts, still signed in as the US test buyer Jenny Doe, were declined with “To comply with international regulations.” The order was still a normal USD sandbox order. PayPal was refusing that buyer from India, and signing in again opened the same screen. The rest of the demo does not depend on that capture: the offers, the history, the gauge, and the alert email all run without it.
Built With
- ag-grid
- ag-studio
- anthropic
- bryntum
- channel3
- next.js
- openai
- paypal-sandbox
- react
- resend
- tailwind-css
- typescript