A modern Next.js application for visualizing and interacting with the SingleStore Knowledge Graph system.
-
Interactive Knowledge Graph
- Force-directed graph visualization
- Category-based node coloring
- Dynamic node sizing based on connections
- Zoom and pan controls
- Node dragging and hover tooltips
-
Search Interface
- Natural language search
- AI-generated responses
- Relevance scoring
- Entity highlighting
- Real-time results
-
Document Management
- PDF upload with progress tracking
- Document statistics dashboard
- Processing status updates
- Error handling and recovery
- Node.js 18+
- pnpm
- Backend API endpoint
Create a .env.local
file in the frontend directory:
NEXT_PUBLIC_API_URL=http://localhost:8000 # or your deployed backend URL on Railway
NEXT_PUBLIC_API_KEY=exampleKey
# Install dependencies
pnpm install
# Start development server
pnpm dev
Open http://localhost:3000 to view the application.
The frontend communicates with the backend through the following endpoints:
-
Search API
// POST /kag-search interface SearchRequest { query: string; top_k: number; } interface SearchResult { content: string; vector_score: number; text_score: number; combined_score: number; doc_id: number; entities: Array<{ name: string; type: string; description: string; }>; }
-
Knowledge Base Stats
// GET /kbdata interface KBStats { total_documents: number; total_chunks: number; total_entities: number; total_relationships: number; documents: DocumentStats[]; last_updated: string; }
-
Graph Data
// GET /graph-data interface GraphData { nodes: GraphNode[]; links: GraphLink[]; }
-
Connect Repository
- Link your GitHub repository to Railway
- Select the frontend directory as the source
-
Configure Build
# Build command pnpm install && pnpm build # Start command pnpm start
-
Environment Variables Add to Railway dashboard:
NEXT_PUBLIC_API_URL
NEXT_PUBLIC_API_KEY
# Production build
pnpm build
# Start production server
pnpm start
frontend/
├── app/ # Next.js app router pages
├── components/ # React components
│ ├── KnowledgeGraph.tsx # Graph visualization
│ ├── SearchForm.tsx # Search interface
│ └── ...
├── utils/ # Utility functions
│ └── api.ts # API client
└── public/ # Static assets
KnowledgeGraph
: Force-directed graph visualizationSearchForm
: Search interface with AI responsesNavHeader
: Navigation and layout componentProcessingStatus
: Upload progress tracking
- Tailwind CSS for styling
- Custom theme configuration in
tailwind.config.ts
- Responsive design with mobile-first approach
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.