Skip to content

πŸ’» Node - Boilerplate Back : Express, Jwt, Mongo, Sequelize

License

Notifications You must be signed in to change notification settings

weareopensource/Node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CI Coveralls Status Code Climate Dependabot badge Known Vulnerabilities Docker Pulls

🌐 WeAreOpenSource Node

πŸ“– Presentation

This project is a Node stack that can be ran as a standalone BackEnd. Or in a fullstack with another repo of your choice (ex: Vue, Swift).

Quick links :

πŸ’» Node / Express / Mongoose - Sequelize Orm

πŸ“¦ Technology Overview

Subject Informations
Available
Architecture Layered Architecture : everything is separated in layers, and the upper layers are abstractions of the lower ones, that's why every layer should only reference the immediate lower layer (vertical modules architecture with Repository and Services Pattern)
Server Node >= v14 LTS
Express - body-parser - compression - CORS - method-override
gulp 4 - nodemon
DataBase Mongo 4.x LTS - mongoose - User, Crud, Seed, Gridf upload, Options (auth, ssl ..)
Sequelize - PostgreSQL, MySQL, SQLit 4.x (option - crud Task example)
JOI - Models & Repository for database code abstraction
Testing Jest - SuperTest - Coverage & Watch
example of mocha with gulp available
Security passport-jwt - JWT Stateless
bcrypt - zxcvbn - Passwords
SSL - Express / Reverse Proxy (must be activated, otherwise => plain text password)
API jsend - Default answer wrapper (helper) : status, message, data or error
Helper: default errors handling : formatted by the controller, Custom ES6 errors for other layers
Upload Mongo gridfs - mongoose-gridfs - Multer - Sharp - Image stream example, all contentType, image video ..
Logs winston - morgan custom example available
CI Github Action
Linter ESLint - ecmaVersion 10 (2019)
Developer Coveralls - Code Climate - Dependency status - Dependabot - Snyk
standard-version / semantic-release - commitlint - commitizen - @weareopensource/conventional-changelog
Dependencies npm
Deliver Docker & Docker-compose
In reflexion
Documentation Swagger
Docco
Developer uses v8's builtin debug and inspect options
API evolution & version guideline

πŸŽ‰ Features Overview

Core

  • User : classic register / auth or oAuth(microsoft, google) - profile management (update, avatar upload ...)
  • User data privacy : delete all - get all - send all by mail
  • Admin : list users - get user - edit user - delete user

Examples

  • Tasks : list - get - add - edit - delete
  • Files Uploads : get stream - add - delete - get image stream & sharp operations

πŸ“Œ Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

πŸ’₯ Installation

It's straightforward (you can use yarn if you want)

git clone https://github.com/weareopensource/node.git && cd Node
npm i

πŸƒ Running Your Application

Development

  • npm start or npm run serve to run a dev server. Available at http://localhost:3000/.

Production

  • npm run prod to run a prod server. Available at http://localhost:3000/

others

  • debug : npm run debug
  • test : npm test
  • test Watch : npm run test:watch
  • test Coverage : npm run test:coverage
  • seed development= npm run seed:dev
  • seed Production = npm run seed:prod
  • seed Dump Mongo (Dev Team sample) = npm run seed:mongodump be careful to not upload sample in public repo
  • seed Restore Mongo (Dev Team sample) = npm run seed:mongorestore create or update data based on _id, no purge
  • seed Drop Mongo = npm run seed:mongodrop
  • generate SSL certs : npm run generate:sslCerts
  • lint : npm run lint
  • commit : npm run commit
  • release : npm run release -- --first-release standard version, changelog, tag & choose version number : -- --release-as 1.1.1
  • release:auto : GITHUB_TOKEN=XXXXX npm run release:auto semantic release, changelog, tag, release require repositoryUrl conf in package.json

🐳 Docker Way

docker

  • docker run --env WAOS_NODE_db_uri=mongodb://host.docker.internal/WaosNodeDev --env WAOS_NODE_host=0.0.0.0 --rm -p 3000:3000 weareopensource/node

if you want to build yourself : docker build -t weareopensource/node .

docker-compose

  • docker-compose up

Configuration

The default configuration is : config/defaults/development.js The other configurations : config/defaults/*.js overwrite the default configuration, you can create your own.

We take into account all system environment variables defined under the form WAOSVUE<path_toVariable>. A script turns under the hood those system environment variables into an object, infering paths from the varialbles name, merged to the configuration defined on config/defaults to regenerate the config.

So configuration avalable on config/defaults/development file are overidable. You can for instance define the app name by defining those system environment variables :

WAOS_NODE_app_title='my app =)'

✏️ Contribute

πŸ“œ History

This work is based on MEAN.js and more precisely on a fork of the developers named Riess.js. The work being stopped we wished to take it back, we want to create updated stack with same mindset "simple", "easy to use". The toolbox needed to start projects, but not only with Node and Angular ...

Today, we dreams to create Backs/Fronts, aligns on feats, in multiple languages, in order to allow anyone to compose fullstack on demand (React, Angular, VusJS, Node, Nest, Swift, Go). Feel free to discuss, share other kind of bricks, and invite whoever you want with this mindset to come help us.

Feel free to help us ! :)

πŸ“‹ Licence

Packagist

πŸ”— Links

Blog Slack Discord Mail