A clean and simple TypeScript project template with essential development tools and best practices.
- 🚀 TypeScript - Type safety with CommonJS modules
- 📦 ESLint - Code linting with TypeScript support and Prettier integration
- 🎨 Prettier - Code formatting with ESLint integration
- 🐶 Husky - Modern git hooks for code quality
- 🧪 Jest - Testing framework with TypeScript support
- 📝 Commitlint - Enforces conventional commit message format
- ⚡ tsx - Fast TypeScript execution for development
- 🔧 @tsconfig/node22 - Optimized TypeScript configuration for Node.js 22
# Clone the repository
git clone <your-repo-url>
cd your-project
# Install dependencies
npm install
# Start development
npm run devnpm run dev- Start development server with tsxnpm run build- Build TypeScript to JavaScriptnpm run start- Run compiled JavaScriptnpm run test- Run Jest testsnpm run test:watch- Run tests in watch modenpm run test:coverage- Run tests with coverage reportnpm run lint- Check code for linting issuesnpm run lint:fix- Fix linting issues automaticallynpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run type-check- Check TypeScript types without building
├── src/ # Source code
│ └── index.ts # Main entry point with demo functions
├── tests/ # Test files
│ └── index.test.ts # Jest tests for main functions
├── .husky/ # Git hooks
│ ├── pre-commit # Runs lint-staged before commits
│ └── commit-msg # Validates commit message format
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
├── .npmrc # npm configuration
├── .nvmrc # Node.js version specification
├── .prettierignore # Prettier ignore rules
├── .prettierrc # Prettier formatting configuration
├── commitlint.config.js # Commitlint configuration for conventional commits
├── eslint.config.js # ESLint configuration with Prettier
├── jest.config.js # Jest testing configuration
├── tsconfig.json # TypeScript configuration
├── package.json # Project dependencies and scripts (includes lint-staged config)
├── package-lock.json # Locked dependency versions
├── CONTRIBUTING.md # Contribution guidelines
└── README.md # Project documentation
Note: Additional directories created during development:
dist/- Build output (created afternpm run build)node_modules/- Dependencies (created afternpm install)
- CommonJS modules - Uses standard
require/module.exportsfor simplicity - TypeScript strict mode - Full type checking enabled
- ESLint flat config - Modern ESLint 9+ configuration format
- TypeScript-first linting - Only lints
.tsfiles insrc/andtests/ - Conventional commits - Enforced commit message format (feat:, fix:, docs:, etc.)
- Pre-commit hooks - Automatic linting, formatting, and commit validation
- Testing - Write tests for new features in the
tests/directory - Type safety - Use TypeScript types throughout
All commit messages must follow the conventional commit format:
feat: add new feature- New featuresfix: resolve bug- Bug fixesdocs: update documentation- Documentation changesstyle: format code- Code style changes (formatting, etc.)refactor: restructure code- Code refactoringtest: add tests- Adding or updating testschore: update dependencies- Maintenance tasks
- Extends
@tsconfig/node22with CommonJS overrides - Module resolution set to
nodefor CommonJS compatibility - Outputs to
dist/directory preserving source structure - Strict type checking enabled
- Source maps and declarations generated
- ESLint flat config format (required for ESLint 9+)
- TypeScript parser with project awareness
- Prettier integration via
prettier/prettierrule - Focuses only on
src/**/*.tsandtests/**/*.tsfiles - Ignores build output and configuration files
- TypeScript support with
ts-jest - CommonJS module format
- Tests located in
tests/directory - Coverage collection from
src/only
- Enforces conventional commit message format
- Pre-configured with 7 standard types (feat, fix, docs, style, refactor, test, chore)
- Validates message length and format
- Blocks commits with invalid message format
- Modern setup with
npx husky init - Pre-commit hook runs
lint-staged - Commit-msg hook validates commit message format
- Lint-staged configuration embedded in
package.json
The template includes sample mathematical and utility functions with comprehensive tests:
# Run the demo
npm run dev
# Run tests
npm test
# Build and run
npm run build
npm start
# Commit with proper format (required)
git add .
git commit -m "feat: add new mathematical functions"- Node.js 22.0.0 or higher
- npm 10.0.0 or higher