Skip to content

komyg/express-boilerplate

Repository files navigation

Express Boilerplate

This is a backend application template that can be used when starting a new project.

It includes:

  • A dockerfile for deployment
  • A /healthcheck endpoint that returns 200.
  • A /api/company endpoint with an example of DDD + functional programming approach.

Patterns

DDD (Domain Driven Design)

This repository adopts a domain driven design approach to separate each part of the code, into these layers:

  • Presentation: (controllers): is the entry point to the application. It handles REST requests and executes basic validation.
  • Application: this layer is divided into use cases. Its purpose is to orchestrate (call) the domain and infrastructure layers.
  • Domain: this is the core of our application. It contains all of the business rules and higher order logic.
  • Infrastructure: this layer contains all the logic to interact with the database and other lower level entities.

Functional Programming

This repository adopts a functional programming paradigm. I chose it because it promotes small, independent immutable code, that has small clean interfaces that rely on nothing other than their input to produce idempotent output without side effects.

Further Reading

Inversion of Control

This repository uses an inversion of control pattern based on functional programming. More details here.

Tools Included

This template includes the following tools:

Scripts

  • build: builds your application in the dist folder.
  • start: starts your application in the dist folder.
  • clean: deletes the dist folder.
  • test:e2e: runs end-to-ent integration tests.
  • test:spec: runs unit tests.
  • lint: runs prettier and eslint.
  • lint:fix: runs prettier and eslint and tries to fix all issues.

About

Small Boilerplate for Express

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published