Advanced template for Node.
app
- MVCcontrollers
- Application controllersjobs
- Application jobsmiddlewares
- Middlewares da aplicaçãomodels
- Application middlewaresviews
- Application email templates
config
- Application settingsdatabase
- Database configurationlib
- Email configurationapp.js
- Encapsulation of the entire applicationqueue.js
- Queue processingroutes.js
- Application routesserver.js
- Server initiation
Remember to execute the command yarn upgrade
to update with dependencies.
Normal:
- @sentry/node
- bcryptjs
- bee-queue
- dotenv
- express
- express-async-errors
- express-handlebars
- jsonwebtoken
- multer
- nodemailer
- nodemailer-express-handlebars
- pg
- pg-hstore
- sequelize
- youch
- yup
Dev Dependencies:
- nodemon
- sequelize-cli
- sucrase
For standardization of commits for GitHub within a project, using the library Husky, together with libraries commitizen, lint-staged, @commitlint/config-conventional and @commitlint/cli.
Add the Hunsky library in development.
yarn add husky -D
Also add the following libraries below, under development.
yarn add commitizen lint-staged @commitlint/config-conventional @commitlint/cli -D
Paste the excerpt below into your file package.json
.
{
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
}
},
"lint-staged": {
"*.js": [
"prettier --write",
"eslint --fix --ignore-pattern '!.eslintrc.js'",
"git add ."
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Create a file called commitlint.config.js
at the root of the project and paste the code below.
module.exports = { extends: ['@commitlint/config-conventional'] };
After these settings, just type git add .
and git commit
on your terminal and Husky will take action.
Below are listed possible questions that Husky will ask.
- Select the type of change that you're committing: (Use arrow keys)
feat
: A new featurefix
: A bug fixdocs
: Documentation only changesstyle
: Changes that do not affect the meaning of the code (white-space, for matting, missing semi-colons, etc)refactor
: A code change that neither fixes a bug nor adds a featureperf
: A code change that improves performancetest
: Adding missing tests or correcting existing testsbuild
: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)ci
: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)chore
: Other changes that don't modify src or test filesrevert
: Reverts a previous commit
- What is the scope of this change (e.g. component or file name): (press enter to skip)
- Write a short, imperative tense description of the change (max 66 chars):
- Provide a longer description of the change: (press enter to skip)
- Are there any breaking changes? (y/N)
- A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself:
- Describe the breaking changes:
- Does this change affect any open issues? (y/N)
- Add issue references (e.g. "fix #123", "re #123".):
For better standardization of codes within the project, we use the ESLint and Prettier libraries.
Follow the installation instructions on the link below:
Eslint, Prettier and EditorConfig
Create Migration
yarn sequelize migration:create --name=create-users
Run Migration
yarn sequelize db:migrate
Undo Migrate
yarn sequelize db:migrate:undo
yarn sequelize db:migrate:undo:all
Create Seed
yarn sequelize seed:generate --name admin-user
Run Seed
yarn sequelize db:seed:all
Containers
docker ps
docker ps -a
docker start <id>
docker stop <id>
docker container rm <id>
Redis
docker run --name redisdatabase -p 6379:6379 -d -t redis:alpine
Docker
docker run --name database -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres
MIT © Node Eddy
Give a ⭐️ if this project helped you!