Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ GOOGLE_CLIENT_SECRET=your_google_client_secret
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret

# Flask configuration
FLASK_SECRET_KEY=your_super_secret_key_here
# FASTAPI configuration
FASTAPI_SECRET_KEY=your_super_secret_key_here
Comment on lines +20 to +21
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add FASTAPI_DEBUG to the template for consistency with api/index.py and CI.

api/index.py reads FASTAPI_DEBUG, and CI appends it. Include it here so local setups don’t miss it.

 # FASTAPI configuration
 FASTAPI_SECRET_KEY=your_super_secret_key_here
+FASTAPI_DEBUG=False  # set to True to enable auto-reload in dev
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# FASTAPI configuration
FASTAPI_SECRET_KEY=your_super_secret_key_here
# FASTAPI configuration
FASTAPI_SECRET_KEY=your_super_secret_key_here
FASTAPI_DEBUG=False # set to True to enable auto-reload in dev
🤖 Prompt for AI Agents
.env.example around lines 20 to 21: the template includes FASTAPI_SECRET_KEY but
is missing FASTAPI_DEBUG which api/index.py reads and CI appends; add a
FASTAPI_DEBUG entry (e.g. FASTAPI_DEBUG=false) to the .env.example immediately
after FASTAPI_SECRET_KEY so local setups and developers have the same variable
present and can toggle debug mode consistently with CI and the application.


# FalkorDB configuration
FALKORDB_HOST=localhost
Expand Down
8 changes: 4 additions & 4 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ make clean

