npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

create-express-api-cli-with-docker

v1.0.1

Published

Scaffold a full-featured Express API with one command (TypeScript or JavaScript)

Downloads

16

Readme

🚀 create-express-api-cli

A powerful, plug-and-play CLI tool to scaffold a modern Express.js API with everything you need — from database setup to authentication, TypeORM, logging, environment configs, Docker, and even PM2 + Jenkins deployment.


✨ Features

✅ Choose between TypeScript and JavaScript
✅ Clean, scalable folder structure
✅ Database integration via TypeORM
✅ Built-in JWT authentication and password hashing
✅ Environment-based configs using .env
✅ Centralized error handling
✅ Winston logging + HTTP request logs
✅ Docker-ready (Dockerfile, docker-compose.yml)
✅ Optional Jenkinsfile for PM2-based deployment
✅ Multi-package manager support: pnpm, npm, or yarn
✅ Pre-configured with nodemon (JS) or ts-node (TS)
✅ Easily extensible and production-ready


📦 Requirements

  • Node.js >= 18
  • One of: pnpm, npm, or yarn
  • (Optional) Docker + PostgreSQL
  • (Optional) Jenkins + PM2 (for deployment)

🚀 Quick Start

Using pnpm

pnpm dlx create-express-api-cli my-api --ts

Using npm

npx create-express-api-cli my-api --ts

Using yarn

yarn create express-api-cli my-api --ts

To use JavaScript instead of TypeScript:

npx create-express-api-cli my-api --js

To include Docker and Jenkins support:

npx create-express-api-cli my-api --ts --docker

🔧 CLI Options

| Option | Description | Default | | ---------- | ------------------------------ | ------- | | --ts | Scaffold a TypeScript API | false | | --js | Scaffold a JavaScript API | false | | --docker | Include Docker + Jenkins setup | false |


🗂 Project Structure

my-api/
├── src/
│   ├── config/           # Database configs (TypeORM)
│   ├── controllers/      # Route handlers (login/register)
│   ├── services/         # Business logic (AuthService)
│   ├── middlewares/      # Error + auth middleware
│   ├── routes/           # Express routers
│   ├── utils/            # Logger, helpers
│   ├── entities/         # TypeORM entity definitions
│   └── index.(ts|js)     # App entry point
├── .env
├── ormconfig.(ts|js)
├── package.json
├── docker-compose.yml   # (if --docker)
├── Dockerfile           # (if --docker)
├── Jenkinsfile          # (if --docker)
├── README.md

📥 Environment Variables

Create a .env file in the root directory:

PORT=5000
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=password
DB_NAME=mydb
JWT_SECRET=supersecret

🧪 Scripts

For both TypeScript and JavaScript projects:

# Run in development mode
pnpm dev

# Build (TypeScript only)
pnpm build

# Start built app (TS) or direct (JS)
pnpm start

# Format code
pnpm format

# Lint code
pnpm lint

✅ Works the same with npm run or yarn.


🐳 Docker & Compose (Optional)

If you used --docker, your app comes with:

  • Dockerfile to build your API
  • docker-compose.yml to run with PostgreSQL
  • Jenkinsfile for pipeline deployment via PM2

Run with Docker locally:

docker-compose up --build

⚙️ Jenkins + PM2 Deployment

When you use --docker, a Jenkinsfile is included with:

pm2 delete my-api || true
pm2 start dist/index.js --name my-api
pm2 save

Prerequisites:

  • Jenkins installed on deployment server
  • PM2 installed globally (npm install -g pm2)
  • Your .env variables set in Jenkins or on server

📚 Roadmap

  • [x] TypeScript & JavaScript support
  • [x] Docker + PostgreSQL + Jenkinsfile
  • [x] pnpm/yarn/npm auto detection
  • [ ] MongoDB (Mongoose) setup
  • [ ] Swagger auto-docs
  • [ ] CLI prompt (if no flags)
  • [ ] Frontend pairing (Next.js, React)
  • [ ] Role-based auth scaffolds
  • [ ] Swagger GUI + Postman collection auto-export

🤝 Contributing

PRs are welcome!

git clone https://github.com/kamau-n/create-express-api-cli.git
cd create-express-api-cli
pnpm install

pnpm link

# Then test CLI locally
create-express-api-cli test-app --ts --docker

🪪 License

MIT © 2025 [Kamau Harrison]