A modern, type-safe boilerplate for creating TypeScript/JavaScript libraries. This template provides a solid foundation for building high-quality, maintainable libraries with best practices and modern tooling.
- 🚀 TypeScript support out of the box
- 📦 Modern build system with esbuild
- ✅ Jest testing setup
- 📝 Documentation ready
- 🔍 ESLint and Prettier configuration
- 🎯 Type definitions generation
- 📦 NPM package publishing setup
- 🧪 Test coverage reporting
- 🔄 CI/CD ready
- Node.js (v14 or higher)
- bun, npm, yarn
- Clone this repository:
git clone https://github.com/yourusername/library-boilerplate.git
cd library-boilerplate- Install dependencies:
bun install
# or
npm install
# or
yarn installlibrary-boilerplate/
├── src/ # Source code
│ ├── main.ts # Main library code
│ ├── types.ts # Type definitions
│ └── main.test.ts # Tests
├── dist/ # Build output
├── .eslintrc.js # ESLint configuration
├── .prettierrc # Prettier configuration
├── jest.config.js # Jest configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project metadata and dependencies
npm run build
# or
yarn buildnpm test
# or
yarn testnpm run lint
# or
yarn lint- Modify
src/main.tswith your library's core functionality - Update
src/types.tswith your type definitions - Add tests in
src/main.test.ts - Update
package.jsonwith your library's information:- name
- version
- description
- author
- repository
- license
- Update the version in
package.json - Build your library:
npm run build- Publish to npm:
npm publish- Write comprehensive tests for all functionality
- Keep your dependencies up to date
- Document your API thoroughly
- Follow semantic versioning
- Maintain good test coverage
- Use TypeScript for better type safety
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
If you find this boilerplate helpful, please give it a star! For issues and feature requests, please use the GitHub issue tracker.