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

node-express-mongoose-demo

> 后端框架
Open source

A simple demo app using node and mongodb for beginners (with docker)

5.1K stars0 likes1 views
WebsiteGitHub

About

A simple demo app using node and mongodb for beginners (with docker)

Nodejs Express Mongoose Demo

This is a demo application illustrating various features used in everyday web development, with a fine touch of best practices. The demo app is a blog application where users can signup, create an article, delete an article and add comments etc.

Table of contents:

  • Boilerplate
  • Install
  • Tests
  • Docker
  • License

Boilerplate

Want to build something from scratch? use the boilerplate

  • Checkout the apps that are built using this approach
  • The wiki is wip, it has some information about the way application is setup.

Install

bash
git clone git://github.com/madhums/node-express-mongoose-demo.git
npm install
cp .env.example .env
npm start

Then visit http://localhost:3000/

NOTE: Do not forget to set the twitter, google, linkedin and github CLIENT_IDs and SECRETs. In development env, you can set the env variables in .env and replace the values there. In production env, it is not safe to keep the ids and secrets in a file, so you need to set it up via commandline. If you are using heroku checkout how environment variables are set here.

Tests

bash
npm test

Docker

You can also use docker for development. Make sure you run npm install on your host machine so that code linting and everything works fine.

bash
npm i
cp .env.example .env

Start the services

bash
docker-compose up -d

View the logs

bash
docker-compose logs -f

In case you install a npm module while developing, it should also be installed within docker container, to do this first install the module you want with simple npm i module name, then run it within docker container

bash
docker-compose exec node npm i

If you make any changes to the file, nodemon should automatically pick up and restart within docker (you can see this in the logs)

To run tests

bash
docker-compose exec -e MONGODB_URL=mongodb://mongo:27017/noobjs_test node npm test

Note that we are overriding the environment variable set in .env file because we don't want our data erased by the tests.

Note: The difference between exec and run is that, exec executes the command within the running container and run will spin up a new container to run that command. So if you want to run only the tests without docker-compose up, you may do so by running docker-compose run -e MONGODB_URL=mongodb://mongo:27017/noobjs_test node npm test

License

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptdemodockerexpressmongodb

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 生态主流微服务框架