/api-hex-arch-express-types

This repository contains an example of hexagonal architecture.

Primary LanguageTypeScript

api-hex-arch-express-types

Project logo

Hexagonal Architecture

Status GitHub Issues GitHub Pull Requests License


This repository contains an example of hexagonal architecture.

  • Clean Architecture by Uncle Bob.
  • Onion Architecture.
  • Separate infrastructure from business logic.
  • Inputs and outputs in border the our design.

Definitions

  • Entities: Represent business objects.
  • Interactors: Functions that interact with entities, business logic.
  • Repositories: Interface operations with entities for example getbyId, getAll, save.
  • Transport Layer: Communication methods, for example: http or SQS (Input andOutput).
  • Data Sources: Class that implement the functions the repositories.

Table of Contents

About

Project contains an example of hexagonal architecture

Tree Project

├─ src
│  ├─ controllers
│  │  └─ http
│  │     └─ PokemonController.ts
│  ├─ core
│  │  ├─ entities
│  │  │  └─ Pokemon.ts
│  │  ├─ interactors
│  │  │  ├─ index.ts
│  │  │  └─ pokemonInteractor.ts
│  │  └─ repositories
│  │     └─ pokemonRepository.ts
│  ├─ dataSources
│  │  ├─ PokemonDataSource.ts
│  │  └─ sequelize
│  │     ├─ index.ts
│  │     └─ PokemonModel.ts
│  └─ server
│     └─ index.ts

Getting Started

git clone https://github.com/sistemasnegros/api-hex-arch-express-types

Prerequisites

node v14.17.6
Mysql

Installing

npm install

Usage

npm run dev

✍️ Authors

🎉 Acknowledgements