๐ WeAreOpenSource Node + Typescript - Beta
๐ 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 :
- Mindset and what we would like to create
- How to start a project and maintain updates from stacks
- Global roadmap and ideas about stacks
- How to contribute and help us Our stack node is actually in Beta.
๐ป Node / Express / Mongoose - Sequelize Orm
- Knowledges JS
- Demo (or working with Vue stack here, email: [email protected], password: TestWaos@2019)
๐ฆ 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 | Travis CI - Drone.io |
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:
- Git - Download & Install Git
- Node.js (10.x) - Download & Install Node.js
๐ฅ 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
ornpm run serve
to run a dev server. Available athttp://localhost:3000/
.
Production
npm run prod
to run a prod server. Available athttp://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 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 =)'
โ๏ธ 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 ...
๐ 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.
๐ Licence
๐ช Main Team
- Pierre Brisorgueil
Feel free to help us ! :)