GithubHelp home page GithubHelp logo

nestjs-hexagonal-architecture's Introduction

nestJS Hexagonal Architecture example

What is Hexagonal Architecture

Concepts

Core: The core could be viewed as a โ€œboxโ€ capable of resolve all the business logic independently of the infrastructure in which the application is mounted

Drivers (or primary) actors: are those who trigger the communication with the core. .

Driven (or secondary) actors: are those who are expecting the core to be the one who trigger the communication.

Ports: In one hand, we have the ports which are interfaces that define how the communication between an actor and the core has to be done

Adapters: In the other hand, we have the adapters that are responsible of the transformation between a request from the actor to the core, and vice versa

hexagon

Original Article

Project structure

src/internal/core - all the business logic (domain objects, interfaces and use cases)

src/internal/handlers - incoming requests. usually http layer and authentication

src/internal/repositories - adapters used by the core logic, i.e to access a Database

Commands

# From the Makefile

.PHONY: all
.PHONY: build-docker
.PHONY: clean
.PHONY: deps
.PHONY: format
.PHONY: run-dev
.PHONY: run-docker
.PHONY: test-all
.PHONY: test-cov
.PHONY: test-unit

Example request

curl -XGET http://0.0.0.0/videos/1

nestjs-hexagonal-architecture's People

Contributors

dependabot[bot] avatar fabioesposito avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.