Skip to content

Latest commit

ย 

History

621 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


Project Logo

TypeScript Express Starter

๐Ÿš€ Express RESTful API Boilerplate Using TypeScript

npm Info

npm Version npm Release Version npm Downloads npm Package License

github Stars github Forks github Contributors github Issues




๐Ÿ“ Introduction

TypeScript Express Starter is an interactive CLI tool that generates TypeScript Express projects with your preferred stack configuration.

Start with a basic Express template, Drizzle + PostgreSQL, or decorator-based request validation with express-cargo. Select development tools to generate the dependencies, scripts, and configuration files for your workflow.

  • Interactive Setup: Choose database, ORM, linter, testing framework, and more
  • Docker Support: Development and production Dockerfiles when Docker is selected
  • Developer Experience: Hot reload plus configuration for your selected testing and linting tools
  • Template Choices: Basic Express, Drizzle + PostgreSQL, and express-cargo

๐Ÿ’Ž CLI Features

  • ๐ŸŽฏ Interactive Setup โ€” Smart CLI with guided project configuration

  • ๐Ÿš€ Quick or Custom Mode โ€” Start fast with presets or choose tools category by category

  • ๐Ÿ—„๏ธ PostgreSQL Integration โ€” Drizzle ORM template with database scripts

  • ๐Ÿ› ๏ธ Development Tools โ€” Choose from ESLint, Biome, Oxlint, SWC, tsup, Jest, Vitest, Docker

  • ๐Ÿ“ฑ Template Selection โ€” Three active templates with authentication and user management examples

  • โšก Auto Configuration โ€” Dependencies, scripts, and configs automatically setup

  • ๐Ÿ”ง Dependency Setup โ€” Collect selected tool dependencies and install them in one step

  • ๐Ÿ“ฆ Package Manager Agnostic โ€” Works with npm, pnpm, or yarn

  • ๐Ÿš€ Environment Setup โ€” Generate .env from .env.example with random authentication secrets

  • ๐ŸŽจ Customizable โ€” Add your own templates and development tools

โšก๏ธ Quick Start

Requirements: Node.js 22.12.0 or later and npm 9.11.0 or later. Install pnpm or Yarn separately if you select it in the CLI. Docker with Compose is required to use the Docker configuration.

You can also run the CLI without a global installation:

