Skip to content

Local Setup

Fast-moving development ahead!

We strive to keep our documentation accurate and up to date. However, our development cycles move quickly, and occasionally the docs may fall slightly behind. If you run into any issues or something doesn’t work as expected, please don’t hesitate to reach out — we’re here to help!

Table of Contents

Setup Instructions

  1. Install direnv.
  2. Install the latest version of uv using: curl -LsSf https://astral.sh/uv/install.sh | sh
  3. Run git clone git@github.com:IDinsight/DiagnosticAgentGraphRAG.git and cd into the root directory of the repo.
  4. Copy the root .template.env to .env and update the following environment variables in .env:
    1. GOOGLE_APPLICATION_CREDENTIALS: The absolute path to your Google Cloud service account key file.
    2. OPENAI_API_KEY: Your OpenAI API key.
    3. PATHS_PROJECT_DIR: The absolute path to the root directory of the project.
  5. Allow direnv to load the root environment variables by running direnv allow.
  6. [OPTIONAL (ONLY IF YOU WANT TO RUN IN DEV ENVIRONMENT)] cd into cicd/deployment/docker-compose directory of the repo and copy docker-compose/.template.env to docker-compose/.env and update:
    1. GOOGLE_APPLICATION_CREDENTIALS: The absolute path to your Google Cloud service account key file.
    2. OPENAI_API_KEY: Your OpenAI API key.
    3. PATHS_PROJECT_DIR: Set this to the absolute path of the root directory of the repo.
  7. cd into the backend directory of the repo and:
    1. Copy backend/.template.env to backend/.env.
    2. Allow direnv to load the backend environment variables by running direnv allow.
  8. Contact Tony Zhao for data files for the graph database and put all data files under PATHS_PROJECT_DIR/results.

Local Startup Instructions

  1. [OPTIONAL] If you started the dev environment first, then from the root directory, run make down-dev to stop all dev environment containers.
  2. From the root directory, execute make up-local. This will initialize the Docker containers for the local environment.
  3. cd in the backend directory of the repo and:
    1. Run make fresh-env. This will create a new virtual environment for the backend and install all dependencies.
    2. Run source .venv/bin/activate: This will activate the virtual environment created by make fresh-env.
  4. Starting FastAPI
    1. From the backend directory, run python src/dagrag/entries/main.py: This will start the FastAPI server on http://localhost:8000.
    2. Go to http://localhost:8000/docs to view the backend API routes.
  5. Starting Frontend
    1. In another terminal window, cd into the frontend directory of the repo and:
      • Run pnpm i. This will install all dependencies for the frontend.
      • Run pnpm run dev. This will start the frontend server on http://localhost:3000.
      • Go to http://localhost:3000 to view the frontend UI.

Local Clean up Instructions

  1. Ctrl-C to stop the FastAPI server and the frontend application in each of their respective terminal windows.
  2. In the backend directory, run deactivate. This will exit out of the virtual environment created by uv.
  3. cd back to the root directory and run make down-local. This will stop all local containers.
  4. [OPTIONAL] In the root directory, run make clean-docker. This will remove all Docker images and containers created during the local testing setup. Use this command with caution as it will remove all Docker images and containers, not just those related to this project.

Dev Startup Instructions

  1. [OPTIONAL] If you started the local environment first, then from the root directory, run make down-local to stop all local environment containers.
  2. From the root directory, run make up-dev. This will initialize the Docker containers for the dev environment using Docker compose.
  3. cd into the backend directory of the repo.
    1. Run make fresh-env. This will create a new virtual environment for the backend and install all dependencies.
    2. Run source .venv/bin/activate: This will activate the virtual environment created by make fresh-env.
  4. Starting Frontend
    1. cd into the frontend directory of the repo and:
      • Run pnpm i. This will install all dependencies for the frontend.
      • Run pnpm run dev. This will start the frontend server on http://localhost:3000.
      • Go to http://localhost:3000 to view the frontend UI.

Dev Clean up Instructions

  1. In the backend directory, run deactivate. This will exit out of the virtual environment created by uv.
  2. cd back to the root directory and run make down-dev. This will stop all dev containers.
  3. [OPTIONAL] In the root directory, run make clean-docker. This will remove all Docker images and containers created during the local testing setup. Use this command with caution as it will remove all Docker images and containers, not just those related to this project.

➡️ Next: Testing the Diagnostic Agent Flow