A Teenage Mutant Node Boilerplate
The main goal of Nodetello is to set patterns to be easily implemented on Nodejs projects. We want to make easy to quick start a Nodejs ambient with the basic resources every project could have. Check out the patterns we defined this document bellow.
It was inspired by Juggernaut.
Gif by Reuno
Step by step to get this up and running
git clone https://github.com/nodetello/nodetello.git && cd nodetello
npm install
Via express server
npm run dev
Via docker-compose (start database, run migrations and start server)
docker-compose up
To test it on the browser, simply go to: http://localhost:3000/helloWorld
To file a new a feature
- create a branch from
master
branch. Use the pattern:feature/description
- file a pull request on
master
branch - since your PR is aproved, it will be merged to
master
branch - in a moment in time we'll create a release, using the pattern:
release/vX.X.X
These are some of patterns definitions to help us to keep a default arquitecture.
- Package manager: npm, sure
- Node version: v10.x
- Node Framework: Express framework
- Node server: Nodemon and PM2
- Linter: eslint standard pattern
- Database: Use knex query builder and some utils methods on utils/database.js (mysql and postgres support)
- Migrations: Run on a container described in docker-compose file: boxfuse/flyway image
- Template transpiler: Mustache templates
- i18n: take a look here
- Date and time: moment
- Test: Mocha & Chai
- Logs: use Winston
- Http Request: use Axios
- Authentication: JWT
- Firebase: Storage bucket and Firestore database
- SMTP email: Send emails using Nodemailer and html templates with mustache
- Express: Cors enabled, cookie and body parser, helmet headers
- Docker compose and dockerfile attached running migrations e starting database and nodejs
Basic folder structure
- src/config: App config (some of these are inherited from .env file), constants, configuration and i18n
- src/api: Endpoints and business logic
- src/static: Images, styles, fonts and other files that can be served
- src/middlewares: Middlewares for routes
- src/routes: Routes, :]
- src/templates: mustache interpreted files
- src/test: Mocha and chai unity tests
- src/utils: Utilities and modules superior layer implementations