Architecture - Leonhest/Smartmat GitHub Wiki
In this architecture the model belongs to the backend, the view belongs to the frontend and the controller acts as the link between them.
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.
Acts as the endpoint for any fronten request. Uses DTOs to take in requests and send them back to the client.
Makes sure that any request sent to the backend provides the correct authentication.
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.
Converts DTOs to Models and vice versa. Used by the service class when sending or receiving data .
Responsible for communication with the database and querying it. All database calls go through the repository.
Used to create more advanced and type-safe queries used by the repository when communicating with the database.
The objects that map to a table in the database. Each field is a column.
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.
Used by the service layer to get certain data such as the session token.
Different components represent a small part of a website and are often used together or multiple times. Much of the html is defined here.
Images used by components are stored here
The app supports both english and norwegian text. The translation table is stored here.
Each view represents one page on the website. It usually consists of several components that provide the body.
The router is responsible for changing view when a user clicks on another page.
Temporary storage that is needed while the website is in use will be stored here.