Skip to content

Graph-RAG discovery engine built with Next.js, Gemini 3 Flash, and Neon Postgres. Visualizes multi-hop knowledge connections via React Flow and triplet extraction.

Notifications You must be signed in to change notification settings

adityachauhan0/wait-whaa-win

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Wait, Whaa? ๐Ÿง โœจ

The Shocking Discovery Engine - A Next.js powered knowledge graph that finds surprising connections using Graph-RAG and AI

Next.js TypeScript React Flow Vercel Screenshot 2025-12-20 135452


๐ŸŒŸ What is Wait, Whaa?

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

โœจ Features

๐ŸŽฏ Core Capabilities

  • 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

๐Ÿ—๏ธ Architecture

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]
Loading

Tech Stack

  • 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

๐Ÿš€ Getting Started

Prerequisites

  • 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)

Installation

  1. Clone the repository

    git clone https://github.com/adityachauhan0/wait-whaa-win.git
    cd wait-whaa-win
  2. Install dependencies

    npm install
    # or
    pnpm install
  3. Set up environment variables

    Create a .env.local file 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...
  4. Set up the database

    # Generate migration
    npx drizzle-kit generate
    
    # Push to database
    npx drizzle-kit push
  5. Run the development server

    npm run dev
  6. Open your browser

    http://localhost:3000
    

๐Ÿ“– Usage

Adding Knowledge

  1. Single Facts: Type any fact or idea into the discovery input

    • Example: "Osama bin Laden founded Al-Qaeda in 1988"
  2. URL Ingestion: Click "Or ingest knowledge from a URL" to extract entities from web pages

  3. Watch Connections Form: The AI automatically finds surprising links between your inputs

Exploring the Graph

  • 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

Advanced Queries

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

๐ŸŽจ Screenshots

Clean Knowledge Graph

The graph displays entities as glowing purple nodes with animated cyan connections, keeping text labels hidden until you click an edge. Screenshot 2025-12-20 135737

Connection Details Panel

Click any edge to see a beautiful slide-out panel showing the source, target, and AI-generated relationship explanation. Screenshot 2025-12-20 135813

Multi-hop paths are visualized with clear step-by-step relationship chains.


๐Ÿ”ง Configuration

Database Schema

The project uses three main tables:

  • entities: Stores knowledge nodes with vector embeddings
  • connections: Stores relationships for visualization
  • triplets: Stores structured knowledge as [Subject] โ†’ [Predicate] โ†’ [Object]

AI Models

  • Embedding: text-embedding-004 (768 dimensions)
  • Generation: gemini-3-flash-preview

๐Ÿšข Deployment

Deploy to Vercel

  1. Push your code to GitHub
  2. Import project in Vercel
  3. Add environment variables:
    • NEON_DATABASE_URL
    • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
    • CLERK_SECRET_KEY
    • GEMINI_API_KEY
  4. Deploy!

The build is optimized and production-ready.


๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest features
  • ๐Ÿ”ง Submit pull requests

๐Ÿ“ License

This project is open source and available under the MIT License.


๐Ÿ™ Acknowledgments

  • 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

๐Ÿ› ๏ธ Development

Available Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint

Project Structure

wait-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

๐Ÿ”ฎ Future Enhancements

  • 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

๐Ÿ’ฌ Support

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.

About

Graph-RAG discovery engine built with Next.js, Gemini 3 Flash, and Neon Postgres. Visualizes multi-hop knowledge connections via React Flow and triplet extraction.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published