Node.js API server/backend based on fastify and MongoDB as a database for persisting data, GitHub Actions build and code linter, minimal tooling and native node test runner with native coverage. Can be used as a template to quickly bootstrap yor Node.js API http server project.
- automatic reloading using fastify-cli
- native ESM module (ECMAScript) with imports/exports
- load .env to environment and validate using fastify-env and dotenv
- linting and fixing using neostandard
- git pre-commit hooks using husky
- integration tests with node test runner
- coverage report using native node coverage
- continuous integration using GitHub Actions CI
- code coverage tracking using coveralls
- dependency updates notifications using dependabot
- dependency merging using GitHub Action Merge Dependabot
- authoring of release notes using release-drafter
- code linting with MegaLinter
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
git clone [email protected]:mihaur/node-fastify-template.git
cd node-fastify-template
cp .env.example .env
npm install
npm start
Use .env to store your environment dependant configuration options and secrets. This file should not be checked in to your repository, use .env.sample as example but exclude real secrets.
Linting is done using neostandard. Use npm run lint
to run linter. You can also automatically fix linter errors by running npm run lint:fix
.
Integration tests are stored in test/**.spec.js. Tests are run by Node test runner. Run npm run test
to run both unit and integration tests.
Run npm run coverage
to generate HTML test coverage report. Web browser is opened after tests are run.