https://github.com/janik6n/typescript-starter
Batteries included TypeScript starter for 2025
https://github.com/janik6n/typescript-starter
docker esbuild eslint github-actions nodejs prettier starter typescript vitest vscode
Last synced: 4 months ago
JSON representation
Batteries included TypeScript starter for 2025
- Host: GitHub
- URL: https://github.com/janik6n/typescript-starter
- Owner: janik6n
- License: mit
- Created: 2023-12-09T15:31:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-09-20T11:29:05.000Z (9 months ago)
- Last Synced: 2025-09-20T13:14:50.792Z (9 months ago)
- Topics: docker, esbuild, eslint, github-actions, nodejs, prettier, starter, typescript, vitest, vscode
- Language: TypeScript
- Homepage:
- Size: 139 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README









[](https://github.com/janik6n/typescript-starter/actions)
# TypeScript Starter π
This is my batteries included TypeScript starter updated for 2026, with:
- π© [Node.js](https://nodejs.org/) 24 (LTS)
- βοΈ [TypeScript](https://www.typescriptlang.org/) 5.9
- π ECMAScript Modules
- βοΈ NPM package manager
- βοΈ code linting & formatting with [ESLint](https://eslint.org/) & [Prettier](https://prettier.io/)
- π₯ testing with [Vitest](https://vitest.dev/)
- π¬ [VS Code](https://code.visualstudio.com/) configuration for debugging and testing
- π₯ hot reloading
- π¦ production bundling with [esbuild](https://esbuild.github.io/)
- π³ production ready [Docker](https://www.docker.com/) image build
- π GitHub Actions workflow to run code quality checks and tests
This starter is more geared towards backend than frontend use.
## β
Prerequisites
- Make sure you have Node.js 24 installed. This is built, configured and tested with `Node.js 24`.
- If you want to use VS Code, make sure the following extensions are installed and configured:
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- [Vitest](https://marketplace.visualstudio.com/items?itemName=vitest.explorer)
## π Getting started
How to use this template?
1. Make sure prerequisites are met.
2. Download the repository as zip so you don't have to deal with git history of this repository.
3. Delete `package-lock.json`.
3. Replace `janik6n` in `package.json` with your own username, along with other info.
3. Install dependencies by running `npm install` on the project root directory.
4. Start developing. See below for available scripts.
## Available scripts
Following scripts have been configured, and they should give ideas for further development.
### βοΈ Run development server
To run TypeScript to JavaScript transpiling and to run transpiled `./dist/index.mjs` run `npm run dev`. Watch mode (a.k.a. *hot reloading* π₯) is available with `npm run dev:watch`. Development serving is handled with [tsx](https://tsx.is/).
### π₯ Run tests
Test are run with [Vitest](https://vitest.dev/), and different test scenarios are handled with [Test Projects](https://vitest.dev/guide/projects).
To run tests, you have a several of options:
- Run all tests with `npm run test`.
- Include coverage report with `npm run test:cov`.
- Run unit tests with `npm run test:unit`. This runs all tests which are in files with name `*.unit.test.ts`.
- Run integration tests with `npm run test:integration`. This runs all tests which are in files with name `*.integration.test.ts`.
- Run end-to-end (e2e) tests with `npm run test:e2e`. This runs all tests which are in files with name `*.e2e.test.ts`.
- Run unit and integration tests in watch mode with `npm run test:watch` in separate terminal session than your development server.
- Run unit and integration tests in CI environment with `npm run test:ci`. Note: this script exists so it's easy to configure which tests are run in CI.
### βοΈ Lint source code
Lint a.k.a. check the formatting of the source code with `npm run lint`.
The idea is to run [ESLint](https://eslint.org/) & [Prettier](https://prettier.io/) on VS Code as you code, so this script is mostly for code quality checks in CI. Prettier is run as ESLint plugin.
### π οΈ Format source code
Format the source code with [Prettier](https://prettier.io/) by running `npm run format`.
### π¦ Build production bundle
Build the production bundle with [esbuild](https://esbuild.github.io/) by running `npm run build`. Build is configured in `build.js`.
Build command explained: `"build": "rimraf ./dist && npx tsc --noEmit && node build.js"`:
- `rimraf ./dist`: delete ./dist folder
- `npx tsc --noEmit`: run type checks
- `node build.js`: build and bundle with esbuild, which does not do type checking, but it creates nice small bundles
Sometimes it's necessary to see the built app with just transpiling without bundling. This can be accomplished with `npm run build:tsc`.
### π Run production bundle
Run the built app with `npm run start`.
### π³ Check container build for issues
Run `npm run check:container` to check Docker build for issues, without actually building the image. `Dockerfile` is configured so that failing checks will exit with error status. See [Build checks | Docker Docs](https://docs.docker.com/build/checks/) for more info.
### π³ Build as container
Run `npm run build:container` to build the app as Docker container. Multi-stage build is used to minimize the production image size. Debian-based image is used to minimize the risk of compatibility issues.
### π³ Run as container
Run the containerized app with `npm run start:container`.
## π¬ Available VS Code configurations
There are two debugger launch configurations included:
- `Debug Current File` is meant to debug the currently active TypeScript file.
- `Debug Current Test File` is same, but for test files.
## π Known issues
None as of now. π¦
## βοΈ Whatβs not inside
Here are some things that *could be included* in a starter, but are not in this one:
- Monorepo setup
- Any particular appβs source code
- Git pre-commit hooks
## π Further reading
### TypeScript
- https://www.typescriptlang.org/
### ESLint & Prettier
- https://eslint.org/
- https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
- https://prettier.io/
- https://github.com/prettier/eslint-plugin-prettier
- https://typescript-eslint.io/
### Vitest
- https://vitest.dev/
- https://vitest.dev/guide/projects
### VS Code TS debugging & Vitest
- https://code.visualstudio.com/docs/typescript/typescript-debugging
- https://code.visualstudio.com/docs/editor/testing
- https://code.visualstudio.com/docs/editor/debugging#_launch-configurations
- https://marketplace.visualstudio.com/items?itemName=vitest.explorer
- https://vitest.dev/guide/debugging
### Tsx
- https://tsx.is/
### Esbuild
- https://esbuild.github.io/
### Docker & Node.js
- https://hub.docker.com/_/node
- https://snyk.io/blog/choosing-the-best-node-js-docker-image/
- https://docs.docker.com/build/checks/
### GitHub
- https://github.com/features/actions
## π Changelog
[CHANGELOG](CHANGELOG.md)
## βοΈ License
MIT [License](LICENSE). Copyright janik6n.