Architecture - Leonhest/Smartmat GitHub Wiki

App architecture:

Screenshot_2023-05-08_at_17.22.13 In this architecture the model belongs to the backend, the view belongs to the frontend and the controller acts as the link between them.

Backend architecture:

Screenshot_2023-05-08_at_17.23.00

DTO

The backend receives a http body from the frontend which is converted into a Data Transfer Object. Each field in the DTO corresponds to a field in the http body which ensures consistency for further use.

Controller

Acts as the endpoint for any fronten request. Uses DTOs to take in requests and send them back to the client.

Security

Makes sure that any request sent to the backend provides the correct authentication.

Service

Here much of the business logic in the backend is preformed. Usually performs operations on a DTO and calls other methods in other layers in the process.

Mapper

Converts DTOs to Models and vice versa. Used by the service class when sending or receiving data .

Repository

Responsible for communication with the database and querying it. All database calls go through the repository.

Metamodel

Used to create more advanced and type-safe queries used by the repository when communicating with the database.

Domain model

The objects that map to a table in the database. Each field is a column.

Frontend architecture:

Screenshot_2023-05-08_at_17.24.14

Service

Calls made to the backend go through service where an axios http call i made. This class is responsible for creating these calls with the correct body, params and authentications.

Features

Used by the service layer to get certain data such as the session token.

Components

Different components represent a small part of a website and are often used together or multiple times. Much of the html is defined here.

Assets

Images used by components are stored here

Locales

The app supports both english and norwegian text. The translation table is stored here.

Views

Each view represents one page on the website. It usually consists of several components that provide the body.

Router

The router is responsible for changing view when a user clicks on another page.

Store

Temporary storage that is needed while the website is in use will be stored here.

⚠️ **GitHub.com Fallback** ⚠️