Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

mongo-express

> 后端框架
Open source

Web-based MongoDB admin interface, written with Node.js and Express

6.0K stars0 likes3 views
WebsiteGitHub

About

Web-based MongoDB admin interface, written with Node.js and Express

mongo-express

A web-based admin interface for MongoDB or compatible services (FerretDB, Amazon DocumentDB). Built with Node.js, Express, and Bootstrap 5.

Features

  • Connect to multiple databases
  • View/add/delete databases
  • View/add/rename/delete collections
  • View/add/update/delete documents
  • Preview audio/video/image assets inline in the collection view
  • Nested and/or large objects are collapsible for easy overview
  • Async on-demand loading of big document properties (>100KB default) to keep collection view fast
  • GridFS support - add/get/delete incredibly large files
  • Use BSON data types in documents
  • Mobile / Responsive - Bootstrap 5 works passably on small screens when you're in a bind
  • Connect and authenticate to individual databases
  • Authenticate as admin to view all databases
  • Database blacklist/whitelist
  • Custom CA/TLS/SSL and CA validation disabling
  • Supports replica sets
  • OpenIdConnect Authentication

Screenshots

Home Page Database View Collection View Editing A Document

These screenshots are from version 0.30.40 View the album for more screenshots: (server status, database views, etc..) https://imgur.com/a/9vHsF

Development

To test or develop with the latest version (master branch) you can install using this git repository:

bash
npm i mongo-express@github:mongo-express/mongo-express
OR
yarn add mongo-express@github:mongo-express/mongo-express
OR
pnpm add mongo-express@github:mongo-express/mongo-express

Copy config.default.js to config.js and edit the default property to fit your local environment

Run the development build using:

bash
npm run start-dev
OR
yarn start-dev
OR
pnpm run start-dev

Usage (npm / yarn / pnpm / CLI)

mongo-express requires Node.js v22 or higher.

To install:

bash
npm i -g mongo-express
OR
yarn add -g mongo-express
OR
pnpm add -g mongo-express

Or if you want to install a non-global copy:

bash
npm i mongo-express
OR
yarn add mongo-express
OR
pnpm add mongo-express

By default config.default.js is used where the basic access authentication is admin:pass. This is obviously not safe, and there are warnings in the console.

To configure:

Copy YOUR_PATH/node_modules/mongo-express/config.default.js into a new file called YOUR_PATH/node_modules/mongo-express/config.js.

Note: YOUR_PATH will depend on your current OS user and system configuration. You can see it in the output text shown after executing npm install.

Fill in your MongoDB connection details and any other options you want to change in config.js.

You will also need to create a .env file with the variables for your cookie and session secrets. Replace these values with randomly generated secrets:

ME_CONFIG_SITE_COOKIESECRET: 'yourcookiesecret',
ME_CONFIG_SITE_SESSIONSECRET: 'yoursessionsecret',

To run:

bash
cd YOUR_PATH/node_modules/mongo-express/ && node app.js

or if you installed it globally, you can immediately start mongo-express like this:

mongo-express

You can add some configuration options. Example:

bash
node app.js --url mongodb://127.0.0.1:27017

or:

mongo-express --URL mongodb://127.0.0.1:27017

Configuration options:

