Skip to content

jabez007/create-express-template

Repository files navigation

create-express-template

A starter template for initializing Node.js projects using npm init, designed to establish a consistent foundation for API microservices with Express.js. This template provides a standardized setup that simplifies the implementation of specific project requirements and accelerates development.

To Use

npm init git+https://github.com/jabez007/express-template.git my-express-api

or

npm init @jabez007/express-template my-express-api

then

cd ./my-express-api

npm install

npm run test

npm run serve

To Build

There are two scripts that allow you to test the Docker image locally before pushing to Github where Github Actions will build and publish the Docker image

npm run build:docker

npm run serve:docker

Middlewares

This template comes pre-configured with essential middleware components to streamline development and enhance the functionality of your API. These middlewares facilitate efficient logging, intuitive routing, and comprehensive API documentation. By integrating these tools out of the box, the template ensures that your microservice is both robust and maintainable from the start, allowing you to focus on building out your specific application logic.

swagger

request-id

winston

morgan

MITchyM

Helpers

To ensure seamless communication between microservices, this template includes specialized helper modules designed to enrich outgoing requests with essential metadata. These modules automatically append the necessary information to facilitate comprehensive logging and tracking within the target microservices. By standardizing the data passed between services, these helpers promote better traceability, easier debugging, and a more cohesive system-wide logging strategy.

axios

Containerization

This template also provides a standardized configuration for containerizing your Express server, enabling easy deployment within a Docker environment. The included setup ensures that your application is consistently built into a lightweight and efficient container image, following best practices for security and performance. With this configuration, you can seamlessly integrate your service into modern DevOps pipelines, facilitating smooth deployments and scalability across various environments.

Docker

Deploying

To simplify the deployment of your containerized Express server, this template includes manifests tailored for orchestrated environments. These manifests are pre-configured for popular orchestration platforms, ensuring that your microservices can be deployed and managed efficiently at scale. By leveraging these manifests, you can achieve seamless integration, consistent environment configuration, and reliable scaling across your entire microservice architecture.

Kubernetes

CI/CD

This template comes equipped with pre-built CI/CD workflows to automate key stages of your development pipeline,including unit testing, containerization, and deployment. These workflows are designed to streamline the process of building, testing, and deploying your Express server, ensuring that every change is consistently verified and delivered across environments. By automating these tasks, the template reduces manual intervention, enhances reliability, and accelerates the delivery of high-quality microservices.

Github Actions