Giter Site home page Giter Site logo

vloth / ports-and-adapters Goto Github PK

View Code? Open in Web Editor NEW
16.0 0.0 0.0 6.46 MB

A type safe functional implementation of the hexagonal architecture in typescript

Dockerfile 2.56% JavaScript 20.23% TypeScript 77.21%
typescript ports-and-adapters architecture

ports-and-adapters's Introduction

A type safe functional implementation of the hexagonal architecture in typescript ports & adapters

usecase

The usecase layer represents the business rules of the software. It encapsulates the constraints around the core types. Therefore all the use cases. A change in this layer should not affect the core types. Also changes external to usecases, in the outer layer, should not generate any changes in this layer.

adapter

Adapters are responsible for converting the data between the outer layer (http transport, storages, third party services, etc) and the inner layer (use cases and core types). Data representations are converted through decoding/encoding.
core.adapter is the main adapter which decodes any unknown data to a core type. Besides the core adapter, there is also the storage.adapter, which handles data transport between database engines and the application (more about decoding).

protocol

Protocols setup any required infraestructure for the communication between the outmost layer and the external world.

Getting Started

$ cp .env.sample .env && yarn install

Running in docker

# compiling docker compose
$ docker-compose -f docker/docker-compose.yml build

# running the stack
$ docker-compose -f docker/docker-compose.yml up -d

# get logs of the application
$ docker-compose -f docker/docker-compose.yml logs -f app

# run just the database
$ docker-compose -f docker/docker-compose.yml run --service-ports --detach db

Tests

# unit tests
$ yarn test

# watch unit tests (transpile only)
$ yarn test:watch

# in a new window watch build with noEmit
$ yarn build:watch

# run code coverage
$ yarn test:cover

# open html report in default browser
$ yarn test:cover:open

# integration tests
$ yarn test:integration

# functional tests
$ yarn test:functional

References & Inspiration:

ports-and-adapters's People

Contributors

dependabot[bot] avatar vloth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.