Inspiration

A few months ago, I walked into my favorite bakery in the Mission, and the owner looked unusually stressed. “Sorry,” she said, pointing to a handwritten sign. “We had to raise prices, flour and packaging costs just shot up again.” She’d been blindsided by a sudden tariff hike on one of her main suppliers. Moments like that made it clear how fragile things can be for small businesses. Over the past year, we’ve seen Bay Area shops scrambling as tariffs and supply chain disruptions drove up costs overnight. We wondered: what if these businesses had a way to anticipate those risks? That’s what led us to build a tool that provides SMBs with AI-powered insights and timely recommendations to stay ahead of cost spikes, protect their margins, and continue doing what they do best: serving their communities with confidence.

What it does

SupplySense is an AI-powered inventory optimization platform that helps businesses manage their inventory costs and margins more effectively. The platform features a comprehensive dashboard with real-time cost analysis, including automatic margin calculations and trend tracking. Using Perplexity's Sonar models, SupplySense provides intelligent cost-saving recommendations and immediate action suggestions. The interactive dashboard includes category-based cost breakdown visualization, customizable charts and graphs, and real-time updates with AI insights.

How we built it

We built SupplySense using Next.js 14 with TypeScript for type safety, leveraging React Server Components and Client Components. The frontend uses Shadcn/UI components with Tailwind CSS for styling, and Recharts for data visualization. State management is handled by Zustand, while data processing utilizes useMemo and useEffect hooks. The application integrates Perplexity's Sonar API (sonar-pro model) for AI insights, with TypeScript interfaces.

Challenges we ran into

Managing shared state across our React components became complex when we had to merge live Sonar API responses with user edits and background inventory syncs in real time. Because Sonar’s AI outputs vary on each call, even with identical inputs, we added a caching layer that deduplicates requests and normalizes results before updating the UI. We discovered occasional schema drift in Sonar responses, where missing keys or extra fields were present. To prevent runtime crashes, we introduced Zod validation and default fallback values.

Accomplishments that we're proud of

We're proud of successfully integrating the Sonar API across every inventory view, complete with a caching layer and result-normalization logic that ensures users always see consistent, high-quality insights without manual refreshes. We overcame the challenge of handling schema variations in AI responses by implementing robust validation and fallback mechanisms, ensuring a smooth user experience even when API responses changed.

What we learned

Coordinating React state between live API responses, background inventory syncs, and user edits demanded a clearly defined global store and strict separation of concerns to avoid race conditions. We discovered that non-deterministic AI outputs must be normalized and cached before visualization; otherwise, tiny variations can break charts and confuse users. Early crashes caused by unexpected or missing Sonar fields drove home the importance of runtime schema validation and sensible default fallbacks. Lastly, we found that client-side request throttling and robust retry logic aren’t just “nice to have” but essential when you’re building critical features on top of an external AI service.

What's next for SupplySense

Next steps for SupplySense include adding real-time market price tracking to help users make informed purchasing decisions, implementing automated inventory rebalancing suggestions based on historical usage patterns, and adding multi-currency support for global operations. We also plan to introduce collaborative features, such as team sharing and permissions, and add support for multiple warehouses and locations. Additionally, we aim to develop a mobile app for on-the-go inventory management and integrate with popular accounting systems for seamless financial tracking.

Built With

Share this project:

Updates