Express Quickstart
Express Quickstart is a boilerplate to quickly set up a production-ready RESTful API using Express.js. This package helps developers bootstrap their Node.js API projects with best practices, database support, linting, testing, and Docker integration.
Features
- Express.js - Fast and minimal web framework
- Knex.js - SQL query builder with support for migrations and seeding
- MySQL2 / SQLite - Database support for production and development
- PM2 - Process manager for production deployments
- Docker - Containerization for development and production
- ESLint & Prettier - Linting and code formatting
- Jest & Supertest - Testing framework for unit and integration tests
- Husky & Lint-Staged - Git hooks for enforcing best practices
Installation
Using npx
npx @vaibhavsaini/create-express-quickstart
cd my-app
npm install
Clone the Repository
git clone git@github.com:imVSaini/express-quickstart.git my-app
cd my-app
npm install
Usage
Development Mode
npm run server
Production Mode
npm start
Running with PM2
npm run pm2:start
Running with Docker
npm run docker:dev # Development
npm run docker:prod # Production
Database Migrations & Seeding
Creating a New Migration
npm run migrate:make
Running Migrations (Production)
npm run migrate:latest
Running Migrations (Development)
npm run migrate:up
Rolling Back Migrations (Development)
npm run migrate:down
Rolling Back Migrations (Production)
npm run migrate:rollback
Creating Seed Data
npm run seed:make
Running Seeders (Development)
npm run seed
Running Seeders (Production)
npm run seed:run
SQLite Note
If you want to use SQLite, make sure to create a .tmp
directory in the root of your project.
Linting & Formatting
Linting
npm run lint
Fix Linting Issues
npm run lint:fix
Prettier Formatting
npm run prettier
Auto-fix Formatting Issues
npm run prettier:fix
Testing
Run Tests
npm test
Watch Mode
npm run test:watch
Test Coverage
npm run coverage
Contributing
Contributions are welcome! Please follow the existing coding style and submit pull requests for improvements.
License
This project is licensed under the MIT License.
Created by Vaibhav Saini