The Shocking Discovery Engine - A Next.js powered knowledge graph that finds surprising connections using Graph-RAG and AI
Wait, Whaa? is an AI-powered discovery engine that creates a live knowledge graph from your thoughts, ideas, and research. It uses Graph-RAG (Retrieval-Augmented Generation with Graph structures) to find non-obvious, surprising connections between seemingly unrelated concepts.
Tip
Check out the Detailed Documentation for a deep dive into the Graph-RAG implementation and file structure!
Instead of simple vector similarity, it:
- ๐งฌ Extracts knowledge triplets
[Subject] โ [Predicate] โ [Object] - ๐ Multi-hop reasoning across your knowledge base
- ๐ Bridge hypothesis generation to connect distant concepts
- ๐ Interactive graph visualization with real-time updates
-
Graph-RAG Intelligence
- Triplet extraction from natural language
- Multi-stage retrieval (entity extraction โ database search โ bridge hypothesis โ secondary search)
- Path-based discovery through knowledge graphs
- Gemini 3 Flash powered reasoning
-
Beautiful Visualization
- Interactive knowledge graph with Deep Midnight theme
- Click edges to reveal connection details
- Animated pulse effects on connections
- Draggable nodes with smooth physics
-
Smart Ingestion
- Add facts through natural language input
- URL ingestion for bulk knowledge extraction
- Automatic entity and relationship detection
- Vector embeddings for semantic search
-
Database Management
- Clear connections without losing entities
- Complete database reset
- Cascade deletion for data integrity
graph TD
A[User Input] --> B[Entity Extraction]
B --> C[Vector Embedding]
C --> D[Database Search]
D --> E{Match Found?}
E -->|Yes| F[Path Discovery]
E -->|No| G[Bridge Hypothesis]
G --> H[Secondary Search]
H --> F
F --> I[Relationship Graph]
I --> J[Visual Knowledge Graph]
- Frontend: Next.js 16, React 19, React Flow, Framer Motion
- Backend: Next.js Server Actions
- Database: Neon Postgres with pgvector extension
- ORM: Drizzle ORM
- AI: Google Gemini 3 Flash (text-embedding-004 + gemini-3-flash-preview)
- Auth: Clerk
- Styling: Tailwind CSS 4
- Deployment: Vercel
- Node.js 18+ and npm/pnpm
- A Neon database account (free tier works!)
- Clerk account for authentication
- Google AI Studio API key (Gemini 3 Flash)
-
Clone the repository
git clone https://github.com/adityachauhan0/wait-whaa-win.git cd wait-whaa-win -
Install dependencies
npm install # or pnpm install -
Set up environment variables
Create a
.env.localfile in the root directory:# Neon Database NEON_DATABASE_URL=postgresql://user:password@host/database?sslmode=require # Clerk Authentication NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_... CLERK_SECRET_KEY=sk_test_... # Gemini API GEMINI_API_KEY=AIzaSy...
-
Set up the database
# Generate migration npx drizzle-kit generate # Push to database npx drizzle-kit push
-
Run the development server
npm run dev
-
Open your browser
http://localhost:3000
-
Single Facts: Type any fact or idea into the discovery input
- Example: "Osama bin Laden founded Al-Qaeda in 1988"
-
URL Ingestion: Click "Or ingest knowledge from a URL" to extract entities from web pages
-
Watch Connections Form: The AI automatically finds surprising links between your inputs
- Zoom/Pan: Use mouse wheel and drag to navigate
- Click Nodes: Select to highlight connections
- Click Edges: View detailed relationship explanations in the slide-out panel
- MiniMap: Quick navigation for large graphs
Try questions that require multi-hop reasoning:
- "Who were the co-founders of Al-Qaeda?" โ Traverses relationships to find Ayman al-Zawahiri
- "How is terrorism related to Middle Eastern politics?" โ Uses bridge concepts to connect distant ideas
The graph displays entities as glowing purple nodes with animated cyan connections, keeping text labels hidden until you click an edge.
Click any edge to see a beautiful slide-out panel showing the source, target, and AI-generated relationship explanation.
Multi-hop paths are visualized with clear step-by-step relationship chains.
The project uses three main tables:
entities: Stores knowledge nodes with vector embeddingsconnections: Stores relationships for visualizationtriplets: Stores structured knowledge as[Subject] โ [Predicate] โ [Object]
- Embedding:
text-embedding-004(768 dimensions) - Generation:
gemini-3-flash-preview
- Push your code to GitHub
- Import project in Vercel
- Add environment variables:
NEON_DATABASE_URLNEXT_PUBLIC_CLERK_PUBLISHABLE_KEYCLERK_SECRET_KEYGEMINI_API_KEY
- Deploy!
The build is optimized and production-ready.
Contributions are welcome! Feel free to:
- ๐ Report bugs
- ๐ก Suggest features
- ๐ง Submit pull requests
This project is open source and available under the MIT License.
- Google Gemini for powerful AI capabilities
- Neon for serverless Postgres with pgvector
- React Flow for beautiful graph visualization
- Clerk for seamless authentication
- Vercel for effortless deployment
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLintwait-whaa-win/
โโโ src/
โ โโโ app/
โ โ โโโ actions.ts # Graph-RAG server actions
โ โ โโโ dashboard/
โ โ โ โโโ page.tsx # Main dashboard
โ โ โ โโโ KnowledgeGraph.tsx
โ โ โโโ page.tsx # Landing page
โ โโโ components/
โ โ โโโ Discovery.tsx # Input + results
โ โ โโโ GraphNode.tsx # Custom node styling
โ โโโ db/
โ โโโ schema.ts # Database schema
โ โโโ index.ts # DB connection
โโโ scripts/
โ โโโ setup-db.ts # Database setup
โโโ drizzle/ # Migration files
- Graph algorithms (PageRank, centrality)
- Temporal reasoning with time-based relationships
- Confidence scoring for paths
- Export graph as image/JSON
- Search and filter nodes
- Custom layout algorithms
- Mobile app
If you have questions or need help:
- Open an issue
- Star โญ the repo if you find it useful!
Built with โค๏ธ and lots of โ
Discover the connections you never knew existed.