Skip to content

stanleygomes/nodevader

Repository files navigation

Nodevader

CodeFactor Lint and test

An awesome Node.js boilerplate. Come to the node side πŸŒ‘

The main goal of Nodevader is to set patterns to be easily implemented on Nodejs projects. We want to make easy to quick start a Nodejs ambient with the basic resources every project could have. Check out the patterns we defined this document bellow.


Icon by Filipe Carvalho


Table of contents

  1. Requirements
  2. How to get Started
  3. Gitflow recommendations
  4. Patterns and libs
  5. Samples and tutorials of use
  6. Project structure
  7. Licence

πŸ“ Requirements

This boilerplate supports Node.js from version v12.x

πŸš€ Startup

Step by step to get this up and running

Clone repo and go to project folder

git clone https://github.com/stanleygomes/nodevader.git && cd nodevader

Install dependencies

npm install

Start server

Via express server

npm run dev

Start enviroment

Copy enviroment variables template

cp .env.template .env

Via docker-compose (start database, run migrations and start server)

docker-compose up

To test it on the browser, simply go to: http://localhost:3000/welcome

πŸ”± Git flow

To file a new a feature

  • create a branch from master branch. Use the pattern: feature/description
  • file a pull request on master branch
  • since your PR is aproved, it will be merged to master branch
  • in a moment in time we'll create a release, using the pattern: release/vX.X.X

βœ”οΈ Patterns

These are some of patterns definitions to help us to keep a default arquitecture.

  • Package manager: npm, sure
  • Node version: v12.x
  • Node Framework: Express framework
  • Node server: Nodemon and PM2
  • Linter: eslint standard pattern
  • Database: Use knex query builder and some utils methods on utils/database.js (mysql and postgres support)
  • Migrations: Run on a container described in docker-compose file: boxfuse/flyway image
  • Template transpiler: Mustache templates
  • i18n: take a look here
  • Date and time: date-fns
  • Test: Mocha & Chai
  • Logs: use Winston
  • Http Request: use Axios
  • Authentication: JWT
  • SMTP email: Send emails using Nodemailer and html templates with mustache
  • Express: Cors enabled, cookie and body parser, helmet headers
  • Migrations: use postgrator, running npm run migrate. Place your migrations on src/migrations
  • Docker compose and dockerfile attached running migrations e starting database and nodejs

πŸ“š Tutorials

Some useful tutorials to improve nodevader's features:

πŸ“‚ Project structure

Basic folder structure

  • src/config: App config (some of these are inherited from .env file), constants, configuration and i18n
  • src/api: Endpoints and business logic
  • src/static: Images, styles, fonts and other files that can be served
  • src/middlewares: Middlewares for routes
  • src/routes: Routes, :]
  • src/templates: mustache interpreted files
  • src/test: Mocha and chai unity tests
  • src/utils: Utilities and modules superior layer implementations

πŸ“œ License

MIT license. Copyright (c) 2021 Stanley.
For more information, see the LICENSE file.