Inspiration Every week, founders and investors manually Google companies they're tracking — scanning through news articles, job boards, patent filings, and social media — trying to piece together whether a competitor is thriving or struggling. I wanted to build a system that does this automatically: collect public signals from across the web, reason over the evidence with AI, and deliver a single explainable risk score with citations. The name says it all — MarketAutopsy performs a forensic examination of a company's public footprint and surfaces what matters before it becomes obvious to everyone else. How I Built It Frontend: The entire UI is built with Next.js 14 (App Router) and Tailwind CSS, featuring a custom dark theme with Material Design 3-inspired design tokens. The landing page includes a real-time WebGL neural-network shader and a Three.js wireframe brain visualization — both hand-written in GLSL and JavaScript respectively. Backend: Next.js API routes handle authentication (bcrypt + httpOnly cookies), company CRUD, and the AI research pipeline. Data is persisted in PostgreSQL via Prisma ORM, with full schema relationships for users, companies, signals, scores, snapshots, timeline events, and executive reports. AI Pipeline: The core is a multi-turn agentic system built on OpenAI's function-calling API. The agent has access to 7 data tools — GDELT (global news), Greenhouse/Lever (job postings), PatentsView (patents), Reddit (sentiment), NewsAPI (articles), and Product Hunt (launches) — and autonomously decides which to call, how many rounds of evidence to collect, and when it has sufficient data to score. The scoring engine combines weighted dimensions: $$S = w_1 \cdot H + w_2 \cdot C + w_3 \cdot P + w_4 \cdot N + w_5 \cdot F + w_6 \cdot L + w_7 \cdot S_s + w_8 \cdot P_p$$ where $H$ = hiring health, $C$ = customer sentiment, $P$ = patent activity, $N$ = news sentiment, $F$ = funding health, $L$ = leadership stability, $S_s$ = strategic signals, and $P_p$ = partnership activity — each weighted by empirical importance (e.g., $w_2 = 0.23$ for sentiment, $w_1 = 0.18$ for hiring). Animations: Framer Motion powers page transitions and staggered reveals. The AnimatedLogo is a 437-line SVG animation with neural-network draw-in, particle flow, and sparkle rings. What I Learned

  • Auth is harder than it looks. I went from no auth → JWT → unsigned cookies → bcrypt + httpOnly cookies. Each iteration taught me more about session security, CSRF protection, and the tradeoffs of stateless vs. stateful auth.
  • Dual data stores are a trap. The project started with an in-memory store, then I added Prisma for persistence. Running both in parallel caused silent data loss on Vercel's serverless functions. Consolidating to Prisma as the single source of truth was the right call.
  • AI agent design is an art. Structuring the system prompt so the model knows when to stop collecting evidence, how to handle contradictions between sources, and how to produce structured JSON output with citations — that took many iterations.
  • Real-time data is messy. Every public API (GDELT, PatentsView, Reddit) has different rate limits, response formats, and reliability. Building a resilient collector layer with graceful fallbacks was essential. Challenges
  • Database hosting. Supabase free tier timed out. Turso's website kept erroring during signup. Neon worked on the third try — the connection string setup was smooth after that.
  • Serverless cold starts. The in-memory store dies between requests on Vercel. Migrating all reads to Prisma/PostgreSQL fixed this but required rewriting every API route.
  • AI model availability. The initial model identifier was invalid, causing the entire AI pipeline to silently fail and fall back to keyword regex. Debugging this required adding explicit error logging.
  • Building for a hackathon timeline. Balancing feature ambition (WebGL shaders, 3D visualizations, multi-turn AI agents) with a working demo meant making hard choices about what to polish vs. what to ship.

Built With

  • ai-agents
  • bcryptjs
  • dark-ui
  • framer-motion
  • lucide-react
  • market-intelligence
  • neon
  • nextjs
  • openai
  • postgresql
  • prisma
  • real-time-data
  • recharts
  • shadcn
  • tailwindcss
  • three.js
  • typescript
  • vercel
  • webgl
Share this project:

Updates