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

express-api-kit

v2.0.2

Published

πŸš€ Production-Ready Express API Generator - Create enterprise-grade APIs with authentication, file uploads, cron jobs, database pooling, and advanced security features. Supports MongoDB, MySQL, and PostgreSQL.

Downloads

36

Readme

Express API Kit

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—    
  β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•    
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—   β•šβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—    
  β–ˆβ–ˆβ•”β•β•β•   β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•  β•šβ•β•β•β•β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘    
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘    
  β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•     β•šβ•β•  β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•    
                                                              
   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—    β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—                
  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘    β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•                
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘                   
  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘    β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘                   
  β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘    β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘                   
  β•šβ•β•  β•šβ•β•β•šβ•β•     β•šβ•β•    β•šβ•β•  β•šβ•β•β•šβ•β•   β•šβ•β•                   

πŸš€ Production-Ready Express API Generator - A powerful CLI tool that generates enterprise-grade Express.js APIs with advanced features including authentication, file uploads, cron jobs, database pooling, and comprehensive security middlewares.

πŸ“¦ Installation

Install globally for easy access:

npm install -g express-api-kit

Or use directly with npx:

npx express-api-kit

πŸš€ Quick Start

Generate a new API project:

npx express-api-kit

Follow the interactive prompts:

? Enter project name: my-awesome-api
? Select database: MongoDB

Then start developing:

cd my-awesome-api
npm run dev

✨ Advanced Features

πŸ” Authentication & Authorization

  • JWT-based authentication with role-based access control
  • Password hashing with bcryptjs
  • User validation and middleware protection
  • Customizable authentication flows

πŸ“ File Upload System

  • Multer-powered file upload middleware
  • Configurable upload destinations and file types
  • File size validation and error handling
  • Automatic URL generation for uploaded files

⏰ Cron Job Scheduler

  • Node-cron integration for background tasks
  • Predefined job templates (daily, hourly, weekly)
  • Custom job creation utilities
  • Environment-based job control

πŸ—„οΈ Database Optimization

  • Connection Pooling for both SQL and MongoDB
  • Advanced connection management
  • Retry mechanisms and error handling
  • Performance monitoring and statistics

πŸ›‘οΈ Security & Performance

  • Helmet.js for security headers
  • Rate limiting with express-rate-limit
  • Request compression (gzip)
  • Input validation with Joi
  • CORS configuration

πŸ“§ Communication & Logging

  • Nodemailer email service integration
  • Winston-based structured logging
  • Request/response logging with Morgan
  • Custom response handlers

πŸ›  Interactive Setup

The CLI will prompt you for:

  • Project Name (default: express-api-kit)
  • Database Selection (MongoDB, MySQL, PostgreSQL)

πŸ“Œ Project Structure

Generated projects include a comprehensive, production-ready structure:

project-name/
β”œβ”€β”€ config/
β”‚   └── database.js          # Database connection with pooling
β”œβ”€β”€ controllers/
β”‚   └── auth.controller.js   # Authentication logic
β”œβ”€β”€ docs/
β”‚   └── readme.md           # API documentation
β”œβ”€β”€ jobs/
β”‚   β”œβ”€β”€ exampleCronJob.js   # Cron job templates
β”‚   └── jobScheduler.js     # Job management system
β”œβ”€β”€ middlewares/
β”‚   β”œβ”€β”€ auth.middleware.js  # JWT & role-based authentication
β”‚   └── upload.middleware.js # File upload handling
β”œβ”€β”€ models/
β”‚   └── User.js            # Database models (Sequelize/Mongoose)
β”œβ”€β”€ routes/
β”‚   └── auth.routes.js     # API route definitions
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ emailService.js    # Email integration (Nodemailer)
β”‚   └── fileService.js     # File operations utilities
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ banner.js          # ASCII startup banner
β”‚   β”œβ”€β”€ logger.js          # Winston logging configuration
β”‚   └── responseHandler.js # Standardized API responses
β”œβ”€β”€ view/                  # View templates (SQL template only)
β”œβ”€β”€ .env                   # Environment variables
β”œβ”€β”€ .gitignore            # Git ignore rules
β”œβ”€β”€ app.js                # Express application setup
β”œβ”€β”€ package.json          # Dependencies & npm scripts
└── server.js             # Application entry point

πŸ“ Folder Descriptions

  • config/ - Database connections, app configurations
  • controllers/ - Request handlers and business logic
  • docs/ - API documentation and guides
  • jobs/ - Background jobs and cron schedulers
  • middlewares/ - Express middlewares (auth, upload, validation)
  • models/ - Database schemas and models
  • routes/ - API endpoint definitions
  • services/ - Reusable business services
  • utils/ - Helper functions and utilities
  • view/ - Template files (SQL template only)

πŸ“œ Environment Configuration

A comprehensive .env file is automatically generated with optimized defaults:

MongoDB Template:

