From 58eb3b5f3ac2c0d0182a87dc3f921653643ec9c8 Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Wed, 8 Jan 2025 17:54:47 +0200 Subject: [PATCH 1/2] updated readme with setup instructions --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 02bfb84d..5abcf46f 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,76 @@ ## Getting Started [Live Demo](https://code-graph.falkordb.com/) +## Run locally +This project is composed of three pieces: + +1. FalkorDB Graph DB - this is where your graphs are stored and queried +2. Code-Graph-Backend - backend logic +3. Code-Graph-Frontend - website + +You'll need to start all three components: + ### Run FalkorDB ```bash docker run -p 6379:6379 -it --rm falkordb/falkordb ``` -### Install node packages +### Run Code-Graph-Backend + +#### Clone the Backend ```bash -npm install +git clone https://github.com/FalkorDB/code-graph-backend.git ``` -### Set your OpenAI key +#### Setup environment variables +```bash +export FALKORDB_HOST=falkordb FALKORDB_PORT=6379 \ + OPENAI_API_KEY= SECRET_TOKEN=Vespa \ + FLASK_RUN_HOST=0.0.0.0 FLASK_RUN_PORT=5000 ``` -export OPENAI_API_KEY=YOUR_OPENAI_API_KEY + +#### Install dependencies & run + +```bash +cd code-graph-backend + +pip install --no-cache-dir -r requirements.txt + +flask --app api/index.py run --debug ``` -### Run the development server +### Run Code-Graph-Frontend + +#### Clone the Frontend ```bash +git clone https://github.com/FalkorDB/code-graph.git +``` + +#### Setup environment variables + +```bash +export BACKEND_URL=http://localhost:5000 SECRET_TOKEN=Vespa OPENAI_API_KEY= +``` + +#### Install dependencies & run + +```bash +cd code-graph +npm install npm run dev ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +### Process a local repository +```bash +curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "", "ignore": ["./.github", "./sbin", "./.git","./deps", "./bin", "./build"]}' -H "Authorization: Vespa" +``` + +Note: At the moment code-graph can analyze both the C & Python source files. +Support for additional languages e.g. JavaScript, Go, Java is planned to be added +in the future. + +Browse to [http://localhost:3000](http://localhost:3000) From 1912e2e045558e2c8cdc35f63649222283b0f917 Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 9 Jan 2025 11:29:31 +0200 Subject: [PATCH 2/2] address PR comments --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5abcf46f..edd18fcb 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,11 @@ git clone https://github.com/FalkorDB/code-graph-backend.git #### Setup environment variables +`SECRET_TOKEN` - user defined token used to authorize the request + ```bash -export FALKORDB_HOST=falkordb FALKORDB_PORT=6379 \ - OPENAI_API_KEY= SECRET_TOKEN=Vespa \ +export FALKORDB_HOST=localhost FALKORDB_PORT=6379 \ + OPENAI_API_KEY= SECRET_TOKEN= \ FLASK_RUN_HOST=0.0.0.0 FLASK_RUN_PORT=5000 ``` @@ -46,7 +48,8 @@ cd code-graph-backend pip install --no-cache-dir -r requirements.txt -flask --app api/index.py run --debug +flask --app api/index.py run --debug > flask.log 2>&1 & + ``` ### Run Code-Graph-Frontend @@ -60,7 +63,8 @@ git clone https://github.com/FalkorDB/code-graph.git #### Setup environment variables ```bash -export BACKEND_URL=http://localhost:5000 SECRET_TOKEN=Vespa OPENAI_API_KEY= +export BACKEND_URL=http://${FLASK_RUN_HOST}:${FLASK_RUN_PORT} \ + SECRET_TOKEN= OPENAI_API_KEY= ``` #### Install dependencies & run @@ -73,7 +77,7 @@ npm run dev ### Process a local repository ```bash -curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "", "ignore": ["./.github", "./sbin", "./.git","./deps", "./bin", "./build"]}' -H "Authorization: Vespa" +curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "", "ignore": ["./.github", "./sbin", "./.git","./deps", "./bin", "./build"]}' -H "Authorization: " ``` Note: At the moment code-graph can analyze both the C & Python source files.