Visit the hapi.dev Developer Portal for tutorials, documentation, and support
- Mongoose as ORM MongoDB
- Sequelize as ORM MySql
- Joi as validation request
- Axios as service hitter
- Winston as logging and debug
- Eslint with standard style
- Husky pre-commit to check linter validation before committing code
- Documentation and API
- Version status (builds, dependencies, node versions, licenses, eol)
- Changelog
- Project policies
- Free and commercial support options
This is recommended example of boilerplate project, you can change any name but be sure to check other file where have dependency to changed file
📦hapijs
┣ 📂controllers [all logic control stored here]
┃ ┣ 📂handlers [recommend using versioning of dir name so the api can have version]
┃ ┃ ┗ 📂v1 [make sure you create index.js inside this dir to indexing all route inside this dir]
┃ ┃ ┃ ┣ 📂handler [collection handler placed]
┃ ┃ ┃ ┗ 📂repositories [long queries doing based on inject workers]
┃ ┣ 📂services [if you want hit other service place hitter here]
┃ ┃ ┗ 📂test [service collection example]
┃ ┗ 📂workers [where query based orm stored here]
┣ 📂core [hapi root server and plugins configuration place]
┃ ┣ 📂utils [plugins for general utilization server]
┃ ┣ 📂db [plugins for manage db (sql and mongo)]
┃ ┗ 📂server [core root server and initiation plugins]
┣ 📂logging_data [logging from winston. all logger will store sequelize, request, response]
┣ 📂models [placed models for ORM]
┃ ┣ 📂mongoose [mongo models place here, with create dir name based on database name]
┃ ┃ ┗ 📂unicoop_test [recommend: placing by database name]
┃ ┗ 📂sequelize [sql based models place here, with create dir name based on database name]
┃ ┃ ┗ 📂warko_log [recommend: placing by database name]
┣ 📂utils [where utilization file placed like base config of axios, logger, standard response, etc]
┣ 📜.env.example [you can copy this file and rename to .env as environtment app]
┣ 📜.eslintrc.js [style linter js. you can change based your most known style]
┣ 📜test.js [testing app file]
┗ 📜index.js [this file is iniation file executor where you can place all indexed handlers here]
Automate testing all demo serviceAdd documentation per directoryAdd example mongooseAdd example hit serviceAdd example sequelizeAdd .env.exampleAdd validator exampleAdd worker example- Add redis memcache plugins
