# nodejs-app-template

> Node.js app template

Latest version **1.7.6** (published 2024-10-07) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install nodejs-app-template
pnpm add nodejs-app-template
yarn add nodejs-app-template
bun add nodejs-app-template
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.7.6 |
| Published | 2024-10-07 |
| First published | 2023-04-05 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rafał Majewski |
| Maintainers | rafal-majewski |

## Links

- npm: https://www.npmjs.com/package/nodejs-app-template
- Repository: https://github.com/Rafal-Majewski/nodejs-app-template
- Homepage: https://github.com/Rafal-Majewski/nodejs-app-template#readme
- Issues: https://github.com/Rafal-Majewski/nodejs-app-template/issues
- npm.io page: https://npm.io/package/nodejs-app-template

## Dependencies (1)

- [envalid](https://npm.io/package/envalid.md) 8.0.0

## Recent versions

- 1.7.6 (latest) — 2024-10-07
- 1.7.5 — 2024-09-30
- 1.7.4 — 2024-09-30
- 1.7.2 — 2024-09-02
- 1.7.1 — 2023-04-20
- 1.7.0 — 2023-04-15
- 1.6.1 — 2023-04-15
- 1.6.0 — 2023-04-15
- 1.5.4 — 2023-04-05
- 1.5.3 — 2023-04-05

## README

# nodejs-app-template

This is a template for a Node.js TypeScript app.

The following tools and conventions have been configured:

- "[Conventional Commits](https://www.conventionalcommits.org/)" for commit messages;
- "[Dev Containers](https://containers.dev/)" for development Docker containers;
- "[Docker](https://www.docker.com/)" for containerization;
- "[ESLint](https://www.npmjs.com/package/eslint)" for linting;
  - "[eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)" for linting import/export;
  - "[eslint-plugin-sort-destructure-keys"](https://www.npmjs.com/package/eslint-plugin-sort-destructure-keys)" for sorting destructuring keys;
  - "[eslint-plugin-svelte](https://www.npmjs.com/package/eslint-plugin-svelte)" for linting Svelte;
  - "[typescript-eslint](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)" for linting TypeScript;
- "[GitHub Actions](https://docs.github.com/en/actions)" for CI/CD;
- "[Hadolint](https://github.com/hadolint/hadolint)" for linting Dockerfiles;
- "[npm](https://www.npmjs.com/)" for package management and Node.js scripts;
- "[Prettier](https://www.npmjs.com/package/prettier)" for code formatting;
  - "[prettier-plugin-svelte](https://www.npmjs.com/package/prettier-plugin-svelte)" for formatting Svelte;
- "[release-it](https://www.npmjs.com/package/release-it)" for releasing;
  - "[@release-it/conventional-changelog](https://www.npmjs.com/package/@release-it/conventional-changelog)" for generating changelogs automatically;
- "[Testcontainers](https://www.npmjs.com/package/testcontainers)" for testing with Docker containers;
- "[tsx](https://www.npmjs.com/package/tsx)" for running TypeScript code;
- "[TypeScript](https://www.npmjs.com/package/typescript)" for TypeScript support;

## Usage

### Install dependencies

```bash
npm ci
```

### Edit the code

You can edit the code in the "`src`" directory.
The entry point of the application is "`src/main.ts`".

### Run the application in development mode

```bash
npm run dev
```

Note: The project uses "[tsx](https://www.npmjs.com/package/tsx)" to run TypeScript code on the fly.

### Compile the application

```bash
npm run compile
```

This will create a "`dist`" directory with the compiled code.

Note: The "`dist`" directory will mimic the main directory structure. All directories with TypeScript files will be recreated in the "`dist`" directory. In the default configuration those are "`src`" and "`test`".

### Run the compiled application

```bash
node ./dist/main.js
```

Note: This will command will fail if the application has not been compiled (no "`dist`" directory)!

### Test the application

Native [Node.js](https://nodejs.org/) test runner is used to run the tests.
Native "node:assert" and "node:test" modules are used to write the tests.

Source code-related tests are kept alongside the source code they test in the "`src`" directory. Other tests and test utilities are kept in the "`test`" directory.

To run the unit tests:

```bash
npm run test
```

The coverage report can be generated in the "lcov" format by running:

```bash
npm run test:experimental-coverage
```

After running the command, the coverage report will be available in the "`lcov.info`" file.

Note that the coverage report is experimental as it only works on compiled code.

### Run the linter

"[ESLint](https://www.npmjs.com/package/eslint)" is used to lint the code.

```bash
npm run eslint:check
```

Note: The linter will return a non-zero exit code if there are any linting errors or warnings.

You can also try to automatically fix some of the errors and warnings by running:

```bash
npm run eslint:fix
```

### Run the formatter

"[Prettier](https://www.npmjs.com/package/prettier)" is used to format the code.

```bash
npm run prettier:check
```

Formatting errors can be automatically fixed by running:

```bash
npm run prettier:fix
```

### Commit the changes

"[Conventional Commits](https://www.conventionalcommits.org/)" are used to format the commit messages.

The following types are supported:

- "`feat`": A new feature;
- "`fix`": A bug fix;
- "`chore`": Other changes;

Use `{type}!: {description}` as the commit message for breaking changes.

Thanks to the "[@release-it/conventional-changelog](https://www.npmjs.com/package/@release-it/conventional-changelog)" plugin for "[release-it](https://www.npmjs.com/package/release-it)", the changelog will be automatically generated when releasing. Also, the version number will be automatically incremented based on the commit messages.

## GitHub Actions

### Continuous integration

There is one CI pipeline configured in the "`.github/workflows`" directory:

- "[Continuous integration](.github/workflows/continuous_integration.yaml)": This pipeline will check the integrity of the code by running formatting, linting, and testing.

### Continuous delivery

There is one CD pipeline configured in the "`.github/workflows`" directory:

- "[Release](.github/workflows/release.yaml)": This pipeline will create a GitHub release, build a Docker image, and push it to a Docker registry and also push the compiled code to npm.

---
_Source: https://npm.io/package/nodejs-app-template · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
