Skip to content

A delightful way to building a Node.js RESTful API Services with beautiful code written in Vanilla Javascript

License

Notifications You must be signed in to change notification settings

toantranmei/nodejs-api-starter

Repository files navigation

RHP Team

Nodejs API Boilerplate

travis appveyor StackShare

A delightful way to building a Node.js RESTful API Services with beautiful code written in Vanilla Javascript.
Inspired by the awesome framework & other repo(s) on Github, Gitlab, Gitee,...
Made with ❤️ by Tran Toan


❯ Why I should be use it

My main goal with this project is a feature complete server application. I like you to be focused on your business and not spending hours in project configuration.

Try it!! I'm happy to hear your feedback or any kind of new features.

Features

  • NoSQL database: MongoDB object data modeling using Mongoose
  • API documentation: with swagger-jsdoc and swagger-ui-express
  • Process management: advanced production process management using PM2
  • Dependency management: with Yarn
  • Environment variables: using dotenv and cross-env
  • Security: set security HTTP headers using helmet
  • Santizing: sanitize request data against xss and query injection
  • CORS: Cross-Origin Resource-Sharing enabled using cors
  • Code coverage: using coveralls
  • Code quality: with Codacy
  • Git hooks: with husky and lint-staged
  • Linting: with ESLint and Prettier
  • Editor config: consistent editor configuration using EditorConfig
  • Authentication and authorization: using passport
  • Validation: request data validation using Joi
  • Logging: using winston and morgan
  • Testing: unit and integration tests using Jest
  • Error handling: centralized error handling mechanism
  • Compression: gzip compression with compression
  • CI: continuous integration with Travis CI
  • Docker support

❯ Getting Started

Step 1: Set up the Development Environment

You need to set up your development environment before you can do anything.

Install Node.js and NPM

Install yarn globally

npm install --global yarn

Step 2: Create new Project

Fork or download this project. Configure your package.json for your new project.

Then copy the .env.example file and rename it to .env. In this file you have to add your database connection information.

Create a new database with the name you have in your .env-file.

Then setup your application environment.

yarn install

This installs all dependencies with yarn. After that your development environment is ready to use.

Step 3: Serve your App

Go to the project dir and start your app with this yarn script.

yarn dev

This starts a local server using nodemon, which will watch for any file changes and will restart the server according to these changes. The server address will be displayed to you as http://localhost:3000 [default].

❯ Contributing

Contributions are more than welcome! Please check out the contributing guide.

❯ License

MIT