A production-ready Next.js application that combines web search with AI-powered content summarization. Built with the App Router, this application uses the Exa API for intelligent web search and Cohere's command-r-plus model for generating concise summaries.
- Real-time Search: Query the web using Exa's advanced search API
- AI Summaries: Generate intelligent summaries using Cohere's command-r-plus model
- Rich Results: Each result includes title, URL, text snippet, and AI-generated summary
- Subpage Analysis: Discover and summarize related pages with horizontal carousel navigation
- Responsive Design: Beautiful, mobile-first design built with TailwindCSS
- Next.js App Router: Modern server-side rendering and API routes
- Rate Limiting: Built-in protection against API abuse
- Caching: Intelligent caching layer for improved performance
- Error Handling: Comprehensive error handling with retry logic
- Loading States: Beautiful loading animations and skeleton components
- TypeScript: Full type safety throughout the application
- Node.js 18+
- pnpm (recommended) or npm
- Exa API key (Get one here)
- Cohere API key (Get one here)
-
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env.local
Edit
.env.localand add your API keys:EXA_API_KEY=your_exa_api_key_here COHERE_API_KEY=your_cohere_api_key_here # Optional configurations RATE_LIMIT_REQUESTS_PER_MINUTE=60 CACHE_TTL_SECONDS=300
-
Run the development server
pnpm dev
-
Open your browser Navigate to http://localhost:3000
/api/search(POST): Main search endpoint that orchestrates Exa search and Cohere summarization
components/
└── search/
├── SearchInput.tsx # Search input with suggestions
├── SearchResults.tsx # Results display with cards
├── LoadingState.tsx # Loading animations
└── ErrorState.tsx # Error handling UI
- Framework: Next.js 15.5.0 with App Router
- Styling: TailwindCSS v4 with custom design system
- APIs: Exa (search) + Cohere (AI summarization)
- Type Safety: TypeScript with strict mode
- Icons: Lucide React
-
Push to GitHub
git add . git commit -m "Initial commit" git push origin main
-
Deploy with Vercel
- Visit vercel.com
- Import your GitHub repository
- Add environment variables in the dashboard
- Deploy!
-
Environment Variables in Vercel
- Go to your project dashboard
- Navigate to Settings → Environment Variables
- Add
EXA_API_KEYandCOHERE_API_KEY
We chose Cohere's command-r-plus model for summarization because:
- Optimized for Reasoning: Excellent at understanding context and generating coherent summaries
- Production Stable: Reliable performance for production applications
- Nuanced Synthesis: Better at synthesizing information compared to other models like command-a-2025
- Consistent Quality: Generates high-quality, concise summaries consistently