You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`FALKORDB_HOST`| FalkorDB server hostname | No | localhost |
85
-
|`FALKORDB_PORT`| FalkorDB server port | No | 6379 |
79
+
|`FALKORDB_HOST`| FalkorDB hostname | No |`localhost`|
80
+
|`FALKORDB_PORT`| FalkorDB port | No |`6379`|
81
+
|`FALKORDB_USERNAME`| Optional FalkorDB username | No | empty |
82
+
|`FALKORDB_PASSWORD`| Optional FalkorDB password | No | empty |
83
+
|`SECRET_TOKEN`| Token checked by protected endpoints | No | empty |
84
+
|`CODE_GRAPH_PUBLIC`| Set `1` to skip auth on read-only endpoints | No |`0`|
85
+
|`ALLOWED_ANALYSIS_DIR`| Root path allowed for `/api/analyze_folder`| No | repository root |
86
+
|`MODEL_NAME`| LiteLLM model used by `/api/chat`| No |`gemini/gemini-flash-lite-latest`|
87
+
|`HOST`| Optional Uvicorn bind host for `start.sh`/`make run-*`| No |`0.0.0.0` or `127.0.0.1` depending on command |
88
+
|`PORT`| Optional Uvicorn bind port for `start.sh`/`make run-*`| No |`5000`|
86
89
87
-
Edit `.env` with your values:
90
+
The chat endpoint also needs the provider credential expected by your chosen `MODEL_NAME`. The default model is Gemini, so set `GEMINI_API_KEY` unless you switch to a different LiteLLM provider/model.
88
91
89
-
```bash
90
-
FALKORDB_HOST=localhost
91
-
FALKORDB_PORT=6379
92
-
OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
93
-
SECRET_TOKEN=<YOUR_SECRET_TOKEN>
94
-
```
92
+
### Authentication behavior
93
+
94
+
- Send `Authorization: Bearer <SECRET_TOKEN>` (or the raw token string) when `SECRET_TOKEN` is configured.
95
+
- Read endpoints use the `public_or_auth` dependency.
96
+
- Mutating endpoints (`/api/analyze_folder`, `/api/analyze_repo`, `/api/switch_commit`) use the `token_required` dependency.
97
+
- If `SECRET_TOKEN` is unset, the current implementation accepts requests without an `Authorization` header.
98
+
- Setting `CODE_GRAPH_PUBLIC=1` makes the read-only endpoints public even when `SECRET_TOKEN` is configured.
95
99
96
-
### 3. Install Dependencies
100
+
### 3. Install dependencies
97
101
98
102
```bash
99
103
# Install backend dependencies
100
-
pip install -e ".[test]"
104
+
uv sync --all-extras
101
105
102
106
# Install frontend dependencies
103
107
npm install --prefix ./app
108
+
109
+
# Optional: install Playwright dependencies from the repo root
110
+
npm install
104
111
```
105
112
106
-
Or using Make:
113
+
If you do not use `uv`, `pip install -e ".[test]"` also installs the backend package and test dependencies.
114
+
115
+
### 4. Run the app
116
+
117
+
**Backend API with auto-reload:**
107
118
108
119
```bash
109
-
make install
120
+
uv run uvicorn api.index:app --host 127.0.0.1 --port 5000 --reload
110
121
```
111
122
112
-
### 4. Build & Start
123
+
**Frontend hot-reload with Vite:**
113
124
114
125
```bash
115
-
#Build the frontend
116
-
npm --prefix ./app run build
126
+
#Terminal 1: backend API
127
+
uv run uvicorn api.index:app --host 127.0.0.1 --port 5000 --reload
117
128
118
-
#Start the backend (serves both API and frontend)
119
-
flask --app api/index.py run --debug
129
+
#Terminal 2: Vite dev server
130
+
cdapp && npm run dev
120
131
```
121
132
122
-
The application will be available at [http://localhost:5000](http://localhost:5000).
123
-
124
-
### Development Mode
133
+
The Vite dev server runs on `http://localhost:3000` and proxies `/api/*` requests to `http://127.0.0.1:5000`.
125
134
126
-
For frontend development with hot-reload:
135
+
**Single-process built frontend + backend:**
127
136
128
137
```bash
129
-
# Terminal 1: Start the Python backend
130
-
flask --app api/index.py run --debug --port 5000
131
-
132
-
# Terminal 2: Start the Vite dev server (proxies API calls to backend)
133
-
cd app && npm run dev
138
+
npm --prefix ./app run build
139
+
uv run uvicorn api.index:app --host 0.0.0.0 --port 5000
134
140
```
135
141
136
-
The Vite dev server runs on `http://localhost:3000` and proxies API requests to the Flask backend on port 5000.
142
+
In this mode, the FastAPI app serves the built React SPA from `app/dist`on `http://localhost:5000`.
137
143
138
144
### Using Make
139
145
140
146
```bash
141
-
make install # Install all dependencies
142
-
make build-dev # Build frontend (development)
143
-
make build-prod # Build frontend (production)
144
-
make run-dev # Build + start dev server
145
-
make run-prod # Build + start production server
146
-
make test# Run backend tests
147
-
make lint # Run frontend linting
148
-
make clean # Clean build artifacts
147
+
make install # Install backend + frontend dependencies
148
+
make build-dev # Build frontend in development mode
149
+
make build-prod # Build frontend for production
150
+
make run-dev # Build dev frontend + run Uvicorn with reload
151
+
make run-prod # Build prod frontend + run Uvicorn
152
+
make test# Run backend pytest suite
153
+
make lint # Run Ruff + frontend type-check
154
+
make e2e # Run Playwright tests from repo root
155
+
make clean # Remove build/test artifacts
149
156
```
150
157
158
+
`make test` currently points at the right backend test entrypoint, but some legacy analyzer/git-history tests still need maintenance before the suite passes on a clean checkout.
159
+
151
160
## Running with Docker
152
161
153
162
### Using Docker Compose
154
163
155
164
```bash
156
-
docker-compose up
165
+
dockercompose up --build
157
166
```
158
167
159
-
This starts both FalkorDB and the CodeGraph application.
168
+
This starts FalkorDB and the CodeGraph app together. The checked-in compose file sets `CODE_GRAPH_PUBLIC=1` for the app service.
160
169
161
-
### Using Docker Directly
170
+
### Using Docker directly
162
171
163
172
```bash
164
173
docker build -t code-graph .
165
174
166
175
docker run -p 5000:5000 \
167
176
-e FALKORDB_HOST=host.docker.internal \
168
177
-e FALKORDB_PORT=6379 \
169
-
-e OPENAI_API_KEY=<YOUR_KEY> \
170
-
-e SECRET_TOKEN=<YOUR_TOKEN> \
178
+
-e MODEL_NAME=gemini/gemini-flash-lite-latest \
179
+
-e GEMINI_API_KEY=<YOUR_GEMINI_API_KEY> \
180
+
-e SECRET_TOKEN=<YOUR_SECRET_TOKEN> \
171
181
code-graph
172
182
```
173
183
174
184
## Creating a Code Graph
175
185
176
-
### Analyze a Local Folder
186
+
### Analyze a local folder
187
+
188
+
`analyze_folder` only accepts paths under `ALLOWED_ANALYSIS_DIR` (defaults to the repository root unless you override it).
177
189
178
190
```bash
179
-
curl -X POST http://127.0.0.1:5000/analyze_folder \
191
+
curl -X POST http://127.0.0.1:5000/api/analyze_folder \
0 commit comments