Assume you wish to begin a new project in a safe and consistent development environment. In such situation, you may need to configure things like "linters," code style tools, test frameworks, git hooks, and so on. This blog includes all of the tedious configuration so you can focus on the fun part, coding.
The concept is comparable to scripts such as create-react-app.
I'll go over how to utilise and the tools included in this boilerplate shortly below.
embed The GitHub project contains more details :)
Starting a New Project
Install TypeScript Node and global TypeScript.
npm install -g typescript ts-node
Clone this repository
git@github.com:shivamsingh478/nodejs-typescript-express-boilerplate.git
The cloned repository will look like this:-
Then Install all the dependdencies
npm install
Run the Application
npm run start
Build the Application
npm run build
Tooling
These are the tools already configured on this boilerplate:
- TypeScript
- Jest
- ESLint
- Prettier
- Husky
- Lint Staged
- Commit Lint
- Nodemon
- Docker and Docker Compose
- CI with GitHub Actions
ESLint and Prettier assure proper code style and practises.
Commit, Husky, and Lint Staged Lint guarantees that no files are committed that do not adhere to project requirements.
Jest is a test framework that includes ts-jest for TypeScript.
Nodemon is used to reload the programme when it is modified.
Docker is used for local development, and it includes a Dockerfile that creates a minimal image with gcr.io/distroless/nodejs.
If you're interested in learning more, check out the source code at https://github.com/shivamsingh478/nodejs-typescript-express-boilerplate.
Thanks for reading, and I hope you enjoy :)
Top comments (0)