Coder Social home page Coder Social logo

islomar / frontend-hexagonal_architecture-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codelytv/frontend-hexagonal_architecture-example

0.0 0.0 0.0 1.01 MB

JavaScript 6.16% TypeScript 71.15% Makefile 1.01% HTML 1.64% SCSS 20.04%

frontend-hexagonal_architecture-example's Introduction

Codely logo

Hexagonal Architecture in Frontend

Codely Open Source CodelyTV Courses

Stars are welcome ๐Ÿ˜Š

Hexagonal architecture: what is it and benefits

Hexagonal architecture, also known as "ports and adapters", is a software design approach that separates the internal workings of a system from its external interactions. In frontend development, this architecture pattern is used to structure the frontend code in a way that allows for modularity, testability, and ease of maintenance. The main idea behind the hexagonal architecture in frontend is to create a clear separation between the presentation layer and the application logic, allowing developers to make changes to either layer without affecting the other.

The benefits of using hexagonal architecture in frontend development include increased testability, as the application logic is not coupled to the infrastructure (calls to an API, usage of local storage, etc.). This also makes it easier to maintain the code, as changes to the presentation layer or the application logic can be made without affecting the other. Additionally, the modular structure of the hexagonal architecture pattern allows for easier scaling and improved flexibility, as new features can be added or existing ones can be updated without having to make changes to the underlying architecture. Furthermore, the clear separation between the presentation layer and the application logic makes it easier for multiple developers to work on the same project, as they can focus on their specific areas of responsibility without affecting other parts of the code.

Approach

While Hexagonal Architecture doesn't talk about layers, we like to organize our code in 3 separate layers:

  • Domain layer: Core logic and concepts of the application, independent of implementation technology, includes business rules, data models, and behaviors.
  • Application layer: Implements use cases and features using the domain layer.
  • Infrastructure layer: Provides abstraction between the app and external systems, enabling flexible and modular interaction via libraries, APIs, etc. Allows easy replacement/upgrade of external systems without affecting core functionality.

This repository shows how we can apply Hexagonal Architecture independently of the programming paradigm, with different examples:

  • object-oriented: follows object-oriented paradigm with the use of classes, value objetcs, etc.
  • functional-basic: avoids the use of classes, using functions instead
  • functional-currying: same as the previous one but it uses currying for dependency injection

๐ŸŒˆ Tech Stack

You can apply Hexagonal Architecture with any tech stack, but this is the one we use in the examples:

frontend-hexagonal_architecture-example's People

Contributors

nuria-fl avatar rgomezcasas 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.