Skip to content

Commit

Permalink
Merge pull request #348 from FalkorDB/setup-instructions
Browse files Browse the repository at this point in the history
updated readme with setup instructions
  • Loading branch information
swilly22 authored Jan 9, 2025
2 parents 63ba49e + 1912e2e commit f419fe6
Showing 1 changed file with 58 additions and 6 deletions.
64 changes: 58 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,80 @@
## 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

`SECRET_TOKEN` - user defined token used to authorize the request

```bash
export FALKORDB_HOST=localhost FALKORDB_PORT=6379 \
OPENAI_API_KEY=<YOUR OPENAI_API_KEY> SECRET_TOKEN=<YOUR_SECRECT_TOKEN> \
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 > flask.log 2>&1 &

```

### 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://${FLASK_RUN_HOST}:${FLASK_RUN_PORT} \
SECRET_TOKEN=<YOUR_SECRECT_TOKEN> OPENAI_API_KEY=<YOUR_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": "<PATH_TO_LOCAL_REPO>", "ignore": ["./.github", "./sbin", "./.git","./deps", "./bin", "./build"]}' -H "Authorization: <YOUR_SECRECT_TOKEN>"
```

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)

0 comments on commit f419fe6

Please sign in to comment.