UNPKG

typescript-express-starter

Version:
304 lines (230 loc) โ€ข 13.7 kB
<h1 align="center"> <br> <img src="https://github.com/ljlm0402/typescript-express-starter/raw/images/newLogo.png" alt="Project Logo" /> <br> <br> TypeScript Express Starter <br> </h1> <h4 align="center">๐Ÿš€ Express RESTful API Boilerplate Using TypeScript</h4> <p align ="center"> <a href="https://nodei.co/npm/typescript-express-starter" target="_blank"> <img src="https://nodei.co/npm/typescript-express-starter.png" alt="npm Info" /> </a> </p> <p align="center"> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/npm/v/typescript-express-starter.svg" alt="npm Version" /> </a> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/github/v/release/ljlm0402/typescript-express-starter" alt="npm Release Version" /> </a> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/npm/dm/typescript-express-starter.svg" alt="npm Downloads" /> </a> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/npm/l/typescript-express-starter.svg" alt="npm Package License" /> </a> </p> <p align="center"> <a href="https://github.com/ljlm0402/typescript-express-starter/stargazers" target="_blank"> <img src="https://img.shields.io/github/stars/ljlm0402/typescript-express-starter" alt="github Stars" /> </a> <a href="https://github.com/ljlm0402/typescript-express-starter/network/members" target="_blank"> <img src="https://img.shields.io/github/forks/ljlm0402/typescript-express-starter" alt="github Forks" /> </a> <a href="https://github.com/ljlm0402/typescript-express-starter/stargazers" target="_blank"> <img src="https://img.shields.io/github/contributors/ljlm0402/typescript-express-starter" alt="github Contributors" /> </a> <a href="https://github.com/ljlm0402/typescript-express-starter/issues" target="_blank"> <img src="https://img.shields.io/github/issues/ljlm0402/typescript-express-starter" alt="github Issues" /> </a> </p> <br /> - [๐Ÿ‡ฐ๐Ÿ‡ท Korean](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md) - [๐Ÿ‡บ๐Ÿ‡ธ English](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md) <br /> --- ## ๐Ÿ“ Introduction **TypeScript Express Starter** is an interactive CLI tool that generates production-ready TypeScript Express projects with your preferred stack configuration. Instead of starting from scratch, this CLI provides a comprehensive project generator with multiple database integrations, development tools, and deployment configurations. Choose from 10+ templates and customize your development workflow in minutes. - **Interactive Setup**: Choose database, ORM, linter, testing framework, and more - **Production Ready**: Docker, PM2, NGINX configurations included - **Developer Experience**: Hot reload, testing, linting, and formatting pre-configured - **Multiple Stacks**: Support for 10+ database/ORM combinations ## ๐Ÿ’Ž CLI Features - ๐ŸŽฏ **Interactive Setup** โ€” Smart CLI with guided project configuration - ๐Ÿš€ **Quick or Custom Mode** โ€” Start fast with presets or choose tools category by category - ๐Ÿ—„๏ธ **Multiple Database Options** โ€” Prisma, Sequelize, TypeORM, Mongoose, Knex, and more - ๐Ÿ› ๏ธ **Development Tools** โ€” Choose from ESLint, Biome, Jest, Vitest, Docker, PM2 - ๐Ÿ“ฑ **Template Selection** โ€” 10+ pre-configured project templates - โšก **Auto Configuration** โ€” Dependencies, scripts, and configs automatically setup - ๐Ÿ”ง **Smart Dependencies** โ€” Tool compatibility and requirement resolution - ๐Ÿ“ฆ **Package Manager Agnostic** โ€” Works with npm, pnpm, or yarn - ๐Ÿš€ **Zero Config Start** โ€” Generated projects work immediately - ๐ŸŽจ **Customizable** โ€” Add your own templates and development tools ## โšก๏ธ Quick Start ```bash # Install globally npm install -g typescript-express-starter # Run the interactive CLI typescript-express-starter โ”Œ ๐Ÿ“˜ TypeScript Express Starter โ”‚ โ—‡ Choose setup mode: โ”‚ โ— ๐Ÿš€ Quick start (recommended preset) (Automatically selects a sensible toolset) โ”‚ โ—‹ ๐Ÿ›  Custom (step-by-step) (Pick tools category by category) โ”‚ โ—‡ Which package manager do you want to use? โ”‚ โ— npm โ”‚ โ—‹ pnpm โ”‚ โ—‹ yarn โ”‚ โ—‡ Choose a template: โ”‚ โ— Express TypeScript (Basic Express + TypeScript starter ยท beginner ยท stable) โ”‚ โ—‹ Drizzle PostgreSQL (Modern SQL toolkit with type safety + full devtools ยท intermediate ยท stable) โ”‚ โ—‡ Enter your project name: โ”‚ your-project-name โ”‚ โ—‡ Choose quick profile: โ”‚ โ—‹ Minimal (Template only (no additional devtools)) โ”‚ โ— Recommended (Balanced default toolchain) โ”‚ โ—‹ Full (One tool from each category) โ”‚ โ—‡ Preset โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ Quick profile selected: recommended (biome, tsup, vitest, docker) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚ โ—‡ Configuration summary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ Setup mode : quick โ”‚ โ”‚ Package manager: pnpm โ”‚ โ”‚ Template : Express TypeScript โ”‚ โ”‚ Project name : your-project-name โ”‚ โ”‚ Devtools : Biome, tsup, Vitest, Docker โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚ โ—† Proceed with project generation? โ”‚ โ— Yes / โ—‹ No โ”‚ โœ” ๐Ÿ“ฆ Base dependencies installed! โ”‚ โ”” ๐ŸŽ‰ Project setup complete! # Navigate to your project cd your-project-name # Start development server npm run dev ``` **Generated Project Features:** - ๐ŸŒ Express server: `http://localhost:3000/` - ๐Ÿ”„ Hot reload with nodemon ## ๐Ÿ“‚ Generated Project Structure When you create a new project, the CLI generates this structure: ```bash your-project/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ config/ # Configuration files, environment settings โ”‚ โ”œโ”€โ”€ controllers/ # Request handling & response logic โ”‚ โ”œโ”€โ”€ dtos/ # Data Transfer Objects for request/response โ”‚ โ”œโ”€โ”€ entities/ # Database entities (if using ORM) โ”‚ โ”œโ”€โ”€ exceptions/ # Custom exception classes โ”‚ โ”œโ”€โ”€ interfaces/ # TypeScript interfaces and type definitions โ”‚ โ”œโ”€โ”€ middlewares/ # Middlewares (logging, auth, error handling) โ”‚ โ”œโ”€โ”€ repositories/ # Database access logic โ”‚ โ”œโ”€โ”€ routes/ # API route definitions โ”‚ โ”œโ”€โ”€ services/ # Business logic โ”‚ โ”œโ”€โ”€ utils/ # Utility/helper functions โ”‚ โ”œโ”€โ”€ app.ts # Express app initialization โ”‚ โ””โ”€โ”€ server.ts # Server entry point โ”œโ”€โ”€ .env # Environment variables file โ”œโ”€โ”€ .env.development.local # Development environment variables โ”œโ”€โ”€ .env.production.local # Production environment variables โ”œโ”€โ”€ .env.test.local # Test environment variables โ”œโ”€โ”€ nodemon.json # Nodemon configuration โ”œโ”€โ”€ package.json # Project dependencies and scripts โ””โ”€โ”€ tsconfig.json # TypeScript configuration ``` ## ๐Ÿ›  Development Tools Available Choose from these categories during project setup: | Category | Available Tools | Description | | ------------- | --------------------------- | ----------------------------------------------- | | **Linter** | `biome`, `eslint`, `oxlint` | Code formatting & linting (Biome is all-in-one) | | **Bundler** | `swc`, `tsup` | Fast TypeScript compilation and bundling | | **Testing** | `jest`, `vitest` | Unit & integration testing frameworks | | **Container** | `docker` | Docker & docker-compose configuration | ### To be added later (currently in progress): | Category | Available Tools | Description | | ------------- | --------------- | ------------------------------------ | | **Process** | `pm2` | Production process management | | **CI/CD** | `github` | GitHub Actions workflows | | **Git Hooks** | `husky` | Pre-commit hooks for quality control | | **API Docs** | `swagger` | OpenAPI/Swagger documentation | **Smart Selection**: The CLI automatically resolves tool dependencies and compatibility. ## ๐Ÿงฉ Available Templates Current template status with comprehensive compatibility tested: ### โœ… **Production Ready & Fully Tested** | Template | Description | Status | Compatibility | | -------------------- | --------------------------------------------------- | --------- | ------------- | | `default` | Express + TypeScript starter | โœ… Active | ๐ŸŽฏ Baseline | | `drizzle-postgresql` | Drizzle ORM + PostgreSQL (Type-safe, Zero overhead) | โœ… Active | ๐ŸŒŸ 100% (8/8) | ### ๐Ÿ”ง **Enhanced Development Tools Support** **drizzle-postgresql** template is fully compatible with: #### Linters - โœ… **Biome** - Modern unified tool (linter + formatter) - โœ… **ESLint + Prettier** - Traditional reliable combination - โœ… **Oxlint** - Rust-based high-performance linter (18ms!) #### Compilers - โœ… **tsup** - esbuild-based bundler (193ms build!) - โœ… **SWC** - Rust-based native performance compiler #### Test Runners - โœ… **Jest** - Mature test framework with full E2E support - โœ… **Vitest** - Modern Vite-based test runner > ๐ŸŽฏ **All 8 combinations tested and verified** - Choose your preferred development experience! ### ๐Ÿšง **Coming Soon** #### **ORM/Database Integration** | Template | Description | Priority | | --------------- | --------------------------------------------------- | ---------- | | `prisma` | Type-safe database client with auto-generated types | ๐Ÿ”ฅ Next | | `mongoose` | Elegant MongoDB ODM for Node.js | ๐Ÿ”ฅ Next | | `typeorm` | Decorator-based Active Record ORM | ๐Ÿšง Planned | | `sequelize` | Mature Promise-based SQL ORM | ๐Ÿšง Planned | | `mikro-orm` | Data Mapper ORM pattern for TypeScript | ๐Ÿšง Planned | | `typegoose` | TypeScript-friendly Mongoose alternative | ๐Ÿšง Planned | | `node-postgres` | High-performance PostgreSQL native driver | ๐Ÿšง Planned | | `knex` | Flexible SQL query builder & migrations | ๐Ÿšง Planned | #### **Architecture/Controller Style** | Template | Description | Priority | | --------- | ------------------------------------- | ------------ | | `graphql` | GraphQL API schema with Apollo Server | ๐Ÿšง Knowledge | ## ๐Ÿค” Why Use This CLI? ### vs. Manual Setup | Aspect | Manual Setup | TypeScript Express Starter CLI | | ------------------ | ------------------------------- | ------------------------------------- | | **Time** | ๐Ÿ”ด Hours of configuration | โœ… 2-3 minutes interactive setup | | **Configuration** | ๐Ÿ”ด Manual dependency management | โœ… Auto-resolved, compatible versions | | **Best Practices** | ๐Ÿ”ด Research required | โœ… Pre-configured industry standards | | **Consistency** | ๐Ÿ”ด Varies by developer | โœ… Standardized project structure | | **Updates** | ๐Ÿ”ด Manual maintenance | โœ… CLI updates bring new features | ### vs. Other Generators | Feature | TypeScript Express Starter | Other Generators | | -------------------- | -------------------------- | ---------------- | | **Database Choice** | โœ… 10+ options planned | Limited options | | **Tool Selection** | โœ… Mix & match dev tools | Fixed stack | | **TypeScript First** | โœ… Built for TypeScript | Often JS-first | | **Production Ready** | โœ… Docker, PM2 included | Basic setup | ## โญ๏ธ Stargazers [![Stargazers repo roster for @ljlm0402/typescript-express-starter](https://reporoster.com/stars/ljlm0402/typescript-express-starter)](https://github.com/ljlm0402/typescript-express-starter/stargazers) ## ๐Ÿด Forkers [![Forkers repo roster for @ljlm0402/typescript-express-starter](https://reporoster.com/forks/ljlm0402/typescript-express-starter)](https://github.com/ljlm0402/typescript-express-starter/network/members) ## ๐Ÿค Contributors [![Contributors repo roster for @ljlm0402/typescript-express-starter](https://contributors-img.web.app/image?repo=ljlm0402/typescript-express-starter)](https://github.com/ljlm0402/typescript-express-starter/graphs/contributors) ## ๐Ÿ’ณ License [MIT](LICENSE) --- <p align="center"> Made with โค๏ธ by <a href="https://github.com/ljlm0402">AGUMON</a> ๐Ÿฆ– </p>