Skip to content

aldo235/nodejs-boilerplate-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Express Boilerplate (DDD Architecture)

This is a boilerplate project for building a Node.js application using Express.js. It provides a solid foundation with a structured directory layout, commonly used middlewares, microservice architecture, and some best practices for building scalable applications.

Features

  • Express.js: Fast, unopinionated, minimalist web framework for Node.js
  • ESLint: Linting JavaScript code for consistency and avoiding errors
  • Prettier: Code formatter for maintaining code style
  • dotenv: Loads environment variables from a .env file
  • Morgan: HTTP request logger middleware for Node.js
  • Helmet: Helps secure Express apps by setting various HTTP headers
  • CORS: Cross-Origin Resource Sharing middleware
  • JWT: Authentication Method with Json Web Token
  • MongoDB: Database MongoDB for storing data
  • Docker: Docker for containerized

Prerequisites

Getting Started

  1. Clone the repository:
    git clone git@github.com:aldo235/nodejs-boilerplate-express.git
    cd nodejs-boilerplate-express
  2. Install dependencies:
    npm install
        # or
    yarn install
  3. Set up environment variables:
    • Create a .env file in the root of the project.
    • Add the following variables:
    PORT=
    BASIC_AUTH_USERNAME=
    BASIC_AUTH_PASSWORD=
    JWT_SECRET=
    JWT_ISSUER=
  4. Run the application:
    # DEV
    npm run start dev
    yarn start dev
    
    #PROD
    npm run start
    yarn start

Docker

  1. Build Docker:
    docker build -t boilerplate:latest . 
  2. Set up environment variables:
    • Create a .env file in the root of the project.
    • Add the following variables:
    PORT=
    BASIC_AUTH_USERNAME=
    BASIC_AUTH_PASSWORD=
    JWT_SECRET=
    JWT_ISSUER=
  3. Run Docker:
    docker run --env-file __LOCATION_ENV__ --name boilerplate -d --publish 8080:8080 boilerplate:latest
    ``

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published