What inspired us
A US soybean exporter ships $500,000 worth of goods to China. They find out after the contract is signed that China has a 25% retaliatory tariff on US agricultural goods on top of the 3% MFN duty. That's $140,000 in lost margin on a single shipment discovered too late to do anything about it.
This is not an edge case. Over $180 billion in US exports are hit by retaliatory tariffs annually, and most mid-market exporters have no tool to simulate this before committing.
What we built
TariffLens — a tariff risk simulator for US exporters.
- Upload an invoice or trade document → Mistral AI reads it and extracts the product, HS code, destination, and shipment value automatically
- We look up the current effective tariff: MFN baseline duty + any retaliatory tariff the destination country has placed on US-origin goods
- We simulate 3 scenarios: Today / Escalation / Reroute to alternative market — with exact dollar impact on your shipment
- Groq (llama-3.3-70b) generates a plain-English risk summary and one specific recommendation
The homepage shows a live scrolling tariff ticker pulling real-time data from Supabase, refreshing every 30 seconds. A background scraper hits USTR.gov every hour via Composio and pg_cron.
How we built it
| Layer | Technology |
|---|---|
| Frontend | React + Vite + TypeScript + Tailwind + shadcn/ui |
| AI reasoning | Groq llama-3.3-70b-versatile |
| Document extraction | Mistral pixtral-12b-2409 |
| Database + functions | Supabase Postgres + Edge Functions |
| Scraping + alerts | Composio (Firecrawl + Gmail) |
| Data pipeline | Airbyte Cloud (CSV → Postgres) |
| Deployment | Render |
The entire backend runs as Supabase Edge Functions — no separate server. extract-shipment calls Mistral, simulate-tariff calls Groq, send-alert calls Composio, scrape-tariffs runs on pg_cron every hour.
Challenges
- Supabase free tier blocks external Postgres connections — Airbyte couldn't connect directly. We solved this by seeding the data via SQL migration and using Airbyte for the pipeline architecture demonstration, with Composio handling the live scraping instead.
- Composio's Firecrawl connector was on a deprecated API version — we fell back to direct HTTP scraping from USTR.gov while keeping Composio for the email alert integration.
- Getting Mistral to reliably extract HS codes from real invoice images required careful prompt engineering — the model needed explicit instructions to infer HS codes from product descriptions when not explicitly printed.
What we learned
Retaliatory tariffs are shockingly underdocumented for exporters. The data exists (USTR, trade.gov, WTO) but it's scattered, unstructured, and not connected to any decision tool. The gap between "data exists" and "exporter can act on it in 30 seconds" is exactly where TariffLens sits.
Try it
Go to https://tariff-lens.onrender.com → Simulate a shipment → Soybeans + China + $500,000 → see the $140,000 tariff hit and AI recommendation in under 30 seconds.
Built With
- ai
- airbyte
- composio
- css
- deno
- groq
- mistral
- react
- render
- shadcn/ui
- supabase
- tailwind
- typescript
- unstructured
- vite
Log in or sign up for Devpost to join the conversation.