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-app-by-kk

v4.3.1

Published

A CLI tool to scaffold a production-ready Express.js + TypeScript application with your choice of database and optional Redis support.

Downloads

552

Readme

create-express-app-by-kk

A CLI tool to scaffold a production-ready Express.js + TypeScript application with your choice of database and optional Redis support.


🚀 What It Does

Runs an interactive prompt asking two questions, then generates a fully wired project:

  1. Which database? → PostgreSQL (Sequelize) or MongoDB (Mongoose)
  2. Configure Redis? → Yes / No

Every scaffold includes:

  • 📂 Module-based architecture (modules/Auth, modules/User)
  • ✨ TypeScript with pre-configured tsconfig.json
  • 🔐 JWT authentication + bcrypt password hashing
  • ✅ Express-validator for request validation
  • ⚙️ Pre-configured .env.local and .gitignore
  • 🗄️ Migrations wired to run automatically on npm run dev and npm start

📦 Installation

npm install -g create-express-app-by-kk

🛠️ Usage

npx create-express-app-by-kk <project-name>

You will be prompted:

◆ Which database do you want to use?
│  ● PostgreSQL  (with Sequelize ORM)
│  ○ MongoDB     (with Mongoose ODM)

◆ Do you want to configure Redis?
│  ○ Yes  ● No

📁 Generated Structure

PostgreSQL (Sequelize)

<project-name>/
├── index.ts                            # Express entry point + route mounting
├── package.json
├── tsconfig.json
├── .env.local                          # DB + JWT env vars template
├── .gitignore
├── config/
│   ├── config.js                       # sequelize-cli config (reads .env.local)
│   ├── database.ts                     # Sequelize instance + connection check
│   └── redis.ts                        # (only if Redis selected)
├── interfaces/
│   └── response.interface.ts
├── middlewares/
│   └── validate.ts                     # validateRequest, isAdmin, isDeveloper
├── migrations/
│   └── <timestamp>-create-user.cjs   # Sequelize migration for Users table
├── modules/
│   ├── Auth/
│   │   ├── auth.interface.ts
│   │   ├── auth.validator.ts
│   │   ├── auth.service.ts
│   │   ├── auth.controller.ts
│   │   └── auth.routes.ts
│   └── User/
│       ├── user.model.ts
│       ├── user.service.ts
│       ├── user.controller.ts
│       ├── user.validator.ts
│       └── user.routes.ts
└── utils/
    └── helpers.ts                      # SendResponse, HashPassword, JWT helpers

MongoDB (Mongoose)

<project-name>/
├── index.ts                            # Express entry point + route mounting
├── package.json
├── tsconfig.json
├── migrate-mongo-config.js             # migrate-mongo configuration (reads .env.local)
├── .env.local                          # DB + JWT env vars template
├── .gitignore
├── config/
│   ├── database.ts                     # Mongoose connect function
│   └── redis.ts                        # (only if Redis selected)
├── interfaces/
│   └── response.interface.ts
├── middlewares/
│   └── validate.ts                     # validateRequest, isAdmin, isDeveloper
├── migrations/
│   └── <timestamp>-create-user.js    # migrate-mongo migration for users collection
├── modules/
│   ├── Auth/
│   │   ├── auth.interface.ts
│   │   ├── auth.validator.ts
│   │   ├── auth.service.ts
│   │   ├── auth.controller.ts
│   │   └── auth.routes.ts
│   └── User/
│       ├── user.model.ts              # Mongoose Schema + IUser interface
│       ├── user.service.ts
│       ├── user.controller.ts
│       ├── user.validator.ts
│       └── user.routes.ts
└── utils/
    └── helpers.ts                      # SendResponse, HashPassword, JWT helpers

⚙️ Scripts

PostgreSQL

| Script | Description | |---|---| | npm run dev | Runs migrations then starts with nodemon | | npm run build | Bundles with esbuild → dist/index.js | | npm start | Runs migrations then starts from dist/ | | npm run create:migration -- --name <name> | Generate a new Sequelize migration | | npm run db:migrate | Run all pending Sequelize migrations |

MongoDB

| Script | Description | |---|---| | npm run dev | Runs migrations then starts with nodemon | | npm run build | Bundles with esbuild → dist/index.js | | npm start | Runs migrations then starts from dist/ | | npm run create:migration -- <name> | Generate a new migrate-mongo migration | | npm run db:migrate | Run all pending migrations (up) | | npm run db:migrate:down | Roll back last migration (down) |


🔑 Environment Variables

PostgreSQL — .env.local

DATABASE=
DATABASE_USERNAME=
DATABASE_PASSWORD=
DATABASE_HOST=
DIALECT=postgres
NODE_ENV="development"
JWT_SECRET=
PORT=4000

MongoDB — .env.local

MONGODB_URI=
MONGODB_DB_NAME=
NODE_ENV="development"
JWT_SECRET=
PORT=4000

MONGODB_DB_NAME is optional — if omitted, the database name from the URI is used.


🔴 Redis (optional)

If you select Yes for Redis, config/redis.ts is added with a pre-configured client including reconnect strategy and event logging.

⚠️ Redis must be installed and running on your server. https://redis.io/docs/getting-started/installation/


🗄️ Migrations

PostgreSQL

Migrations use sequelize-cli and run automatically via the predev / prestart hooks. The config/config.js file is picked up automatically by sequelize-cli.

MongoDB

Migrations use migrate-mongo. The migrate-mongo-config.js at the project root points to your MONGODB_URI and the migrations/ directory. Migrations also run automatically via the predev / prestart hooks.


🏗️ After Setup

cd <project-name>

# 1. Fill in your credentials
nano .env.local

# 2. Start the dev server (migrations run automatically)
npm run dev