```bash
# REQUIRED for FastAPI to start
FLASK_SECRET_KEY=your_super_secret_key_here
FLASK_DEBUG=False
FASTAPI_SECRET_KEY=your_super_secret_key_here
FASTAPI_DEBUG=False

# REQUIRED for database connection (most functionality)
FALKORDB_HOST=localhost
Expand All @@ -146,8 +146,8 @@ GITHUB_CLIENT_SECRET=your_github_client_secret

**For testing in CI/development**, minimal `.env` setup:
```bash
FLASK_SECRET_KEY=test-secret-key
FLASK_DEBUG=False
FASTAPI_SECRET_KEY=test-secret-key
FASTAPI_DEBUG=False
FALKORDB_HOST=localhost
FALKORDB_PORT=6379
```
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
pipenv sync --dev

- name: Install frontend dependencies
if: "exists('app/package.json')"
run: |
node --version || true
npm --version || true
Expand All @@ -51,21 +50,16 @@ jobs:
- name: Create test environment file
run: |
cp .env.example .env
echo "FLASK_SECRET_KEY=test-secret-key" >> .env
echo "FLASK_DEBUG=False" >> .env
echo "FASTAPI_SECRET_KEY=test-secret-key" >> .env
echo "FASTAPI_DEBUG=False" >> .env

- name: Run unit tests
run: |
pipenv run pytest tests/ -k "not e2e" --verbose

- name: Run pylint
- name: Run lint
run: |
pipenv run pylint "$(git ls-files '*.py')" || true

- name: Run frontend lint
if: "exists('app/package.json')"
run: |
(cd app && npm run lint)
make lint

Comment on lines +60 to 63
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Confirm make lint target exists and fails on issues

Replacing direct pylint invocation with make lint is fine, but please verify the Makefile has a lint target, aggregates both backend and frontend linters as intended, and returns non-zero on violations to fail the job.

Run this to verify:


🏁 Script executed:

#!/bin/bash
# Validate that a 'lint' target exists and is non-phony no-op.
rg -nP '^\s*lint\s*:' Makefile
# Show the command(s) it runs for quick inspection
rg -nA5 -P '^\s*lint\s*:' Makefile

Length of output: 330


Ensure the lint target fails on all lint errors

The Makefile’s lint target is defined (line 45) and correctly invokes both backend (pylint) and frontend (eslint) linters, but the backend step suppresses failures with || true, so Python lint errors won’t fail the CI job.

  • Makefile (around lines 46–47): remove the trailing || true from the pipenv run pylint … command to allow non-zero exit on violations.
  • Makefile (around line 49): verify that the lint-frontend target invoked by make lint-frontend similarly propagates its exit code (i.e., does not use any || true or equivalent).
🤖 Prompt for AI Agents
.github/workflows/tests.yml around lines 60 to 63: the CI step "Run lint"
currently runs `make lint` but the Makefile's backend lint command suppresses
failures; edit the Makefile (around lines 46–47) to remove the trailing `||
true` from the `pipenv run pylint …` invocation so pylint non-zero exits
propagate, and ensure the frontend lint target invoked (around line 49) does not
suppress its exit code (remove any `|| true` or equivalent); then keep the
workflow step as-is so `make lint` will fail the job on any lint errors.

e2e-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -109,8 +103,8 @@ jobs:
cp .env.example .env
echo "FALKORDB_HOST=localhost" >> .env
echo "FALKORDB_PORT=6379" >> .env
echo "FLASK_SECRET_KEY=test-secret-key-for-ci" >> .env
echo "FLASK_DEBUG=False" >> .env
echo "FASTAPI_SECRET_KEY=test-secret-key-for-ci" >> .env
echo "FASTAPI_DEBUG=False" >> .env

- name: Wait for FalkorDB
run: |
Expand Down
36 changes: 30 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Use a single stage build with FalkorDB base image
# Multi-stage build: Start with Python 3.12 base
FROM python:3.12-bookworm as python-base

# Main stage: Use FalkorDB base and copy Python 3.12
FROM falkordb/falkordb:latest

ENV PYTHONUNBUFFERED=1 \
Expand All @@ -7,12 +10,15 @@ ENV PYTHONUNBUFFERED=1 \

USER root

# Install Python and pip, netcat for wait loop in start.sh
# Copy Python 3.12 from the python base image
COPY --from=python-base /usr/local /usr/local

# Install netcat for wait loop in start.sh
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python3 \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python

Comment on lines 17 to 22
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Install required tooling in one layer; add missing essentials and tighten apt flags

We use curl later but it’s not installed. Also add ca-certificates and gnupg for NodeSource, and avoid recommends to keep the image smaller. Create python symlinks after installing.

Apply:

-RUN apt-get update && apt-get install -y \
-    netcat-openbsd \
-    && rm -rf /var/lib/apt/lists/* \
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    netcat-openbsd curl ca-certificates gnupg \
+  && rm -rf /var/lib/apt/lists/* \
     && ln -sf /usr/local/bin/python3.12 /usr/bin/python3 \
     && ln -sf /usr/local/bin/python3.12 /usr/bin/python
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python3 \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python
RUN apt-get update && apt-get install -y --no-install-recommends \
netcat-openbsd curl ca-certificates gnupg \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python3 \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python
🤖 Prompt for AI Agents
In Dockerfile around lines 17 to 22, the RUN instruction installs only
netcat-openbsd and then creates python symlinks, but it is missing curl,
ca-certificates and gnupg (needed for NodeSource), and it should avoid
installing recommends and create symlinks after packages are installed; update
the single RUN layer to apt-get update && apt-get install -y
--no-install-recommends curl ca-certificates gnupg netcat-openbsd (and any other
required essentials), remove apt lists after install, and then create the python
symlinks (ln -sf ...) in the same layer so the image stays small and has the
necessary tooling.

WORKDIR /app

Expand All @@ -25,6 +31,25 @@ COPY Pipfile Pipfile.lock ./
# Install Python dependencies from Pipfile
RUN PIP_BREAK_SYSTEM_PACKAGES=1 pipenv sync --system

# Install Node.js (Node 22) so we can build the frontend inside the image.
# Use NodeSource setup script to get a recent Node version on Debian-based images.
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get update && apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*

Comment on lines +34 to +39
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

NodeSource setup lacks curl/gnupg/CA packages and repeats apt metadata

The step will fail on images without curl/gnupg. Also collapse updates into one and use --no-install-recommends.

Apply:

-RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
-    && apt-get update && apt-get install -y nodejs \
-    && rm -rf /var/lib/apt/lists/*
+RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
+  && apt-get update \
+  && apt-get install -y --no-install-recommends nodejs \
+  && rm -rf /var/lib/apt/lists/*

Note: This assumes curl/gnupg/ca-certificates were installed earlier (see previous comment). If you prefer fully self-contained step, include them here instead.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Install Node.js (Node 22) so we can build the frontend inside the image.
# Use NodeSource setup script to get a recent Node version on Debian-based images.
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get update && apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js (Node 22) so we can build the frontend inside the image.
# Use NodeSource setup script to get a recent Node version on Debian-based images.
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get update \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
🤖 Prompt for AI Agents
In Dockerfile around lines 34 to 39, the NodeSource setup step assumes
curl/gnupg/ca-certificates exist and runs apt-get update twice; modify the step
to ensure required packages (curl, gnupg, ca-certificates) are installed if not
already, collapse apt-get update/install into a single apt-get update && apt-get
install -y --no-install-recommends <packages> sequence, then run the NodeSource
setup script and install nodejs, and finally rm -rf /var/lib/apt/lists/* to
clean up; alternatively if those packages are guaranteed earlier, remove the
redundant apt-get update and add --no-install-recommends to the nodejs install
line and keep apt lists cleanup.

# Copy only frontend package files so Docker can cache npm installs when
# package.json / package-lock.json don't change.
COPY app/package*.json ./app/

# Install frontend dependencies (reproducible install using package-lock)
RUN if [ -f ./app/package-lock.json ]; then \
npm --prefix ./app ci --no-audit --no-fund; \
elif [ -f ./app/package.json ]; then \
npm --prefix ./app install --no-audit --no-fund; \
else \
echo "No frontend package.json found, skipping npm install"; \
fi

# Copy application code
COPY . .

Expand All @@ -34,6 +59,5 @@ RUN chmod +x /start.sh

EXPOSE 5000 6379 3000


# Use start.sh as entrypoint
ENTRYPOINT ["/start.sh"]
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "pypi"
[packages]
fastapi = "~=0.116.1"
uvicorn = "~=0.32.0"
litellm = "~=1.74.14"
litellm = "~=1.75.9"
falkordb = "~=1.2.0"
psycopg2-binary = "~=2.9.9"
pymysql = "~=1.1.0"
Expand All @@ -20,9 +20,9 @@ jinja2 = "~=3.1.4"
[dev-packages]
pytest = "~=8.4.1"
pylint = "~=3.3.4"
playwright = "~=1.47.0"
playwright = "~=1.54.0"
pytest-playwright = "~=0.7.0"
pytest-asyncio = "~=0.24.0"
pytest-asyncio = "~=1.1.0"

[requires]
python_version = "3.12"
156 changes: 77 additions & 79 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This application supports authentication via Google and GitHub OAuth. You'll nee
### Running the Application

```bash
pipenv run flask --app api.index run
pipenv run uvicorn api.index:app --host "localhost" --port "5000"
```

The application will be available at `http://localhost:5000`.
Expand Down Expand Up @@ -97,7 +97,7 @@ You can configure the application by passing environment variables using the `-e

```bash
docker run -p 5000:5000 -it \
-e FLASK_SECRET_KEY=your_super_secret_key_here \
-e FASTAPI_SECRET_KEY=your_super_secret_key_here \
-e GOOGLE_CLIENT_ID=your_google_client_id \
-e GOOGLE_CLIENT_SECRET=your_google_client_secret \
-e GITHUB_CLIENT_ID=your_github_client_id \
Expand Down
Loading
Loading