# Server Configuration
PORT=5000
NODE_ENV=development
APP_URL=http://localhost:5000

# Database
MONGO_URI=mongodb://localhost:27017/project-name

# Authentication
JWT_SECRET=your_jwt_secret_here_minimum_32_characters

# Email Service
[email protected]
EMAIL_PASS=your_app_password

# MongoDB Connection Pool Settings
MONGO_MAX_POOL_SIZE=10
MONGO_MIN_POOL_SIZE=5
MONGO_MAX_IDLE_TIME=30000
MONGO_SERVER_SELECTION_TIMEOUT=5000
MONGO_SOCKET_TIMEOUT=45000
MONGO_CONNECT_TIMEOUT=10000
MONGO_HEARTBEAT_FREQUENCY=10000
MONGO_READ_PREFERENCE=primary
MONGO_WRITE_CONCERN=majority
MONGO_READ_CONCERN=majority
MONGO_WRITE_TIMEOUT=5000

# Background Jobs
ENABLE_CRON_JOBS=true

SQL Template (MySQL/PostgreSQL):

# Server Configuration
PORT=5000
NODE_ENV=development
APP_URL=http://localhost:5000

# Database
DB_HOST=localhost
DB_USER=root
DB_PASS=password
DB_NAME=project-name
DB_DIALECT=mysql

# Authentication
JWT_SECRET=your_jwt_secret_here_minimum_32_characters

# Email Service
[email protected]
EMAIL_PASS=your_app_password

# Database Connection Pool Settings
DB_POOL_MAX=5
DB_POOL_MIN=0
DB_POOL_ACQUIRE=30000
DB_POOL_IDLE=10000

# Background Jobs
ENABLE_CRON_JOBS=true

πŸƒ Running Your Project

After generation, navigate to your project and start developing:

cd my-awesome-api
npm run dev        # Development mode with nodemon
# or
npm start          # Production mode

You'll see the beautiful startup banner:

================================================================================
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—    
  EXPRESS API KIT - Production Ready API Server
================================================================================
πŸš€ Server running on http://localhost:5000
πŸ“– API Documentation: http://localhost:5000/api-docs  
πŸ“Š Connection Pool: Max 10, Min 5
⚑ Ready to handle requests!

🎯 Built-in API Endpoints

Authentication Routes

POST /api/auth/register    # User registration
POST /api/auth/login       # User authentication
GET  /api/auth/profile     # Get user profile (protected)

πŸ“¦ Included Dependencies

Core Framework

  • express - Fast, unopinionated web framework
  • cors - Cross-Origin Resource Sharing
  • morgan - HTTP request logger

Database & ORM

  • mongoose (MongoDB) / sequelize (SQL)
  • mysql2 / pg - Database drivers

Security & Authentication

  • bcryptjs - Password hashing
  • jsonwebtoken - JWT token management
  • helmet - Security headers
  • express-rate-limit - Rate limiting

File Handling & Jobs

  • multer - File upload middleware
  • node-cron - Task scheduling

Utilities & Performance

  • joi - Input validation
  • compression - Response compression
  • winston - Advanced logging
  • nodemailer - Email service

Development Tools

  • nodemon - Development auto-restart
  • eslint - Code linting
  • prettier - Code formatting

πŸš€ What You Get Out of the Box

βœ… Authentication System - Complete JWT-based auth with role management
βœ… File Upload API - Ready-to-use file upload with validation
βœ… Background Jobs - Cron job system for scheduled tasks
βœ… Database Optimization - Connection pooling and retry mechanisms
βœ… Security Features - Rate limiting, helmet, input validation
βœ… Professional Logging - Structured logging with Winston
βœ… Email Integration - Nodemailer setup for notifications
βœ… API Documentation - Swagger UI ready to customize
βœ… Production Ready - Optimized configurations and error handling

πŸ“Š Performance Features

  • Connection Pooling: Optimized database connections
  • Request Compression: Automatic gzip compression
  • Rate Limiting: Protection against abuse
  • Caching Headers: Efficient client-side caching
  • Error Handling: Comprehensive error management
  • Health Monitoring: Built-in health check endpoints

πŸ› οΈ Customization

All generated code is fully customizable:

  • Modify authentication logic in controllers/auth.controller.js
  • Add new cron jobs in jobs/ directory
  • Configure file uploads in middlewares/upload.middleware.js
  • Adjust database settings in config/database.js
  • Extend API routes in routes/ directory

🀝 Contributing

We welcome contributions! Please feel free to submit issues and pull requests.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ’™ Support & Credits

πŸ‘¨β€πŸ’» Developed by: Muhammad Ahmad
πŸ“’ If you like this tool, give it a ⭐ on GitHub!
πŸ› Report issues: GitHub Issues
πŸ’¬ Discussions: GitHub Discussions


Happy Coding! πŸŽ‰

Built with ❀️ for the developer community.