npx typescript-express-starter
# 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)
โ”‚  โ—‹ Express + express-cargo (Declarative validation & binding with decorators ยท 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 (eslint, tsup, vitest, docker)    โ”‚
โ”‚                                                                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ”‚
โ—‡  Configuration summary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                                        โ”‚
โ”‚  Setup mode     : quick                                                โ”‚
โ”‚  Package manager: npm                                                  โ”‚
โ”‚  Template       : Express TypeScript                                   โ”‚
โ”‚  Project name   : your-project-name                                    โ”‚
โ”‚  Devtools       : ESLint + Prettier, tsup, Vitest, Docker              โ”‚
โ”‚                                                                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ”‚
โ—†  Proceed with project generation?
โ”‚  โ— Yes / โ—‹ No
โ”‚
โœ” 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

Environment and startup

The CLI creates .env from .env.example and generates random values for SECRET_KEY and JWT_SECRET when those keys are present. Existing .env files are preserved. Secrets must be at least 32 characters and must not contain known placeholder values. Review the generated settings before deployment.

For Drizzle, configure DATABASE_URL, prepare PostgreSQL, and run npm run db:migrate before using the API. The default and express-cargo templates do not require a database. Use pnpm dev or yarn dev if you selected that package manager.

Authentication and user routes are mounted under /api/v1/auth and /api/v1/users; the root URL is not a landing page.

๐Ÿ“‚ Generated Project Structure

When you create a new project, the CLI generates this structure:

your-project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ config/           # Configuration files, environment settings
โ”‚   โ”œโ”€โ”€ controllers/      # Request handling & response logic
โ”‚   โ”œโ”€โ”€ dtos/             # Data Transfer Objects for request/response
โ”‚   โ”œโ”€โ”€ entities/         # Domain entities
โ”‚   โ”œโ”€โ”€ exceptions/       # Custom exception classes
โ”‚   โ”œโ”€โ”€ interfaces/       # TypeScript interfaces and type definitions
โ”‚   โ”œโ”€โ”€ middlewares/      # Middlewares (logging, auth, error handling)
โ”‚   โ”œโ”€โ”€ repositories/     # Data access (in-memory or database)
โ”‚   โ”œโ”€โ”€ routes/           # API route definitions
โ”‚   โ”œโ”€โ”€ services/         # Business logic
โ”‚   โ”œโ”€โ”€ utils/            # Utility/helper functions
โ”‚   โ”œโ”€โ”€ app.ts            # Express app initialization
โ”‚   โ””โ”€โ”€ server.ts         # Server entry point
โ”œโ”€โ”€ .env                  # Generated local environment settings
โ”œโ”€โ”€ .env.example          # Environment variable reference
โ”œโ”€โ”€ .gitignore            # Excludes secrets and generated files
โ”œโ”€โ”€ .project-meta.json    # Selected template, tools, and package manager
โ”œโ”€โ”€ nodemon.json           # Nodemon configuration
โ”œโ”€โ”€ package.json           # Project dependencies and scripts
โ””โ”€โ”€ tsconfig.json          # TypeScript configuration

Compiler, test, and Docker files are added according to the selected tools. Environment-specific .env.{NODE_ENV}.local files are optional and are not generated. CLI updates apply to newly generated projects; existing projects are maintained separately.

๐Ÿ›  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 Dockerfiles & 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: Recommended profiles use template-specific tool choices. The CLI copies the matching compiler and test configuration and reports missing required assets.

๐Ÿงฉ Available Templates

The following templates are available in the CLI and included in the npm package:

โœ… Active Templates

Template Description Storage
default Express + TypeScript with Zod request validation In-memory
drizzle-postgresql Drizzle ORM with PostgreSQL PostgreSQL
express-cargo Decorator-based DTO validation and request binding In-memory

The in-memory templates reset user data when the process restarts. See the express-cargo guide for DTO and binding examples.

๐Ÿ”ง Enhanced Development Tools Support

The active templates provide configuration for the following tools:

Linters

  • โœ… Biome - Modern unified tool (linter + formatter)
  • โœ… ESLint + Prettier - Traditional reliable combination
  • โœ… Oxlint - Rust-based high-performance linter

Compilers

  • โœ… tsup - esbuild-based bundler
  • โœ… SWC - Rust-based native performance compiler

Test Runners

  • โœ… Jest - Mature test framework with full E2E support
  • โœ… Vitest - Modern Vite-based test runner

๐ŸŽฏ Generation tests cover 36 combinations across the active templates, linters, compilers, test runners, and Docker. Runtime compatibility checks are available separately with npm run test:matrix.

๐Ÿšง Coming Soon

The entries below are not selectable in the CLI. Prisma and Mongoose implementations exist in the repository but are excluded from the npm package while verification is pending.

ORM/Database Integration

Template Description Priority
prisma-postgresql Type-safe database client with auto-generated types ๐Ÿ”ฅ Next
mongoose-mongodb 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 โœ… Guided 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 โœ… Updated templates for new projects

vs. Other Generators

Feature TypeScript Express Starter Other Generators
Database Choice โœ… PostgreSQL; more integrations planned Limited options
Tool Selection โœ… Mix & match dev tools Fixed stack
TypeScript First โœ… Built for TypeScript Often JS-first
Production Ready โœ… Optional Docker configuration Basic setup

โญ๏ธ Stargazers

Stargazers repo roster for @ljlm0402/typescript-express-starter

๐Ÿด Forkers

Forkers repo roster for @ljlm0402/typescript-express-starter

๐Ÿค Contributors

Contributors repo roster for @ljlm0402/typescript-express-starter

๐Ÿ’ณ License

MIT


Made with โค๏ธ by AGUMON ๐Ÿฆ–

Releases

Packages

Used by

Contributors

Languages