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 or if you're looking for a simple, plain Node.js app look at my TypeScript Node.js Template
- Pure DI. If you prefer using containers, check out:
- tsyringe
- typescript-ioc
- TypeDI
- NestJS
- InversifyJS
- Awilix
- If you prefer mocking dependencies (no DI) use proxyquire
- TypeScript
- pnpm for package management
- Biome for formatting and linting.
- Node Test Runner for testing.
- Accompanied by Supertest to test API calls.
- GitHub Action workflows set up to run tests and formatting+linting on push
Action | Command | Description |
---|---|---|
Install dependencies | pnpm i |
Installs the necessary dependencies |
Compile | pnpm build |
Transpiles TS into JS |
Run | pnpm start |
Runs the compiled JS |
Dev | pnpm dev |
Runs the TypeScript code and watches for changes |
Debug | pnpm dev:debug |
Same as Dev but also attaches the debugger |
Action | Command | Description |
---|---|---|
Test | pnpm test |
Runs all the tests |
Test | pnpm test:debug |
Runs all the tests with the debugger attached |
Action | Command | Description |
---|---|---|
Lint | pnpm lint |
Runs the linter and points out mistakes |
Format | pnpm format |
Ensures code follows style guides |