A CLI tool to quickly create Express TypeScript applications by pulling from the official template repository and customizing it for your needs.
- 🚀 Quick project setup with interactive prompts
- 📁 Well-organized project structure
- 🔧 Pre-configured with essential middleware and utilities
- 📝 TypeScript support out of the box
- 🛡️ Built-in security features (rate limiting, XSS protection)
- 📊 Logging with Winston
- 🔄 Hot reload for development
- 🎯 Dependency injection container
- ⚡ Error handling middleware
npm install -g node-typescript-gennpx node-typescript-gen my-appnode-typescript-gen my-appThis will prompt you for:
- Project name (defaults to the provided name)
- Project description
- Author name
- Version number
- Whether to install dependencies automatically
You can specify a custom template repository URL:
node-typescript-gen my-app --template https://github.com/yourusername/your-template.gitIf you don't provide a project name, the CLI will guide you through all options:
node-typescript-genThe CLI pulls the latest template from the official express-typescript-template repository, removes unnecessary files (LICENSE, .env.example, etc.), and customizes it for your project.
The CLI creates a complete Express TypeScript application with the following structure:
my-app/
├── src/
│   ├── app.factory.ts      # Application factory
│   ├── config/            # Configuration files
│   │   ├── app.config.ts
│   │   └── database.config.ts
│   ├── container/         # Dependency injection container
│   │   └── di.container.ts
│   ├── lib/              # Utility libraries
│   │   ├── app-assert.ts
│   │   ├── async-handler.ts
│   │   ├── custom-error.ts
│   │   └── rate-limit.ts
│   ├── logger/           # Logging configuration
│   │   ├── logger.config.ts
│   │   └── logger.service.ts
│   ├── middleware/       # Express middleware
│   │   ├── error-handler.ts
│   │   ├── morgan-middleware.ts
│   │   └── service-protection.ts
│   ├── types/           # TypeScript type definitions
│   │   ├── database.types.ts
│   │   └── protection.types.ts
│   └── server.ts        # Server entry point
├── .env                 # Environment variables
├── package.json         # Project configuration
├── tsconfig.json        # TypeScript configuration
└── README.md           # Project documentation
- Express.js with TypeScript
- Dependency Injection container for better code organization
- Error Handling middleware with custom error classes
- Rate Limiting to protect your API
- Logging with Winston for production-ready logging
- CORS support for cross-origin requests
- XSS Protection middleware
- Environment Configuration with dotenv
- Hot Reload with tsc-watch
- TypeScript configuration optimized for Node.js
- Prettier for code formatting
- Module Aliases for clean imports
- Build Process with TypeScript compilation
- Production Server configuration
- Error Handling for production environments
- Security Middleware enabled by default
After creating your project:
cd my-app
npm install
npm run devYour server will start on http://localhost:3000
You can run a demo to see the generator in action:
npm run demoThis will create a sample project called demo-express-app to demonstrate the functionality.
- npm run dev- Start development server with hot reload
- npm run build- Build the project for production
- npm start- Start production server
- npm run format- Format code with Prettier
The generated project includes several configuration files:
- app.config.ts - Application configuration
- database.config.ts - Database configuration (ready for your database)
- logger.config.ts - Logging configuration
- .env - Environment variables
- Fork the repository
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add some amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.