An interactive web application that transforms documents into visual knowledge graphs. Extract concepts and relationships from text using AI (Ollama), store them in SQLite, and visualize them with an interactive force-directed graph.
- Node.js (v18+)
- Ollama (for AI topic generation - optional)
-
Clone the repository and install dependencies:
npm install
-
Set up the database:
npm run setup-db
-
(Optional) Seed with sample data:
npm run seed-data
-
Start the server:
npm start
-
Open your browser:
http://localhost:3001
To enable AI-powered topic generation:
-
Install Ollama: ollama.ai
-
Start Ollama server:
ollama serve
-
Install a model:
ollama pull llama2:7b
-
Configure model (optional): Create a
.envfile:OLLAMA_URL=http://localhost:11434 OLLAMA_MODEL=llama2:7b
id(INTEGER, PRIMARY KEY) - Unique identifiername(TEXT, NOT NULL) - Concept/entity nametype(TEXT) - Node type (concept, algorithm, architecture, field, etc.)description(TEXT) - Detailed description of the concept
id(INTEGER, PRIMARY KEY) - Unique identifiersrc_id(INTEGER, NOT NULL) - Source node ID (foreign key)relation(TEXT, NOT NULL) - Relationship type (e.g., "uses", "includes", "depends_on")dst_id(INTEGER, NOT NULL) - Destination node ID (foreign key)evidence(TEXT) - Optional evidence/context supporting the relationship
- Open
http://localhost:3001in your browser - The graph automatically loads from the database
- Interact with nodes:
- Click any node to see its description and connections
- Drag nodes to reposition them
- Zoom with mouse wheel
- Pan by dragging the background
- Type a topic or description in the input box (top-left)
- Click "Generate Edges & Descriptions" or press
Ctrl+Enter(Mac:Cmd+Enter) - Ollama will generate related concepts and relationships
- Review the generated edges and concepts in the panel
Returns the full graph data for visualization.
Response:
{
"nodes": [
{
"id": "1",
"name": "Machine Learning",
"type": "concept",
"description": "A method of data analysis..."
}
],
"links": [
{
"source": "1",
"target": "2",
"relation": "includes",
"evidence": "Neural networks are a subset..."
}
]
}Returns all nodes in the database.
Returns all edges in the database.
Generates nodes and edges for a topic using Ollama.
Request:
{
"description": "Machine Learning"
}Response:
{
"success": true,
"topic": "Machine Learning",
"description": "A brief description...",
"edges": [...],
"concepts": [...]
}Health check endpoint.
CMU-Claude-Builder/
├── data/
│ └── knowledge_graph.db # SQLite database
├── public/
│ └── index.html # Frontend visualization
├── scripts/
│ ├── setup-db.js # Database initialization
│ └── seed-data.js # Sample data seeding
├── db.js # Database helper class
├── server.js # Express server & API
├── package.json
└── README.md
npm start- Start the servernpm run setup-db- Initialize/create database tablesnpm run seed-data- Clear and seed database with sample data
The db.js file provides a Database class with methods:
const Database = require('./db');
const db = new Database();
await db.connect();
// Create a node with description
const node = await db.createNode('Machine Learning', 'concept', 'Description here');
// Create an edge
const edge = await db.createEdge(1, 'relates_to', 2, 'Evidence text');
// Get full graph
const graph = await db.getFullGraph();
// Clear all data
await db.clearAll();
await db.close();- Nodes are positioned using a physics simulation
- More connected nodes appear larger and more central
- Clusters form naturally based on relationships
- concept - Blue (#60a5fa)
- algorithm - Green (#34d399)
- architecture - Pink (#f472b6)
- field - Yellow (#fbbf24)
Node size is calculated based on the number of connections:
- More connections = larger node
- Helps identify key concepts in the knowledge graph
Create a .env file (optional):
PORT=3001
OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama2:7b
MIT