A competitor analysis tool built with Next.js and Valyu Deep Research API.
Get comprehensive insights about any competitor with detailed reports on products, market positioning, and strategy.
Try it live now!
- Deep Research: Leverages Valyu's AI to search multiple sources and analyze content
- Comprehensive Reports: Detailed analysis including company overview, products, market positioning, and recent developments
- Beautiful UI: Modern, responsive side-by-side interface with dark mode support
- Real-time Updates: Live progress tracking with step-by-step status updates (5-10 minutes)
- Progress Indicators: Visual progress bar showing current step and completion percentage
- Mobile Friendly: Fully responsive design that adapts to all screen sizes
- PDF Export: Download research reports as PDF (auto-generated with results)
- Source Citations: All research backed by verifiable sources
- Live Results: Results appear in real-time on the right panel as research progresses
Self-hosted mode is the simplest way to run the app. You only need a Valyu API key.
- Node.js 20+ installed
- A Valyu API key (get one at Valyu Platform)
- Clone and install dependencies:
pnpm install- Set up environment variables:
Create a .env.local file in the root directory:
VALYU_API_KEY=your_valyu_api_key_hereThat's it! No other configuration needed.
- Run the development server:
pnpm run dev- Open your browser:
Navigate to http://localhost:3000
For production deployments on the Valyu platform, you can enable OAuth authentication. In this mode, users sign in with their Valyu account and API usage is billed to their account.
Set the following environment variables:
# Enable Valyu platform mode
NEXT_PUBLIC_APP_MODE=valyu
# OAuth credentials (contact contact@valyu.ai)
NEXT_PUBLIC_VALYU_AUTH_URL=https://auth.valyu.ai
NEXT_PUBLIC_VALYU_CLIENT_ID=your_client_id
VALYU_CLIENT_SECRET=your_client_secret
VALYU_APP_URL=https://platform.valyu.ai
NEXT_PUBLIC_REDIRECT_URI=http://localhost:3000/auth/valyu/callback| Feature | Self-Hosted | Valyu Platform |
|---|---|---|
| API Key Required | Yes (server-side) | No |
| User Sign-in | Not required | Required |
| Billing | Your API key | User's Valyu account |
| Best For | Personal/team use | Public deployments |
- Enter Details (Left Panel): Add competitor's website URL and initial context
- Start Analysis: Click "Start Deep Research Analysis"
- Watch Progress (Right Panel): Real-time progress updates appear immediately
- See current step and percentage complete
- Visual progress bar shows research status
- Live status messages keep you informed
- Review Results: Comprehensive report appears automatically when complete
- Beautifully formatted markdown content
- Clickable source citations
- Download PDF report with one click
app/
├── api/
│ └── competitor-analysis/
│ ├── route.ts # API endpoint for creating research tasks
│ ├── cancel/
│ │ └── route.ts # API endpoint for cancelling research tasks
│ └── status/
│ └── route.ts # API endpoint for checking task status and progress
├── components/
│ ├── CompetitorAnalysisForm.tsx # Input form with polling logic
│ ├── ResearchResults.tsx # Results display with loading states
│ └── Sidebar.tsx # Navigation sidebar component
├── page.tsx # Main homepage with side-by-side layout
├── layout.tsx # Root layout
└── globals.css # Global styles and animations
lib/
└── mode.ts # App mode detection utilities
The deep research API is configured in route.ts:
- Model:
fast(~5 min) - Can change tostandard(10-20 min) orheavy(up to 90 min) - Architecture: Asynchronous with client-side polling (no server timeouts!)
- Poll Interval: Checks status every 10 seconds
- Output Formats: Markdown and PDF
- Progress Tracking: Real-time step-by-step progress updates
- Max Duration: No limit - polling continues until completion
- Push your code to GitHub
- Create a new project on Railway
- Click "Deploy from GitHub repo" and select your repository
- Add your
VALYU_API_KEYenvironment variable in the Variables tab - Railway will auto-detect Next.js and deploy!
Note: Railway's free tier works great for this app. The client-side polling architecture means no server timeout issues.
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS 4 with Typography plugin
- Markdown Rendering: react-markdown with GitHub Flavored Markdown
- AI Research: Valyu Deep Research API
- Deployment: Railway
valyu-js- Official Valyu SDK for deep researchreact-markdown- Beautiful markdown renderingremark-gfm- GitHub Flavored Markdown support@tailwindcss/typography- Typography styles for prose content


