A Seven Peaks Speaks Summary:
The Past, Present, and Future
A detailed summary from Seven Peaks Software
An overview of Node.js
The Hex Architecture
Introducing the Hexagonal Architecture
It is important to understand the Hexagonal architecture to avoid future coding issues and to write more maintainable code.
It is also important to understand “clean architecture”. What is clean architecture? It is the ultimate goal to separate Policy vs. Detail at the architecture level. This means that the application is independent from everything including Frameworks and any external agency. This also includes the business rules which are not bound to the database. You can easily test your business logic without any dependencies to the user interface, database or web API.
Application core with ports
From the start, we have two layers which are: the main layer and the application layer.
- The main layer is something that contains your business rule
- The application layer glue between the main layer and outer ports. Outer ports basically interface the specification on how you can use or work with this.
Source code dependencies must only point inwards
Importantly, source code dependencies only point inwards. So the main layer doesn’t know anything about the application layer. However, the application layer and ports can know everything about the domain, as well as manipulate and work with it.
Ports and Adapters
This one is already built in the application with hexagonal architecture; meaning that there is a similarity between the application layer as the main layer with the add-in of driving adapters which control your application. As you can see from the start, users can go there using an express web server which is called an “express adapter” through a service-port that controls the application to the left side of the driven adapters – as the application needs to access databases, email or log, etc. Basically, the adapters are the classes that implement the ports interfaces.
However, if you have the need to change the adapter, it can be done through changing the database, mail provider or easily migrating from Express to Koa. All you have to do is to remove the adapter and rewrite only the adapter code to implement these interfaces, because your application already has everything in place.
For more insightful coding instructions, check out this YouTube video
Many people are asking if Deno is similar to Node.js. More questions include: why hasn’t Node.js improved? And why was Deno created?
Why will the future be server-less?
In a software world, you still need servers in server-less. It is just that you don’t have to manage them. Putting work loads that need lots of concurrency and a lot of CPU to server-less, without managing them, may cause problems.
So when do you need to go server-less?
The tasks that go server-less are those asynchronous and not happening all the time. Their resources can be requested and configured. As well as an event-based architecture - since there are time out limitations and micro nature of each component. It does make you rethink about workflow and all the architecture over again.
Example Patterns of Server-less Framework
Scroll through the presentation here:
Flowaccount had written an open source called Nx-serverless to go with nx-monorepo because it is useful to deploy, run and develop serverless functions.
How does it help?
Coding in Typescript
Writing code in Typescript for your serverless stack – which makes writing the code more maintainable.
Angular Schematics is a tool in the angular framework that helps you transform your code. Schematics can bootstrap your project by running all the automated code and format it right away without doing manual work including:
- Redundant tasks
- Template for code and standard builders for processes
- Every config in one place (workspace.json / angular.json, nx.json)
Angular CLI is a tool that helps you bootstrap your react, nest, next, serverless and all the plug-ins CLI. So that you can write all your configuration for all projects in one file:
- One CLI for all your CI/CD processes
- Reduce complexity in setting up tools
- Support sIs commands. offline , deploy and on-going development
Do you need help with your backend development for your project? Get in touch with us below to see how we can help you!
Meet the writers:
Sijan is our Senior full-stack developer with over 5 years of experience in the software industry. He is methodological, organized and a self-learner.
Georgii, our Senior full-stack developer, has over 12 years of experience working on both sides of web applications frontend and backend. He is also passionate about data science and machine learning.
Meet Ryan, our Project Manager, who has over 10 years of experience working on multiple roles including project management, mobile & web development, cloud infrastructure architect, and more.
Thida is a Junior Digital Marketing intern at Seven Peaks Software, who is currently working on both content sprouting and article writing. “Working hands-on in marketing has been an amazing experience for me so far. I hope you enjoy reading this article!” says Thida.
And meet our guest writer:
Meet Wick, a highly experienced Chief Technology Officer, who has over 15 years of experience in software engineering and product innovation with new and upcoming technologies. He has worked on a variety of projects for the past 5 years which includes growing a Cloud Accounting Platform from a three-person company to now the number one leading accounting solution in Thailand!
Sign up today & start getting tech news.
Get the latest tech trends directly in your inbox each month. And get invited to exclusive events.