Skip to content

Clean Architecture with Node.js + Express.js

Notifications You must be signed in to change notification settings

apavamontri/nodejs-clean

Repository files navigation

Node.js + Express.js + Clean Architecture

This is the spike code to architect node.js, express.js using clean architecture.

Architecture Overview

This project's architecture is based on Uncle Bob's The Clean Architecture. Please at least skim through his blog as you will have a better understanding of how it works.

We are separated this application into 4 different layers

  1. Domains (highest)
  2. Use cases
  3. Interfaces
  4. Infrastructure (lowest)

The gist of it is a separation of concerns. Outer layer (lower) can reference (or know) the inner (highest) layer, however, the inner layers can not know about outer layer. We accomplished this by using Dependency Injection and Duck Typing since Javascript doesn't have the concept of Interface.

(highest)                                    (lowest, most detail implementation)
domains ---> user cases ---> interfaces ---> infrastructure

Run the server

$ npm install
$ NODE_ENV=development node server.js

Releases

No releases published

Packages

No packages published