Skip to content

Repository files navigation

template-node

build template mise license

A sane, opinionated template for esm node projects written in typescript that doesn't rely on transpilation - typescript is executed directly by node.

Note

This template uses arch-devcontainer to provide a consistent development environment with Arch Linux and mise preconfigured.

You can use the template directly with a devcontainer-compatible editor such as VS Code, or start it from the command line with ./.devcontainer/start.sh.

Uses, among other tools/packages:

  • bun as package manager for node dependencies
  • biome for code linting and formatting
  • lefthook for git hooks
  • cocogitto for commit message linting
  • vitest for testing

requirements and dependencies

You need Docker and a devcontainer-compatible editor or the Dev Container CLI to get started.

The development environment is provided by arch-devcontainer, which includes mise, which will be managing most of the tooling in this template.

Once the devcontainer is running, you can install the Node dependencies with bun install.

Note

Git hooks are in place to make sure both the tooling managed by mise and the project dependencies are synced with each checkout and merge.

subpath imports

Subpath imports (#/) are used instead of relative paths, mapped via the imports field in package.json (allowing native Node resolution at runtime without extra build tools) and mirrored in tsconfig.json for IDE support.

Example:

import { add } from "#/lib/math"; // this points to ./src/lib/math.ts

running

mise dev

Runs the project in watch mode.

mise test

Runs tests.

mise lint-fix

Runs biome in fix mode to lint and format the project.

mise typecheck

Runs type checking using tsc.

ci

This repository uses GitHub Actions for CI. The workflow is defined in .github/workflows/checks.yml.

It automates:

  • Linting & Formatting: Running Biome.
  • Type Checking: Running TypeScript type checking.
  • Testing: Running Vitest, halting the workflow at the first test failure.

vscode

You might want to install the recommended extensions in vscode. Search for @recommended in the extensions tab, they'll show up as "workspace recommendations".

If you have been using eslint and prettier and their extensions, you might want to disable eslint entirely and keep prettier as the formatter only for certain types of files.

This is done by the .vscode/settings.json file.

Debug configuration is also included for running the source directly with node.

license

MIT

About

A template for esm Node.js projects using typescript

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages