Skip to main content

Using Plugins


When we need to extend Apache Answer's functionality, such as adding OAuth login, we can design plugins to implement these features.


Official Plugins

You can find a list of officially supported plugins for Apache Answer here.


The Apache Answer binary supports packaging different required plugins into the binary.


  • Original Apache Answer binary
  • Go >=1.18
  • Node.js >=16.17
  • pnpm >=7

Binary Build


We use the build command provided with the Apache Answer binary to rebuild a version of Apache Answer with the plugin.

For example, let's see how to build an Apache Answer binary that includes the GitHub third-party login plugin.

Using Official Plugins

You can specify the plugins to use with the --with parameter:

# Build Answer with the GitHub connector plugin
$ ./answer build --with

You can also specify the plugin version:

# Build Answer with the GitHub connector plugin version 1.0.0
$ ./answer build --with --output ./new_answer

You can use multiple plugins at the same time:

$ ./answer build \
--with \

Using Local Plugins

If you need to use a local plugin, you can use the following command:

$ ./answer build --with

Cross Compilation

You can use the following command to build a Linux-amd64 binary on macOS:

$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./answer build --with

Specifying the Answer Version

You can use the ANSWER_MODULE environment variable to specify the Answer version:

$ ./answer build --with

You can use the plugin command to list the current binary containing plugins.

$ ./new_answer plugin

# Output:
# github connector[0.0.1] made by answerdev
# google connector[0.0.1] made by answerdev

Docker Build

build with plugin from answer base image

FROM apache/answer as answer-builder

FROM golang:1.19-alpine AS golang-builder

COPY --from=answer-builder /usr/bin/answer /usr/bin/answer

RUN apk --no-cache add \
build-base git bash nodejs npm go && \
npm install -g pnpm@8.9.2

RUN answer build \
--with \
--with \
--with \
--output /usr/bin/new_answer

FROM alpine
LABEL maintainer=""


RUN apk update \
&& apk --no-cache add \
bash \
ca-certificates \
curl \
dumb-init \
gettext \
openssh \
sqlite \
gnupg \
tzdata \
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone

COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
COPY --from=answer-builder /data /data
COPY --from=answer-builder / /
RUN chmod 755 /

VOLUME /data

You can update the --with parameter to add more plugins that you need.

# Create a Dockerfile and copy the content above
$ vim Dockerfile
$ docker build -t answer-with-plugin .
$ docker run -d -p 9080:80 -v answer-data:/data --name answer answer-with-plugin

build with plugin from local code

  1. keep your code up-to-date: Make sure your local code is synchronized with the official repositories, or at least with the v1.3.5 version.
  2. add required plugins: Add your required plugin repositories to the /script/plugin_list file in the root directory, one per line.
  1. build the Docker image: Run the docker build -t <name[:tag]> . command to start building the image.
  2. verify image construction: Run the docker run -d -p 9080:80 -v answer-data:/data --name <container_name> <image_name> command to start the container and locally verify whether the image is built successfully.


The Apache Answer with the plugin version is used in the same way as before. You can find the plugin's configuration in the admin page.




Note that if you are upgrading from a non-plugin version to a plugin version, you also need to execute the upgrade command (also considered as an upgrade).

You need to build a new Apache Answer binary with the new plugin version, then replace the old Apache Answer binary with the new one. As with normal upgrades, you need to execute different upgrade steps depending on the deployment method. For example, if you are using binary deployment, you need to execute the upgrade command.

Third-party Plugin


We recommend the use of official plugins. If you want to use third-party plugins, refer to the following.

  • If the third-party plugin is publicly available, you can build with it like official plugins.
  • If the third-party plugin is private, you need to download it and then build with it.

Develop and Contribute

Please refer to the documentation for details.

Design & Principle

Since Go is a static language, there is no friendly plugin mechanism. Instead of a dynamic approach, we use recompilation for deployment. Please refer to the blog for details.