documentation/docs/contributing/development.mdx
Welcome to the development docs of Khoj! Thanks for your interest in being a contributor ❤️. Open source contributors are a corner-store of the Khoj community. We welcome all contributions, big or small.
To get started with contributing, check out the official GitHub docs on contributing to an open-source project.
Join the Discord server and click the ✅ for the question "Are you interested in becoming a contributor?" in the #welcome-and-rules channel. This will give you access to the #contributors channel where you can ask questions and get help from other contributors.
If you're looking for a place to get started, check out the list of Github Issues with the tag good first issue to find issues that are good for first-time contributors.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
python3 -m venv .venv && source .venv/bin/activate
uv sync --all-extras
</TabItem> <TabItem value="windows" label="Windows"> shell
git clone https://github.com/khoj-ai/khoj && cd khoj
python3 -m venv .venv && .venv\Scripts\activate
uv sync --all-extras
</TabItem> <TabItem value="linux" label="Linux"> shell
# Get Khoj Code
git clone https://github.com/khoj-ai/khoj && cd khoj
python3 -m venv .venv && source .venv/bin/activate
uv sync --all-extras ``` </TabItem> </Tabs>
Khoj uses the pgvector package to store embeddings of your index in a Postgres database. To use this, you need to have Postgres installed.
Make sure to update your environment variables to match your Postgres configuration if you're using a different name. The default values should work for most people. When prompted for a password, you can use the default password postgres, or configure it to your preference. Make sure to set the environment variable POSTGRES_PASSWORD to the same value as the password you set here.
cd src/interface/web/
bun install
bun export
You can optionally use bun dev to start a development server for the front-end which will be available at http://localhost:3000. This is especially useful if you're making changes to the front-end code, but not necessary for running Khoj. Note that streaming does not work on the dev server due to how it is handled with SSR in Next.js.
Always run bun export to test your front-end changes on http://localhost:42110 before creating a PR.
khoj -vv
Note: Wait after configuration for khoj to Load ML model, generate embeddings and expose API to query notes, images, documents etc specified in config YAML
khoj Not Recognized
khoj command.uv add xxx and try running the khoj command.createdb Not Recognized
C:\Program Files\PostgreSQL\16\bin
pg_hba.conf file in the location where postgres was installed.host all postgres 127.0.0.1/32 trust
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
Make sure you install the latest version of Docker and Docker Compose.
git clone https://github.com/khoj-ai/khoj && cd khoj
image line and uncomment the build line in the server serviceThis will start the Khoj server, and the database.
docker-compose up -d
If you've made changes to the codebase, you'll need to rebuild the Docker image before running the container again.
docker-compose build --no-cache
In whichever clients you're using for testing, you'll need to update the server URL to point to your local server. By default, the local server URL should be http://127.0.0.1:42110.
./scripts/dev_setup.sh
--full flag to install the Khoj Desktop and Obsidian client apps as well.pip install pre-commitpre-commit run --hook-stage manual --all before creating PR:::tip[Note]
You should be in an active virtual environment for Khoj in order to run the unit tests and linter. The dev_setup.sh script wil automatically create and activate it for you.
:::
pytest
mypy
#contributors channel.The core code for the Obsidian plugin is under src/interface/obsidian. The file main.ts is a good place to start.
src/interface/obsidian in the Khoj repository.yarn install to install the dependencies.yarn dev to start the development server. This will continually rebuild the plugin as you make changes to the code.
main.js in the obsidian directory.khoj folder in the file explorer that opens. You'll see a file called main.js in this folder. To test your changes, replace this file with the main.js file that was generated by the development server in the previous section.Follow the steps below to release Khoj. This will create a stable release of Khoj on Pypi, Melpa and Obsidian. It will also create desktop apps of Khoj and attach them to the latest release.
./scripts/bump_version.sh -c "<release_version>"
git push origin master # push release commit to khoj repository
git push origin <release_version> # push release tag to khoj repository