Skip to content

FalkorDB/code-graph

Repository files navigation

CodeGraph - Knowledge Graph Visualization Tool

Visualize your repository with our graph for code analysis

Try Free Dockerhub Discord Workflow

Alt Text

👉🏻Live Demo

Running Locally

This project consists of three core components:

  1. FalkorDB Graph DB – Stores and queries your graphs.
  2. Code-Graph-Backend – Handles backend logic.
  3. Code-Graph-Frontend – Provides the web interface.

To set up the project, you’ll need to start all three components.

1. Start FalkorDB

Run the following command to start FalkorDB using Docker:

docker run -p 6379:6379 -it --rm falkordb/falkordb

2. Start the Backend

Clone the Backend Repository

git clone https://github.com/FalkorDB/code-graph-backend.git
cd code-graph-backend

Set Up Environment Variables

Define the required environment variables:

export FALKORDB_HOST=localhost FALKORDB_PORT=6379 \
    OPENAI_API_KEY=<YOUR_OPENAI_API_KEY> SECRET_TOKEN=<YOUR_SECRET_TOKEN> \
    FLASK_RUN_HOST=0.0.0.0 FLASK_RUN_PORT=5000

SECRET_TOKEN is a user-defined token used for request authorization.

Install Dependencies & Start the Backend

pip install --no-cache-dir -r requirements.txt
flask --app api/index.py run --debug > flask.log 2>&1 &

3. Start the Frontend

Clone the Frontend Repository

git clone https://github.com/FalkorDB/code-graph.git
cd code-graph

Set Up Environment Variables

export BACKEND_URL=http://${FLASK_RUN_HOST}:${FLASK_RUN_PORT} \
    SECRET_TOKEN=<YOUR_SECRET_TOKEN> OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

Install Dependencies & Start the Frontend

npm install
npm run dev

4. Process a Local Repository

Use the following curl command to analyze a local repository:

curl -X POST http://127.0.0.1:5000/analyze_folder \
    -H "Content-Type: application/json" \
    -H "Authorization: <YOUR_SECRET_TOKEN>" \
    -d '{"path": "<PATH_TO_LOCAL_REPO>", "ignore": ["./.github", "./sbin", "./.git", "./deps", "./bin", "./build"]}'

Note: At the moment code-graph can analyze both the Java & Python source files. Support for additional languages e.g. C, JavaScript, Go is planned to be added in the future.

5. Access the Web Interface

Once everything is running, open your browser and go to:

http://localhost:3000

Community

Have questions or feedback? Reach out via:

⭐️ If you find this repository helpful, please consider giving it a star!

Knowledge Graph, Code Analysis, Code Visualization, Dead Code Analysis, Graph Database