How thdwlndjs/knowledge-graph works
This is a small FastAPI knowledge-graph API. A client submits a paper to the graph endpoint; the router passes it to GraphService, which delegates creation or listing to Neo4jRepository, where queries run through the Neo4j driver. The API also exposes a health response. The graph reflects the sampled routes and persistence code; external HTTP and database interactions are shown only where the code supports them.
Main entry points: graph.py Graph Routes · neo4j_repository.py Paper Repository · neo4j.py Neo4j Driver · main.py FastAPI App
Components 10
HTTP API
- FastAPI App
backend/app/main.py - Graph Routes
backend/app/routers/graph.py - Health Route
backend/app/routers/health.py - Paper Schema
backend/app/schemas.py
Graph Logic
- Graph Service
backend/app/services/graph_service.py
Neo4j Storage
- Paper Repository
backend/app/repository/neo4j_repository.py - Neo4j Driver
backend/app/db/neo4j.py - Neo4j Config
backend/core/config.py
Other components
- API Client
- Neo4j Database
Connections 11
- FastAPI App → Health Route: registers
backend/app/main.py - FastAPI App → Graph Routes: registers
backend/app/main.py - API Client → Graph Routes: sends requests
- API Client → Health Route: checks status
- Graph Routes → Paper Schema: accepts
backend/app/routers/graph.py - Graph Routes → Graph Service: calls
backend/app/routers/graph.py - Graph Service → Paper Repository: delegates
backend/app/services/graph_service.py - Paper Repository → Neo4j Driver: opens sessions
backend/app/repository/neo4j_repository.py - Neo4j Driver → Neo4j Config: uses settings
backend/app/db/neo4j.py - Neo4j Driver → Neo4j Database: connects
- Paper Repository → Neo4j Database: reads and writes
backend/app/repository/neo4j_repository.py