This repository is intended to serve as a starting point if you want to bootstrap a quick API project in TypeScript.
- No proper DI framework/container/tool
- No Clean Architecture structuring (I strongly suggest a DDD approach)
- Coupling of infrastructure and application layers unless you separate them yourself
If these issues don't matter for your intended use, or you know how to fix them, this will be a fast way to have an API running. If you're looking for a more scalable strategy, check my TS DDD template (coming soon™) or if you're looking for a simple, plain Node.js app look at my TypeScript Node.js Template
- TypeScript (v5)
- Find other
tsconfig.json
options here
- Find other
- ts-node-dev
- Pure DI
- If you prefer using containers, check out tsyringe, typescript-ioc, TypeDI, NestJS, InversifyJS or Awilix
- If you prefer mocking dependencies (no DI) use proxyquire
- Prettier
- ESLint with:
- eslint-config-prettier to make Prettier and ESLint play nice together.
- eslint-plugin-import to allow for sorting the imports automatically.
- typescript-eslint for TS-specific rules
- Jest plugin for Jest-specific rules
- Jest (can be substituted with
tap
) - GitHub Action workflows set up to run tests and formatting+linting on push
Action | Command | Description |
---|---|---|
Install dependencies | npm i |
Installs the necessary dependencies |
Compile | npm run build |
Transpiles TS into JS |
Compile (Production) | npm run build:prod |
Transpiles TS into JS removing unnecessary artifacts |
Run | npm run start |
Runs the compiled JS |
Dev | npm run dev |
Runs the TypeScript code and watches for changes |
Debug | npm run dev:debug |
Same as Dev but also attaches the debugger |
Action | Command | Description |
---|---|---|
Test | npm run test |
Runs all the tests |
Action | Command | Description |
---|---|---|
Format | npm run format |
Ensures code follows style guides |
Action | Command | Description |
---|---|---|
Lint | npm run lint |
Runs the linter and points out mistakes |
Lint + Fix | npm run lint:fix |
Same as above but fixing auto-fixable problems |