You are reading the documentation of OpenCTI 7.260811 LTS · 7.260811.0-lts.1, supported until 2027-09.Latest is 7.261119.0 →
How-to guide

Build and run from source

Clone OpenCTI or OpenAEV, start their development services, run the back end and the front end from source, and run the checks and tests of the CI.

OpenCTIOpenAEVFor developers

This page gets OpenCTI or OpenAEV running from its source code on your machine. You change the code, see the change at once, and run the checks of the continuous integration (CI) before your pull request. The services a platform needs (search engine, broker, storage) run in containers; the platform itself runs from source. Install the tools first: Ubuntu or Windows.

YOUR MACHINEFROM SOURCEOPENCTI-DEV CONTAINERSBrowserlocalhost:3000Front endVite dev server, port 3000Back endGraphQL API, port 4000WorkerPython, imports bundlesElasticsearchPort 9200RedisPort 6379RabbitMQPort 5672SiloS3 storage, port 9000
  1. Browser → Front end: opens
  2. Front end → Back end: proxies API calls
  3. Worker → Back end: API calls
  4. Back end → Elasticsearch: indexes
  5. Back end → Redis: streams and cache
  6. Back end → RabbitMQ: queues bundles
  7. Worker → RabbitMQ: consumes
  8. Back end → Silo: stores files
In development, the platform runs from source on your machine and its services run in containers

Before you start

  • The tools of your environment page: Node.js, Yarn through Corepack, a container engine with Compose, and Python 3.12 for OpenCTI or Java 21 and Maven for OpenAEV.
  • A GitHub account. To propose a change, fork the repository and open the pull request from your fork.
  • This page follows the default branches: master for OpenCTI, main for OpenAEV. Commands run from the root of the clone unless a step says otherwise.

Build and run OpenCTI

What the repository holds

The root package.json declares a Yarn workspace (opencti-platform/opencti-front, opencti-platform/opencti-graphql and the custom ESLint rules) and drives every part with Nx (nx run-many).

FolderWhat it isLanguage
opencti-platform/opencti-graphqlThe back end: GraphQL API, managers, Python bridgeTypeScript and JavaScript on Node.js, Python 3
opencti-platform/opencti-frontThe front end, served by Vite in developmentReact, TypeScript, Relay
opencti-platform/opencti-devThe Compose file of the development services, IntelliJ IDEA run configurationsYAML
opencti-workerThe worker, which imports the bundles queued in RabbitMQPython
client-pythonThe Python client pycti, used by the worker and the connectorsPython

Clone and install the dependencies

  1. Clone the repository:

    git clone https://github.com/OpenCTI-Platform/opencti.git
    cd opencti
    
  2. Create the Python virtual environment next to the clone, in ../.python-venv:

    python3 -m venv ../.python-venv
    

    The repository expects it there. The *:venv scripts of the root package.json activate ../.python-venv (or the folder in VENV_PATH). The back end adds ../.python-venv/lib/python3.12/site-packages to the import path of its embedded Python, the default of app:python_execution_venv. With another Python version, set that key to your site-packages folder.

  3. Install the JavaScript workspace, then every Python dependency inside the virtual environment:

    yarn install
    yarn deps:venv
    

    yarn deps:venv runs the install target of each part: client-python in editable mode, the Python libraries of the back end (src/python/requirements.txt) and those of the worker. Yarn runs no install script except for the packages package.json allows (enableScripts: false), and ignores packages published less than three days ago (npmMinimalAgeGate).

Configure the back end

The back end reads config/default.json, then a file named after its environment over it. yarn start builds it in development mode, so it reads opencti-platform/opencti-graphql/config/development.json. That file is ignored by Git: put your local values in it.

default.json already points to the development services on localhost with their credentials. Three values have no usable default, and the platform refuses to start without them:

KeyVariableWhat it needs
app:admin:passwordAPP__ADMIN__PASSWORDAny value except ChangeMe
app:admin:tokenAPP__ADMIN__TOKENA UUID, and not ChangeMe: it is the API token of the admin user
app:encryption_keyAPP__ENCRYPTION_KEYAt least 32 bytes, base64-encoded: openssl rand -base64 32

Write them with a short development.json: the other keys keep the values of default.json.

OPENCTI_ADMIN_TOKEN=$(python3 -c 'import uuid; print(uuid.uuid4())')
OPENCTI_ENCRYPTION_KEY=$(openssl rand -base64 32)
cat > opencti-platform/opencti-graphql/config/development.json <<EOF
{
  "app": {
    "admin": {
      "email": "admin@opencti.io",
      "password": "VelvetHarbor-dev-2026",
      "token": "$OPENCTI_ADMIN_TOKEN"
    },
    "encryption_key": "$OPENCTI_ENCRYPTION_KEY"
  }
}
EOF

