Skip to content

Express.js boilerplate with a clean, layered architecture designed for rapid backend development. Built with flexibility in mind, supporting both TypeScript and JavaScript to match your preferences.

License

Notifications You must be signed in to change notification settings

Leoj030/gen-ex-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Generate Express App

Express.js boilerplate with a clean, layered architecture designed for rapid backend development. Built with flexibility in mind, supporting both TypeScript and JavaScript to match your preferences.

✨ Features

🎯 Core Framework

  • Express.js — Fast, minimalist web framework for Node.js
  • TypeScript & JavaScript Support — Choose your preferred language or switch between them seamlessly

🧪 Testing & Quality

  • Jest — Comprehensive testing framework with built-in mocking and coverage
  • Babel Integration — Pre-configured for seamless Jest compatibility, ensuring tests always work reliably
  • ESLint — Strict linting rules for consistent code quality
  • Prettier — Opinionated code formatting for unified style across your team

🏗️ Architecture

  • Layered Architecture — Clean separation of concerns with dedicated layers:
    • Controllers — Handle request/response logic
    • Routes — Define API endpoints and middleware
    • Configs — Centralized configuration management
    • Services — Business logic layer (ready to extend)
  • Production-Ready Structure — Organized for scalability and maintainability

🔧 Built-in Utilities

  • dotenv — Environment variable management
  • cors — Cross-Origin Resource Sharing
  • express-rate-limit — Rate limiting
  • helmet — Security headers

🗂️ Project Structure

src/
  ├── index                    # Application entry point
  ├── config/                  # Configuration layer
  │   └── limiter.config       # Rate limiting configuration
  │   └── cors.config          # CORS configuration
  ├── controllers/             # Controller layer
  │   └── getter.controller    # Example controller
  └── routes/                  # Routing layer
      └── getter.route         # Example route definition

tests/
  └── getHello.test            # Example test suite

🏁 Getting Started

1. Creating the project

This creates the directory and install the package

npx gen-ex-app <project-name>

or

This uses the current directory and install the package

npx gen-ex-app .

3. Development

Start the development server with hot-reloading:

npm run dev

Type-check in watch mode: for (Typescript only)

npm run dev:type-check

4. Build and Run

Build the project (Only if using Typescript, you can proceed to 'npm start' if using Javascript):

npm run build

Start the server:

npm start

Or build and start in one step: (Typescript only)

npm run build-start

5. Linting and Formatting

Check linting errors:

npm run lint

Fix linting errors:

npm run lint:fix

Format code with Prettier:

npm run format

Check formatting:

npm run format:check

6. Testing

Run all tests:

npm test

📡 Example Endpoint

  • GET / — Returns "Hello World"

🛠️ Customization

  • Add new routes in src/routes/
  • Add new controllers in src/controllers/
  • Add tests in tests/

📝 License

MIT

About

Express.js boilerplate with a clean, layered architecture designed for rapid backend development. Built with flexibility in mind, supporting both TypeScript and JavaScript to match your preferences.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published