1.0.0 • Published 7 months ago

@nicholasdigital/express-boilerplate v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

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 the src directory

Getting Started

Installation

git clone https://github.com/nwpray/express-boilerplate.git
cd express-boilerplate
npm install

Development

npm run build:watch   # Rebuild on file changes
npm run start:watch   # Restart server on changes (nodemon)

Production

npm run build
npm start

Linting & Formatting

npm run lint      # Lint and auto-fix code
npm run format    # Format code with Prettier

Testing

npm test

Project Structure

.
├── src/
│   ├── controllers/
│   │   └── Info.js
│   ├── core/
│   │   └── Controller/
│   └── index.js
├── dist/
├── .babelrc
├── .eslintrc
├── .prettierrc
├── webpack.config.js
├── package.json
└── README.md

Example

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 Webpack
  • npm run build:watch – Watch and rebuild on changes
  • npm run start – Start the compiled server
  • npm run start:watch – Start server with nodemon
  • npm run lint – Lint and fix code
  • npm run format – Format code with Prettier
  • npm test – Run tests

License

ISC


Made by Nick Pray

1.1.1

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago