|
8 | 8 | ## Getting Started
|
9 | 9 | [Live Demo](https://code-graph.falkordb.com/)
|
10 | 10 |
|
| 11 | +## Run locally |
| 12 | +This project is composed of three pieces: |
| 13 | + |
| 14 | +1. FalkorDB Graph DB - this is where your graphs are stored and queried |
| 15 | +2. Code-Graph-Backend - backend logic |
| 16 | +3. Code-Graph-Frontend - website |
| 17 | + |
| 18 | +You'll need to start all three components: |
| 19 | + |
11 | 20 | ### Run FalkorDB
|
12 | 21 |
|
13 | 22 | ```bash
|
14 | 23 | docker run -p 6379:6379 -it --rm falkordb/falkordb
|
15 | 24 | ```
|
16 | 25 |
|
17 |
| -### Install node packages |
| 26 | +### Run Code-Graph-Backend |
| 27 | + |
| 28 | +#### Clone the Backend |
18 | 29 |
|
19 | 30 | ```bash
|
20 |
| -npm install |
| 31 | +git clone https://github.com/FalkorDB/code-graph-backend.git |
21 | 32 | ```
|
22 | 33 |
|
23 |
| -### Set your OpenAI key |
| 34 | +#### Setup environment variables |
| 35 | + |
| 36 | +`SECRET_TOKEN` - user defined token used to authorize the request |
24 | 37 |
|
| 38 | +```bash |
| 39 | +export FALKORDB_HOST=localhost FALKORDB_PORT=6379 \ |
| 40 | + OPENAI_API_KEY=<YOUR OPENAI_API_KEY> SECRET_TOKEN=<YOUR_SECRECT_TOKEN> \ |
| 41 | + FLASK_RUN_HOST=0.0.0.0 FLASK_RUN_PORT=5000 |
25 | 42 | ```
|
26 |
| -export OPENAI_API_KEY=YOUR_OPENAI_API_KEY |
| 43 | + |
| 44 | +#### Install dependencies & run |
| 45 | + |
| 46 | +```bash |
| 47 | +cd code-graph-backend |
| 48 | + |
| 49 | +pip install --no-cache-dir -r requirements.txt |
| 50 | + |
| 51 | +flask --app api/index.py run --debug > flask.log 2>&1 & |
| 52 | + |
27 | 53 | ```
|
28 | 54 |
|
29 |
| -### Run the development server |
| 55 | +### Run Code-Graph-Frontend |
| 56 | + |
| 57 | +#### Clone the Frontend |
30 | 58 |
|
31 | 59 | ```bash
|
| 60 | +git clone https://github.com/FalkorDB/code-graph.git |
| 61 | +``` |
| 62 | + |
| 63 | +#### Setup environment variables |
| 64 | + |
| 65 | +```bash |
| 66 | +export BACKEND_URL=http://${FLASK_RUN_HOST}:${FLASK_RUN_PORT} \ |
| 67 | + SECRET_TOKEN=<YOUR_SECRECT_TOKEN> OPENAI_API_KEY=<YOUR_OPENAI_API_KEY> |
| 68 | +``` |
| 69 | + |
| 70 | +#### Install dependencies & run |
| 71 | + |
| 72 | +```bash |
| 73 | +cd code-graph |
| 74 | +npm install |
32 | 75 | npm run dev
|
33 | 76 | ```
|
34 | 77 |
|
35 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 78 | +### Process a local repository |
| 79 | +```bash |
| 80 | +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>" |
| 81 | +``` |
| 82 | + |
| 83 | +Note: At the moment code-graph can analyze both the C & Python source files. |
| 84 | +Support for additional languages e.g. JavaScript, Go, Java is planned to be added |
| 85 | +in the future. |
| 86 | + |
| 87 | +Browse to [http://localhost:3000](http://localhost:3000) |
0 commit comments