This template is based on my personal experience with Node.js and TypeScript. It provides a simple but complete setup for a general purpose TypeScript app.
- TypeScript
- Jest for unit testing
- Prettier for code formatting
- ESLint for code linting
- Nodemon for hot reloading
This template also includes the dotenv
package. Just create a .env
file in the root of your project and add your environment variables, they will be automatically loaded when running npm run dev
. NOTE: dotenv
is installed as a dev dependency, as it is not recommended to use it in production
npm start
: Starts the applicationnpm run dev
: StartsNodemon
withts-node
npm run build
: Builds the project for productionnpm test
: Runs the unit tests withJest
npm run lint
: RunsESLint
for code lintingnpm run lint:fix
: RunsESLint
for code linting and automatically fixes the issuesnpm run format
: RunsPrettier
for code formatting
First of all, you need to clone this repository.
# Make sure to replace <project-name> with the name of the target folder
# With git
git clone https://github.com/ilCollez/typescript-template.git <project-name>
# With gh (Github CLI)
gh repo clone ilCollez/typescript-template <project-name>
Then, install the dependencies witn npm install
You are ready to start coding! Run npm run dev
and edit the src/main.ts
file :)