typescript-project-generator
v7.0.0
Published
A TypeScript initial configuration for web projects
Downloads
38
Maintainers
Readme
TypeScript Project Generator
A modern CLI tool that creates production-ready TypeScript projects with opinionated but flexible configuration. Generate complete project boilerplates with modern tooling and best practices in seconds.
⚡ Quick Start
# Install globally
npm i -g typescript-project-generator
# Generate a new project
tpgWhat's New in v7.0.0
- Test Framework Choice: Interactive selection between Jest and Vitest
- Modern Standards: ES2022 target with strict TypeScript configuration
- Enhanced Validation: Strict project name validation (lowercase, numbers, hyphens)
- Node.js v18+: Required for optimal performance and modern features
- Biome Integration: Ultra-fast linting and formatting out of the box
Generated Project Features
Core Development Tools
- TypeScript: ES2022 target with strict configuration
- Test Framework: Choose between Jest or Vitest during setup
- Biome: Modern linter and formatter (replaces ESLint + Prettier)
- Docker: Production-ready Dockerfile with dynamic Node.js version
- GitHub Actions: Complete CI/CD workflows
Project Structure
Your generated project includes all essential files:
.env- Environment variables templatebiome.json- Modern linter and formatter configuration.biomeignore- Files to exclude from Biome processing.gitignore- Git ignore patternsCHANGELOG.md- Project changelog templateDockerfile- Production-ready container configurationjest.config.tsorvitest.config.mts- Test framework configurationLICENSE- Your chosen license filepackage.json- Project dependencies and scriptsREADME.md- Comprehensive project documentationtsconfig.base.json- Base TypeScript configurationtsconfig.json- Main TypeScript configurationsrc/index.ts- Main application entry pointtest/index.test.ts- Initial test file.github/workflows/- Complete CI/CD pipeline
Interactive Setup Process
The generator guides you through a comprehensive setup with the following prompts:
Project Information
- Project name - Validates lowercase, numbers, and hyphens only
- Description - Brief project description
- Keywords - Tags for package.json discoverability
- Author name - Your name for package.json and LICENSE
- GitHub username - For repository URLs and package.json
Technical Configuration
- License type - Choose from popular licenses (MIT, Apache-2.0, GPL-3.0, etc.)
- Package manager - npm, yarn, or pnpm support
- Test framework - NEW! Choose between Jest or Vitest
- Default port - For server applications (optional)
- GitHub repository - Repository name for CI/CD integration
- Heroku deployment - Optional CD workflow for Heroku
Test Framework Choice
Jest (Traditional)
- Mature and stable testing framework
- Extensive ecosystem and community support
- Zero-config setup for most TypeScript projects
- Built-in code coverage and mocking
Vitest (Modern)
- Ultra-fast test execution with native ES modules
- Vite-powered with instant HMR during testing
- TypeScript-first design and configuration
- Modern API with Jest-compatible assertions
Generated Project Structure
After completing setup, your project will have this structure:
📂.github
┣ 📂workflows
┣ 📜lint.yml
┗ 📜test.yml
📂src
┗ 📜index.ts
📂test
┗ 📜index.test.ts
📜.biomeignore
📜.dockerignore
📜.env
📜.gitignore
📜biome.json
📜CHANGELOG.md
📜Dockerfile
📜jest.config.ts OR vitest.config.mts
📜LICENSE
📜package.json
📜README.md
📜tsconfig.base.json
📜tsconfig.json
📜pnpm-lock.yaml (or package-lock.json or yarn.lock)After generation, git will be initialized and dependencies will be installed based on your chosen package manager.
Prerequisites
- Node.js v18 or higher - Required for optimal performance and modern features
- Internet connection - For installing packages and fetching license content
- Git - For repository initialization
Installation
This tool is designed to be installed globally to create new projects anywhere on your system.
npm i -g typescript-project-generatorUsage
Run the generator from any directory where you want to create your new project:
tpgThe interactive CLI will guide you through the complete setup process with modern validation and helpful prompts.
Generated Dependencies
Core Dependencies (Always Included)
@biomejs/biome- Modern linter and formatter@types/node- Node.js type definitionsdotenv- Environment variable managementnodemon- Development file watcherts-node- TypeScript execution for Node.jstsconfig-paths- Path mapping supporttypescript- TypeScript compiler
Test Framework Dependencies
When choosing Jest:
When choosing Vitest:
🔄 Migration from Older Versions
If you're upgrading from a previous version of TPG:
- ESLint → Biome: Projects now use Biome for faster linting and formatting
- Jest vs Vitest: New projects can choose their preferred test framework
- ES2022: Updated TypeScript target for modern JavaScript features
- Node.js v18+: Minimum version requirement for security and performance
Contributing
Hey, this project use to contain a backend generator!
Yes, it used to. But that approach has been deprecated in favor of my new backend framework, Simba.js.
Author
- Anthony Luzquiños - Initial Work - Documentation - AnthonyLzq.
Contributors
- Andree Anchi - Bug reports - andreewaD.