Keep the token: the worker and your API calls use it. Every other key and its default is in the OpenCTI configuration reference.

Start the development services

  1. Start the containers:

    cd opencti-platform/opencti-dev
    docker compose up -d
    cd ../..
    

    With Podman, run podman compose up -d.

  2. Check what started. The ports match the defaults of default.json:

    ServiceImagePorts
    Elasticsearchelasticsearch:8.19.239200
    Kibanakibana:8.19.235601
    Redisredis:8.6.76379
    Redis Insightredislabs/redisinsight:3.8.05540
    RabbitMQ, with its management interfacerabbitmq:4.3.6-management5672, 15672
    Silo, S3-compatible storagepgsty/silo9000, console 9001
    MailDev, a fake SMTP servermaildev/maildev:3.0.0SMTP 1025, web 1080

Profiles start more services when you need them:

  • --profile opensearch: OpenSearch on port 9201, instead of Elasticsearch.
  • --profile keycloak: an OpenID Connect and SAML provider on port 9999.
  • --profile mokapi: LDAP and CyberArk mocks.
  • --profile telemetry: Jaeger, Prometheus, Grafana and Pyroscope.

opencti-platform/opencti-dev/README.md gives the configuration each one needs.

Start the platform

The worker reads opencti-worker/src/config.yml, ignored by Git. Create it from the sample, pointed at your back end and its admin token:

cat > opencti-worker/src/config.yml <<EOF
opencti:
  url: 'http://localhost:4000'
  token: '$OPENCTI_ADMIN_TOKEN'
  json_logging: true
worker:
  log_level: 'info'
  telemetry_enabled: false
EOF

Then start everything from the root, inside the virtual environment. Pick how the back end reacts to your changes:

CommandBack endFront endWorker
yarn dev:venvBuilds once (yarn start) and runsVite, reloads on changeRuns
yarn dev:watch:venvRebuilds and restarts on each change (yarn dev)Vite, reloads on changeRuns
yarn dev:watch-with-graphql:venvSame, and regenerates the GraphQL schema and types when a .graphql file changesSame, and recompiles the Relay artifactsRuns

To run one part alone, activate the virtual environment with . ../.python-venv/bin/activate, then:

  • Back end: cd opencti-platform/opencti-graphql && yarn start. In development, the back end also starts python child processes, a command the virtual environment provides.
  • Front end: cd opencti-platform/opencti-front && yarn start. It listens on port 3000 (FRONT_END_PORT) and proxies /graphql, /auth, /storage, /stream and the other API paths to http://localhost:4000 (BACK_END_URL).
  • Worker: cd opencti-worker/src && python worker.py.
Check that it worked

The back end logs [OPENCTI] API ready on port 4000. Open http://localhost:3000 and sign in with the email and password of development.json.

Check your changes

The CI runs these checks on each pull request. Run them before you push.

PartCommand, from its folderWhat the CI checks
Back endyarn check-ts, yarn lint, yarn knip --dependenciesTypes, ESLint rules, declared dependencies
Front endyarn check-ts, yarn lint, yarn knip --dependencies, yarn verify-translation, yarn check:utility-classesTypes, ESLint rules, dependencies, translation files, utility classes
Front endyarn testUnit tests (Vitest)

The root yarn lint runs the lint target of every part: check-ts, lint and verify-translation for the front end, lint for the back end. Front-end changes also go through the design system gates of AGENTS.md: run node fds-migration/scripts/check-mui-regression.mjs --explain before writing interface code.

Run the back-end tests

The back-end tests use Vitest and opencti-platform/opencti-graphql/config/test.json, which is in the repository. It runs the test platform on port 4010 and isolates its data with the test prefix: Elasticsearch indices, Redis namespace, RabbitMQ queues and the S3 bucket. The test suites use the same development services as your platform.

Run the commands from opencti-platform/opencti-graphql, with the virtual environment active:

CommandWhat it runsNeeds the services
yarn test:ci-unitUnit tests, tests/01-unitNo
yarn test:ci-integrationData injection and integration tests, tests/02-* and tests/03-*Yes
yarn test:ci-rules-and-othersData injection, rules, tests/21-integration, TAXII and deprecated testsYes
yarn test:ci-integration-syncIntegration and stream tests, and sync tests that need second platforms on port 4200Yes, and the CI stack
yarn test:devEvery suite, after wiping and seeding the test platform: the longest runYes

To work on one integration test, initialize the test platform and load its sample data once, then run only your file as often as you need. test:dev:resume skips the cleanup and the initialization, so it starts in seconds:

yarn test:dev:init
yarn test:dev:resume tests/03-integration/01-database/sorting-test.ts

