Sign inSign up

weareopensource/node

By weareopensource

Updated about 5 years ago

Node - Boilerplate Back : Express, Jwt, Mongo, Sequelize (Beta)

Image
0

6.7K

weareopensource/node repository overview

Build Status Drone Coveralls Status Code Climate Dependabot badge Known Vulnerabilities Docker Pulls

:globe_with_meridians: WeAreOpenSource Node

:book: 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 :

:computer: Node / Express / Mongoose - Sequelize Orm

:package: Technology Overview

SubjectInformations
Available
ArchitectureLayered 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)
ServerNode >= v14 LTS
Express - body-parser - compression - CORS - method-override
gulp 4 - nodemon
DataBaseMongo 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
TestingJest - SuperTest - Coverage & Watch
example of mocha with gulp available
Securitypassport-jwt - JWT Stateless
bcrypt - zxcvbn - Passwords
SSL - Express / Reverse Proxy (must be activated, otherwise => plain text password)
APIjsend - Default answer wrapper (helper) : status, message, data or error
Helper: default errors handling : formatted by the controller, Custom ES6 errors for other layers
UploadMongo gridfs - mongoose-gridfs - Multer - Sharp - Image stream example, all contentType, image video ..
Logswinston - morgan custom example available
CITravis CI - Drone.io
LinterESLint - ecmaVersion 10 (2019)
DeveloperCoveralls - Code Climate - Dependency status - Dependabot - Snyk
standard-version / semantic-release - commitlint - commitizen - @weareopensource/conventional-changelog
Dependenciesnpm
DeliverDocker & Docker-compose
In reflexion
DocumentationSwagger
Docco
Developeruses v8's builtin debug and inspect options
APIevolution & version guideline

:tada: 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

:pushpin: Prerequisites

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

:boom: Installation

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

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

:runner: 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

:whale: 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 WAOS_VUE_<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 =)'

:pencil2: Contribute

:scroll: 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 ...

:globe_with_meridians: We Are Open Source, Who we are ?

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.

:clipboard: Licence

Packagist

:family: Main Team

  • Pierre Brisorgueil

Github Twitter Youtube Instagram Linkedin

Feel free to help us ! :)

Blog Slack Discord Mail

Tag summary

Content type

Image

Digest

Size

150.2 MB

Last updated

over 6 years ago

docker pull weareopensource/node