返回排行榜

danielfsousa/express-rest-boilerplate

JavaScript

⌛️ Express starter for building RESTful APIs

expressnodejsboilerplatestarterrest-apidockermongooseexpress-boilerplatemongodbmicroservicesapirest
Star 增长趋势
Star
2.4k
Forks
613
周增长
Issues
13
1k2k
2017年7月2020年7月2023年7月2026年7月
制品库npmnpm install express-rest-boilerplate
README

Express ES2017 REST API Boilerplate

PRs Welcome npm version Build Status Coverage Status

Boilerplate/Generator/Starter Project for building RESTful APIs and microservices using Node.js, Express and MongoDB

Features

  • No transpilers, just vanilla javascript
  • ES2017 latest features like Async/Await
  • CORS enabled
  • Uses yarn
  • Express + MongoDB (Mongoose)
  • Consistent coding styles with editorconfig
  • Docker support
  • Uses helmet to set some HTTP headers for security
  • Load environment variables from .env files with dotenv
  • Request validation with joi
  • Gzip compression with compression
  • Linting with eslint
  • Tests with mocha, chai and sinon
  • Code coverage with istanbul and coveralls
  • Git hooks with husky
  • Logging with morgan
  • Authentication and Authorization with passport
  • API documentation generation with apidoc
  • Continuous integration support with travisCI
  • Monitoring with pm2

Requirements

Getting Started

Clone the repo and make it yours:

git clone --depth 1 https://github.com/danielfsousa/express-rest-es2017-boilerplate
cd express-rest-es2017-boilerplate
rm -rf .git

Install dependencies:

yarn

Set environment variables:

cp .env.example .env

Running Locally

yarn dev

Running in Production

yarn start

Lint

# lint code with ESLint
yarn lint

# try to fix ESLint errors
yarn lint:fix

# lint and watch for changes
yarn lint:watch

Test

# run all tests with Mocha
yarn test

# run unit tests
yarn test:unit

# run integration tests
yarn test:integration

# run all tests and watch for changes
yarn test:watch

# open nyc test coverage reports
yarn coverage

Validate

# run lint and tests
yarn validate

Logs

# show logs in production
pm2 logs

Documentation

# generate and open api documentation
yarn docs

Docker

# run container locally
yarn docker:dev

# run container in production
yarn docker:prod

# run tests
yarn docker:test

Deploy

Set your server ip:

DEPLOY_SERVER=127.0.0.1

Replace my Docker username with yours:

nano deploy.sh

Run deploy script:

yarn deploy

Tutorials

Inspirations

License

MIT License - Daniel Sousa

相关仓库
goldbergyoni/nodebestpractices

✅ The Node.js best practices list (July 2026)

DockerfileCreative Commons Attribution Share Alike 4.0 Internationalnodejsjavascript
twitter.com/nodepractices/
105.4k10.7k
expressjs/express

Fast, unopinionated, minimalist web framework for node.

JavaScriptnpmMIT Licensejavascriptnodejs
expressjs.com
69.2k24.3k
payloadcms/payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

TypeScriptnpmMIT Licenseheadless-cmscms
payloadcms.com
43.7k4k
gofiber/fiber

⚡️ Express inspired web framework written in Go

GoGo ModulesMIT Licensegogolang
gofiber.io
40k2k
goldbergyoni/javascript-testing-best-practices

📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2025)

JavaScriptnpmMIT Licensenodejstesting
testjavascript.com
24.6k2.1k
jaredhanson/passport

Simple, unobtrusive authentication for Node.js.

JavaScriptnpmMIT Licensenodejsexpress
passportjs.org
23.5k1.3k
nswbmw/N-blog

《一起学 Node.js》

JavaScriptnpmtutorialnodejs
15.4k4.5k
HabitRPG/habitica

A habit tracker app which treats your goals like a Role Playing Game.

JavaScriptnpmOtherhabiticajavascript
habitica.com
14k4.4k
apollographql/apollo-server

🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.

TypeScriptnpmMIT Licensegraphqlgraphql-server
apollographql.com/docs/apollo-server/
13.9k2k
graphile/crystal

🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more!

TypeScriptnpmMIT Licensegraphqlpostgres
graphile.org
12.9k620
bailicangdu/node-elm

Backend system based on node.js + Mongodb. 基于 node.js + Mongodb 构建的后台系统

JavaScriptnpmGNU General Public License v2.0nodeexpress
cangdu.org/elm/
12.3k3.7k
linnovate/mean

The MEAN stack uses Mongo, Express, Angular(6) and Node for simple and scalable fullstack js applications

TypeScriptnpmstackangular
mean.io
12.1k3.4k