This guide aims to help first time contributors to setup and contribute to opencre.org. It assumes little/no prior development knowledge and an environment without any tools.
- Prerequisites
- Development Environment Setup
- Project Setup
- Testing That Everything Works
- Import The Database
- Running Locally
opencre.org is a Python backend supported by a React frontend written using Typescript (or typed Javascript). In order to contribute code to opencre you need a system that is setup for python and Javascript development.
Assuming a Debian based system (e.g. ubuntu) you can install supporting tools with the following:
sudo apt update && sudo apt install -y curl git python3 build-essential curl libpq-dev python3-dev sqlite3Assuming the Homebrew package manager is installed, you can run the following.
brew install git python curl sqlite3 libpq makeThe above will install
- git , used for source control
- python3 , used for backend development
- build-essential , a package of useful development tools
- curl , a utility that allows users to make network connections to remote servers, used for testing
- sqlite3, a file based database used for development
- make a build and execution automation tool
We install python's utilities with
python3 -m pip install --upgrade pippip is python's package managerpython3 -m pip install --upgrade virtualenvpython virtual environment, used for python developmentpython3 -m pip install --upgrade setuptoolspython's setuptools is the package containing tooling for installing further python tools
We install python's utilities with
brew install python3brew install virtualenv
Then nodejs, used for Javascript development can be installed using the Node Version Manager as such:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash && nvm install --ltsThen we use npm nodejs, package manager to install yarn , a lightweight Javascript build tool.
npm install --global yarn
OpenCRE uses SQLite for the default local development database and PostgreSQL for production. You do not need to install both databases for the standard contributor path; install PostgreSQL locally only when you are explicitly testing the PostgreSQL-backed workflow.
sudo apt install sqlite3 postgresql-client
brew install sqlite3 postgresql
OpenCRE uses git and follows the GitHub flow. To edit files it is suggested that a code editor such as Visual Studio Code is used. Visual Studio Code can be installed on Linux and MacOS.
- Generate an SSH key pair and add it's public component to your Github account as described here.
- Create a fork of the project following Github's instructions above.
- Open a terminal
- Clone your fork locally with
git clone <the url of your fork starting with git@github.com>
OpenCRE depends on Makefiles to automate the setup and execution of several aspects.
You can install the project by running make install.
Before running the end-to-end checks, start the local services and seed the fixture database. Then run both unit tests and end to end tests:
make start-containers
make e2e-db
make test
make e2eA working setup should finish without a test failure and should make the local application available at http://localhost:5000.
For local development, you do not need access to the OpenCRE Google Sheet. That spreadsheet is part of the maintainer workflow for bulk standards imports.
The supported contributor workflow is:
- create the local database schema
- sync the public OpenCRE graph from upstream
- import your own mappings locally through MyOpenCRE if needed
Run:
make migrate-upgrade
make upstream-syncmake upstream-sync downloads the OpenCRE graph from the public API into your
local standards_cache.sqlite.
If you want to map your own standard locally, enable imports and use MyOpenCRE or the CSV import endpoint:
export CRE_ALLOW_IMPORT=true
make dev-flaskThen you can:
- open the local MyOpenCRE UI
- download a CSV template from
GET /rest/v1/cre_csv - upload your CSV to
POST /rest/v1/cre_csv_importafter starting the local API - send the multipart file field as
cre_csv
Example, once make dev-flask is running:
curl -X POST http://localhost:5000/rest/v1/cre_csv_import \
-F cre_csv=@my_mappings.csvMaintainer-only spreadsheet import example:
python cre.py --add --from_spreadsheet <google sheets url>First, start the required services (Redis and Neo4j) with:
make start-containers
You can run the backend with make dev-flask. At the time of writing the backend URL is http://localhost:5000 by default.
You can run the frontend with yarn start. This should open a browser tab at the application's front page and also automatically reload the page whenever changes are detected. At the time of writing the frontend URL is http://localhost:9001 by default.
virtualenv: command not found: install thevirtualenvprerequisite, then rerunmake install. Do not create a separatevenvwith a different tool.make e2efails before the tests start: make sure the local services are running and runmake e2e-dbfirst to seed the fixture database.- Docker command not found: use the Docker alternative from the main README, or install Docker before following that path.
- Database confusion: the default local contributor path uses SQLite. Only add local PostgreSQL when you are testing the production-style database path.
- Frontend dependency failures: the repository uses a Yarn v1 lockfile. Use Yarn Classic and keep the Node.js version consistent across contributors until the project adds an explicit Node.js engine constraint.
After changing embedding logic or models, wipe and rebuild stored vectors so the chatbot similarity search uses the new text:
# From repo root; uses standards_cache.sqlite by default or pass --cache_file
export OPENAI_API_KEY=... # or GEMINI_API_KEY for Vertex
python cre.py --regenerate_embeddings --cache_file ./standards_cache.sqliteThis deletes every row in the embeddings table, then runs the same full pass as a cold import (Playwright fetch + optional smart excerpt + provider embed). It can take a long time and consumes API quota.
The chatbot matches your question to a standard node embedding, then answers using that node’s embeddings_content. When embeddings_url is set (e.g. OWASP AI Exchange with a #fragment), the API adds it as embeddingsUrl on the reference row alongside the unchanged catalog hyperlink; the UI shows a separate “Scoped source (embedding URL)” link. The LLM context includes an Embeddings_URL line for citations.
This is it, please follow the CONTRIBUTING guidelines while contributing and thank you for your interest in OpenCRE.