Skip to content

adamyeats/nodejs-project-template

Repository files navigation

Node.js Project Template

code style: prettier

Hey there! 👋 This is my project template for Node.js projects. It is designed to provide a usable project skeleton with all of my linter rules, tooling, preferences etc. already in place, so I can spend more time building stuff, and less time setting it all up. It is provided in a fully documented state, with plenty of code comments, so that people who are unfamiliar with Node.js can see exactly what everything does.

Quick Start

  • Initialise the project by cloning it into a new directory
    • You may also want to purge this repositories git history before you start, you can do so with rm -rf .git
  • Copy .env.example to .env and fill in the required variables
  • Run npm install to install the dependencies
  • Run npm dev to start the tsc compiler and nodemon in watch mode

Development

This project requires at least Node.js v18. Always use the latest LTS version of Node.js when you can!

Version management configuration for Node.js is provided for volta. I recommend you have this installed to automatically switch betIen Node.js versions when you enter one of our project directories. This allows for more deterministic and reproducible builds, which makes debugging easier.

You use volta to configure the project to use the latest LTS version of Node.js by running:

volta pin node@lts

You can run this command again to update the version.

Installation

To install the dependencies:

npm install

You can then run the following to start the project in dev mode.

npm run dev

This runs the build:watch and start:debug commands at the same time.

Debugging the server

You can run the following to only start the server in debug mode. This will also watch your files for changes, and reload the server when your files are saved.

npm run start:debug

TypeScript Compilation

You can also run the following to only start the compiler in watch mode.

npm run build:watch

You can also build the library without watching the directory:

npm run build

Testing

The tests for this library use Jest as the test runner. Once you've installed the dependencies, you can run the following command in the root of this repository to run the tests:

npm run test

Versioning

This repo uses Semantic Versioning (often referred to as semver).

Contributing

Thinking of contributing to this repo? Awesome! 🚀

Please follow the Contribution guide and follow the Code of Conduct.

Further reading

Node.js

TypeScript

Miscellaneous

About

🟩 My Node.js project template.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published