Each test:ci-* command also takes one file, for example yarn test:ci-unit tests/01-unit/utils/sorting-test.ts.

Build and run OpenAEV

OpenAEV is a multi-module Maven project (openaev-api, openaev-model, openaev-framework and others) with a React front end in openaev-front.

  1. Clone the repository:

    git clone https://github.com/OpenAEV-Platform/openaev.git
    cd openaev
    
  2. Create the configuration of the dev Spring profile from its example. The copy is ignored by Git:

    cp openaev-api/src/main/resources/application-dev.properties.example \
       openaev-api/src/main/resources/application-dev.properties
    
  3. Edit application-dev.properties:

    • Set openaev.admin.token to a UUID: python3 -c 'import uuid; print(uuid.uuid4())'.
    • The example turns on integrations that need external accounts (SAML, Caldera, Tanium, CrowdStrike, IMAP, OVH SMS). Set the enable or enabled keys of those you do not have to false, and set openaev.listener.smtp.enabled=false.
    • openaev.rabbitmq.hostname is host.docker.internal, so that injectors running in Docker reach RabbitMQ. Add 127.0.0.1 host.docker.internal to /etc/hosts (Docker Desktop usually adds it on Windows), or set localhost if you run no injector in Docker. Keep the value alone on its line: Java properties read a trailing # comment as part of the value.
  4. Start the four services OpenAEV needs. .env.example works as it is:

    cd openaev-dev
    cp .env.example .env
    docker compose up -d openaev-dev-pgsql openaev-dev-minio openaev-dev-elasticsearch openaev-dev-rabbitmq
    cd ..
    
    ServicePorts
    PostgreSQL5432
    Silo, S3-compatible storage10000, console 10001
    Elasticsearch9200, 9300
    RabbitMQ5672, 15672
  5. Build every module, then start the back end with the dev profile. It listens on port 8080:

    mvn clean install -DskipTests
    mvn spring-boot:run -pl openaev-api -Dspring-boot.run.profiles=dev
    
  6. In another terminal, install and start the front end. It listens on port 3001 and proxies the API calls to port 8080:

    cd openaev-front
    yarn install
    yarn start
    
Check that it worked

Open http://localhost:3001 and sign in with openaev.admin.email and openaev.admin.password of application-dev.properties (admin@openaev.io and admin in the example).

OpenAEV and OpenCTI both use port 9200 for Elasticsearch: run one development stack at a time, or change a port. Before you push, run the checks of the CI:

PartCommands
Back endmvn spotless:apply (Google Java Format), mvn test with the services running, or mvn test -pl openaev-api -Dtest=MyTestClass for one class
Front end, from openaev-frontyarn lint (no warning allowed), yarn check-ts, yarn depcruise, yarn knip --dependencies, yarn test

openaev-dev/README.md lists the optional services (test database, Kibana, pgAdmin, OpenSearch) and the setup-auto-db script, which starts a PostgreSQL container per branch.

Open a pull request

OpenCTI and OpenAEV check the same conventions on every pull request:

  • The title follows Conventional Commits and ends with the issue: type(scope): description (#issue). Types: feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert. The description starts with a lowercase letter and has no final period. The old [backend] and [frontend] prefixes are discontinued.
  • The pull request is linked to an issue.
  • Every commit is signed. See Signing commits in the GitHub documentation.
ExampleFix the report list for Velvet Harbor

A developer at Example CERT fixes a bug in how OpenCTI sorts the reports on Velvet Harbor, tracked in issue 14210. On Ubuntu, with the tools installed:

git clone https://github.com/OpenCTI-Platform/opencti.git && cd opencti
python3 -m venv ../.python-venv
yarn install && yarn deps:venv
OPENCTI_ADMIN_TOKEN=$(python3 -c 'import uuid; print(uuid.uuid4())')
OPENCTI_ENCRYPTION_KEY=$(openssl rand -base64 32)
cat > opencti-platform/opencti-graphql/config/development.json <<EOF
{"app": {"admin": {"email": "admin@opencti.io", "password": "VelvetHarbor-dev-2026", "token": "$OPENCTI_ADMIN_TOKEN"}, "encryption_key": "$OPENCTI_ENCRYPTION_KEY"}}
EOF
(cd opencti-platform/opencti-dev && docker compose up -d)
yarn dev:watch:venv

They change the sort in the back end, which restarts at each save, and check the list at http://localhost:3000. They run yarn check-ts, yarn lint and yarn test:ci-unit in opencti-platform/opencti-graphql. Then they open a pull request titled fix(backend): sort reports by publication date (#14210), with signed commits.

What's next

NextDevelop XTM Composer
Develop
Integrations, APIs, MCP and contributing.

Published

Overview