Sign inSign up

haohanyang/compass-web

By haohanyang

Updated 23 days ago

Docker images of MongoDB Compass Web

Image
Developer tools
Databases & storage
3

50K+

haohanyang/compass-web repository overview

Compass Web

A web-based port of MongoDB Compass — the official MongoDB GUI — served as a self-hosted web application.

Quick Start

docker run -p 8080:8080 \
  -e CW_MONGO_URI="mongodb://localhost:27017" \
  haohanyang/compass-web

Then open http://localhost:8080 in your browser.

Docker Compose

services:
  compass:
    image: haohanyang/compass-web
    ports:
      - "8080:8080"
    environment:
      - CW_MONGO_URI=mongodb://localhost:27017
      - CW_ENABLE_SHELL=true
      - CW_MASTER_PASSWORD=changeme

Configuration

All options can be set via environment variables using the CW_ prefix (e.g., --mongo-uriCW_MONGO_URI).

Core
Environment VariableDefaultDescription
CW_MONGO_URIMongoDB connection string(s). Separate multiple URIs with spaces.
CW_PORT8080Port the server listens on.
CW_HOSTlocalhostHost the server binds to. Use 0.0.0.0 to accept external connections.
CW_BASE_ROUTEURL prefix for all routes, e.g. /compass. Useful when running behind a reverse proxy at a sub-path.
CW_APP_NAMECompass WebApplication name shown in the UI.
Connections
Environment VariableDefaultDescription
CW_ENABLE_EDIT_CONNECTIONSfalseAllow users to add, edit, and delete connections from the UI.
CW_MASTER_PASSWORDPassword used to encrypt stored connection credentials. Required when persisting connections with sensitive credentials.
CW_ENABLE_SHELLfalseEnable the integrated MongoDB Shell.
Authentication
Environment VariableDefaultDescription
CW_BASIC_AUTH_USERNAMEUsername for HTTP Basic Authentication. Both username and password must be set to enable auth.
CW_BASIC_AUTH_PASSWORDPassword for HTTP Basic Authentication.
GenAI (AI-assisted queries)
Environment VariableDefaultDescription
CW_ENABLE_GEN_AIfalseEnable AI-assisted query and aggregation generation.
CW_OPENAI_API_KEYOpenAI API key. Required when GenAI is enabled.
CW_OPENAI_MODELgpt-4o-miniOpenAI model to use for query generation.
CW_ENABLE_GEN_AI_SAMPLE_DOCUMENTSfalseSend sample documents to the AI to improve query accuracy.
CW_QUERY_SYSTEM_PROMPT(built-in)Override the system prompt used for query generation.
CW_AGGREGATION_SYSTEM_PROMPT(built-in)Override the system prompt used for aggregation generation.

Examples

Behind a reverse proxy at a sub-path
docker run -p 8080:8080 \
  -e CW_HOST=0.0.0.0 \
  -e CW_BASE_ROUTE=/compass \
  -e CW_MONGO_URI="mongodb://mongo:27017" \
  haohanyang/compass-web
With Basic Authentication
docker run -p 8080:8080 \
  -e CW_MONGO_URI="mongodb://mongo:27017" \
  -e CW_BASIC_AUTH_USERNAME=admin \
  -e CW_BASIC_AUTH_PASSWORD=secret \
  haohanyang/compass-web
With GenAI query generation
docker run -p 8080:8080 \
  -e CW_MONGO_URI="mongodb://mongo:27017" \
  -e CW_ENABLE_GEN_AI=true \
  -e CW_OPENAI_API_KEY=sk-... \
  haohanyang/compass-web

Source

github.com/haohanyang/compass-web

Tag summary

Content type

Image

Digest

sha256:f4f8fe4e2

Size

124.2 MB

Last updated

23 days ago

docker pull haohanyang/compass-web