Package Exports
- @nicholasdigital/express-boilerplate
- @nicholasdigital/express-boilerplate/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nicholasdigital/express-boilerplate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Express Boilerplate
An opinionated boilerplate for building Express applications with modern tooling: Webpack, Babel, ESLint, Prettier, and Jest.
Features
- Express 5.x: Modern Express server setup
- Webpack: Bundles server code for development and production
- Babel: ESNext syntax, decorators, and class properties support
- ESLint & Prettier: Enforced code style and formatting
- Jest: Out-of-the-box unit testing
- Husky & Commitlint: Git hooks for linting, formatting, and commit message validation
- Path Aliases: Use
@as an alias for thesrcdirectory
Getting Started
Installation
git clone https://github.com/nwpray/express-boilerplate.git
cd express-boilerplate
npm installDevelopment
npm run build:watch # Rebuild on file changes
npm run start:watch # Restart server on changes (nodemon)Production
npm run build
npm startLinting & Formatting
npm run lint # Lint and auto-fix code
npm run format # Format code with PrettierTesting
npm testProject Structure
.
├── src/
│ ├── controllers/
│ │ └── Info.js
│ ├── core/
│ │ └── Controller/
│ └── index.js
├── dist/
├── .babelrc
├── .eslintrc
├── .prettierrc
├── webpack.config.js
├── package.json
└── README.mdExample
A simple controller using decorators:
// src/controllers/Info.js
import Controller from '@/core/Controller';
@Controller()
export default class InfoController {
@Controller.Method('get', '/')
static read(req, res) {
res.send('express-boilerplate');
}
}Scripts
npm run build– Bundle source files with Webpacknpm run build:watch– Watch and rebuild on changesnpm run start– Start the compiled servernpm run start:watch– Start server with nodemonnpm run lint– Lint and fix codenpm run format– Format code with Prettiernpm test– Run tests
License
ISC
Made by Nick Pray