Skip to content
On this page

The CaseFusion extensions SDK will be made available soon. Until then, create-directus-extension and @directus/extensions-sdk from npm install upstream's tooling, which targets newer Directus releases than CaseFusion.

Installing Extensions ​

There are two possible ways to install extensions to your CaseFusion instance:

  1. Installing through NPM
  2. Installing through the Extensions Folder

Installing Through NPM ​

Extensions can be published to the NPM registry and installed to your CaseFusion instance from there. This way you can install an existing public extension as well as your own published extension. Before you begin, ensure you have a self-hosted instance of CaseFusion via Docker installed on your system.

1. Modify docker-compose.yml

Open the docker-compose.yml file of your project and replace the image option with a build section:

yaml
image: ghcr.io/onainsights/casefusion:10.x.y 
build: 
  context: ./ 
image: ghcr.io/onainsights/casefusion:10.x.y 
build: 
  context: ./ 

This allows you to build a customized Docker Image with the added extensions.

2. Create a Dockerfile

At the root of your project, create a Dockerfile if one doesn't already exist and add the following:

Dockerfile
FROM ghcr.io/onainsights/casefusion:10.x.y

USER root
RUN corepack enable \
 && corepack prepare pnpm@9.15.9 --activate

USER node
RUN pnpm install directus-extension-package-name
FROM ghcr.io/onainsights/casefusion:10.x.y

USER root
RUN corepack enable \
 && corepack prepare pnpm@9.15.9 --activate

USER node
RUN pnpm install directus-extension-package-name

Extension Name

Remember to replace directus-extension-package-name with the name of the extension you want to install. For example, directus-extension-myextension.

3. Build the Docker Image

Build your Docker image:

bash
docker compose build
docker compose build

4. Start the Docker Container

Start your Docker container:

bash
docker compose up
docker compose up

On startup, you'd see that CaseFusion will automatically load any extension installed in the previous steps.

Installing Through the Extensions Folder ​

To locally install extensions, copy the files generated by the directus-extension build command into the extensions folder located at the root of your CaseFusion project.

Configurable Folders

The path to the built extension as well as the extensions directory are configurable and may be located elsewhere.

Before you begin, ensure you have a self-hosted instance of CaseFusion via Docker installed on your system.

1. Create an Extensions Folder

At the root of your project, create an extensions folder if one doesn't already exist to house your extensions.

2. Add your new extension into the extensions folder

Move the package.json file along with the output from the dist/ folder into a new folder in the extensions folder you created earlier.

Your folder structure should look like this:

extensions/
  <extension-name>/
    dist/
      index.js
    package.json
  ...
extensions/
  <extension-name>/
    dist/
      index.js
    package.json
  ...

3. Update Docker Compose File

Open your docker-compose.yml file and add a volume to mount your extensions folder into the Docker container:

yaml
volumes:
  - ./extensions:/directus/extensions/
volumes:
  - ./extensions:/directus/extensions/

4. Start the Docker Container

Start your Docker container:

bash
docker compose up
docker compose up

You should see that your extension has been successfully loaded into the Docker container. Now, go ahead to customize your extension by making changes to the src folder within your extension directory.

Automatically Reload Extensions

To automatically reload extensions every time you make a change, without having to restart CaseFusion, in your docker-compose.yml file, set EXTENSIONS_AUTO_RELOAD=true.