Option Short Description
--version -V output the version number
--url <url> -U <url> connection string url (<url> example: mongodb://127.0.0.1:27017)
--admin -a enable authentication as admin
--port <port> -p <port> listen on specified port (default <port> is 8081)
--help -h display help for command options

Usage (Express middleware)

To mount as Express middleware (see node_modules/mongo-express/app.js):

var mongo_express = require('mongo-express/lib/middleware')
var mongo_express_config = require('./mongo_express_config')

app.use('/mongo_express', mongo_express(mongo_express_config))

Usage (Docker)

Make sure you have a running MongoDB container on the same Docker network (--network some-network below). The Docker image defaults to mongodb://mongo:27017, so the MongoDB container must be reachable from the mongo-express container as mongo — start it with --name mongo or --network-alias mongo — unless you set ME_CONFIG_MONGODB_URL to a different hostname.

If MongoDB was initialized with MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD, include those credentials in ME_CONFIG_MONGODB_URL and authenticate against the admin database, for example mongodb://root:password@mongo:27017/?authSource=admin. ME_CONFIG_BASICAUTH_USERNAME and ME_CONFIG_BASICAUTH_PASSWORD only control the mongo-express web login; they are not used to authenticate to MongoDB.

Use the Docker Hub image:

bash
$ docker run -it --rm -p 8081:8081 --network some-network mongo-express

Build from source:

Build an image from the project directory, then run the image.

bash
$ docker build -t mongo-express .
$ docker run -it --rm -p 8081:8081 --network some-network mongo-express

Building with OIDC support:

To enable OIDC (OpenID Connect) authentication support in the Docker image, use the ENABLE_OIDC build argument:

bash
$ docker build -t mongo-express --build-arg ENABLE_OIDC=true .
$ docker run -it --rm -p 8081:8081 --network some-network mongo-express

When ENABLE_OIDC=true is set, the express-openid-connect package will be installed during the build process, enabling OIDC authentication features.

You can use the following environment variables to modify the container's configuration:

Name Default Description
ME_CONFIG_MONGODB_URL mongodb://mongo:27017 MongoDB connection string. Should include admin username and password if you want to enable admin access to all databases and see server statistics. When using the root user created by the official MongoDB image, add authSource=admin, for example mongodb://root:password@mongo:27017/?authSource=admin. If admin access is not enabled, it should also include database name (/defaultauthdb) to connect to.
ME_CONFIG_MONGODB_ENABLE_ADMIN true Enable administrator access. Send strings: "true" or "false".
ME_CONFIG_MONGODB_ALLOW_DISK_USE false Remove the limit of 100 MB of RAM on each aggregation pipeline stage.
ME_CONFIG_MONGODB_TLS false Use TLS client certificate
ME_CONFIG_MONGODB_TLS_ALLOW_CERTS true Validate mongod server certificate against CA
ME_CONFIG_MONGODB_TLS_CA_FILE `` CA certificate File (.pem)
ME_CONFIG_MONGODB_TLS_CERT_KEY_FILE `` TLS client certificate+key file (.pem)
ME_CONFIG_MONGODB_TLS_CERT_KEY_FILE_PASSWORD `` TLS client certificate key file password (.pem)
ME_CONFIG_MONGODB_TLS_CRL_FILE `` TLS certificate revocation list file (.pem)
ME_CONFIG_MONGODB_URL_FILE `` File version of ME_CONFIG_MONGODB_URL
ME_CONFIG_MONGODB_AWS_DOCUMENTDB false This allow AWS DocumentDB compatibility (experimental)
ME_CONFIG_SITE_BASEURL / Set the express baseUrl to ease mounting at a subdirectory. Remember to include leading and trailing slash.
ME_CONFIG_HEALTH_CHECK_PATH /status Set the mongo express healthcheck path. Remember to add the forward slash at the start.
ME_CONFIG_SITE_COOKIESECRET `` String used by cookie-parser middleware to sign cookies.
ME_CONFIG_SITE_SESSIONSECRET `` String used to sign the session ID cookie by express-session middleware.
ME_CONFIG_BASICAUTH false Deprecated, use ME_CONFIG_BASICAUTH_ENABLED instead.
ME_CONFIG_BASICAUTH_ENABLED false Enable Basic Authentication. Send strings: "true" or "false".
ME_CONFIG_AUTH_STRATEGY `` How visitors sign in: basic (browser prompt), form (sign-in page, works with password managers) or oidc. Unset, follows the flags below.
ME_CONFIG_BASICAUTH_USERNAME admin mongo-express web login name.
ME_CONFIG_BASICAUTH_USERNAME_FILE `` File version of ME_CONFIG_BASICAUTH_USERNAME
ME_CONFIG_BASICAUTH_PASSWORD pass mongo-express web login password.
ME_CONFIG_BASICAUTH_PASSWORD_FILE `` File version of ME_CONFIG_BASICAUTH_PASSWORD
ME_CONFIG_OIDCAUTH_ENABLED false Enable OpenIdConnect Authentication. Send strings: "true" or "false".
ME_CONFIG_OIDCAUTH_ISSUER `` OAuth2 Issuer. Root URL to the openidconnect metadata eg. "<issuer>/.well-known/openid-configuration"
ME_CONFIG_OIDCAUTH_ISSUER_FILE `` File version of ME_CONFIG_OIDCAUTH_ISSUER
ME_CONFIG_OIDCAUTH_CLIENTID `` OAuth2 ClientId. The client must be private and allowed to perform the Authorization Code Flow grant.
ME_CONFIG_OIDCAUTH_CLIENTID_FILE `` File version of ME_CONFIG_OIDCAUTH_CLIENTID
ME_CONFIG_OIDCAUTH_CLIENTSECRET `` OAuth2 Client Secret.
ME_CONFIG_OIDCAUTH_CLIENTSECRET_FILE `` File version of ME_CONFIG_OIDCAUTH_CLIENTSECRET
ME_CONFIG_OIDCAUTH_SECRET `` A random secret used by the library to init the Authorization Code Flow (required)
ME_CONFIG_OIDCAUTH_SECRET_FILE `` File version of ME_CONFIG_OIDCAUTH_SECRET_FILE
ME_CONFIG_OIDCAUTH_BASEURL `` OAuth2 base url.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptexpress-middlewareguihacktoberfesthacktoberfest2020

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架