::::success
# CSN Lab № 2 Assignment: Architecture Patterns
**Names:
1. Khasan Abdurakhmanov
2. Ahmed Saad Ibrahim Ali Nassar
3. Anna Miroshnichenko**
::::
##
:::info
<center>
### PART B [Team work]
</center>
:::
<center>
### Task 3
</center>
> This task is based on a real world application used by customers and costing millions
with regards development and deployment. It will be done in a team of four(4). Devices such as cameras, electric switches, fridges, thermostats, intercoms and more, all have an individual respective application with which it can be managed from a smartphone. Regardless, having a unified view of all devices on a single display would be easier on a user. A startup company called Is3 develops a dashboard system which in almost real time, reports on the status of it’s clients’ devices. The application gathers stateless information from registered IoT devices, and formats the data into the visually beautiful dashboard which provides information on the happenings of the customer’s devices.
Furthermore, some pre-defined queries can be executed by the customer in order to gain access to more information with respects to the devices. Kindly note that no data is added or updating by the customer. The information with regards the device status is received directly from the devices in the field and this data is simply presented to the end-user. Also, the sales team will add customers into the system manually after an intense verification process; hence, you can assume that the devices are already registered as there is no registration process for the system.
**You are the architect** and it’s your duty to design the architecture in order to ensure the Is3 application will push the business and lead eventually to a successful initial public offering. In order to achieve the best possible architecture; your team is expected to achieve this by following the process:
> 1. Define the requirements.
> a. Functional
> b. Nonfunctional
> 2. Map the components of the architecture.
> 3. Choose the Technology stack.
> 4. Design the architecture.
> 5. Write a detailed architecture document.
The architecture must incorporate a robust backend system that efficiently gathers and handles data from all registered devices. Additionally, it should feature an intuitive and visually appealing front-end dashboard that seamlessly delivers the data to end-users. The backend system should be designed to handle high data volumes and ensure data integrity and consistency. A database management system should be chosen to store the data, with appropriate backup and recovery mechanisms in place.
To achieve optimal performance and scalability, a microservices architecture should be considered, with each service responsible for a specific function or feature. This will enable efficient development and deployment of new features, as well as easier maintenance and updates.
**Microservices** architecture is an approach to building software applications as a suite of independent, small, modular services. Each service runs a unique process and communicates with other services through APIs, allowing for more flexibility and scalability. This architecture lends itself well to complex applications that are constantly evolving and require frequent updates and changes.
<center>

Figure 1:Microservice architecture
</center>
The diagram above shows the microservices architecture for the Is3 dashboard system. Registered IoT devices send data to the backend, which processes it and stores it in a database. The backend provides the data to the frontend, which displays it to the end user. The frontend sends requests to the backend, which is responsible for authenticating and authorizing them. Security mechanisms, including encryption, ensure secure data exchange between devices, backend and frontend. Backup and recovery mechanisms are implemented in the database to protect against data loss, ensuring data integrity and consistency. The backend is based on microservices architecture, which ensures efficient development, deployment and maintenance.
**Why should we choose microservice architecture?**
**Microservices architecture** is a good choice for systems that require flexibility and scalability. The independent, modular services allow for easier updates and changes, and the use of APIs for communication between services allows for greater flexibility in integrating with other systems. This architecture is especially useful for complex applications that are constantly evolving and require frequent updates and changes. Additionally, microservices architecture can help with fault isolation and resilience, as failures in one service do not necessarily affect the entire system.
<center>
##
## Solution
</center>
1. **Requirements**:
* Functional:
* The Is3 application should gather stateless information from registered IoT devices.
* The application should format the data into a visually pleasing dashboard that provides information on the status of the customer's devices.
* The application should offer customers the ability to execute predefined queries, allowing them to access more detailed information about the devices.
* Nonfunctional:
* The Is3 application should be highly available and scalable.
* The application should be modular in design to allow for flexibility and future expansion.
* The system should be designed to reduce the risk of system failure by isolating different parts of the system and allowing them to operate independently.
2. **Components of the Is3 application architecture may includes**:
- IoT devices
- Data collection and processing services
- Dashboard presentation layer
- Query processing services
- Authentication and authorization services
- Database for storing device information and user data
<center>

Figure 2: The microservices architecture of Is3
</center>
3. **Choosing the technology** stack for the Is3 application will depend on several factors, including the specific requirements of the application, the skills of the development team, and the availability of supporting tools and frameworks.
**Some potential technologies that could be used in the Is3 application include:**
- IoT platform such as ***Google Cloud IoT*** for connecting and managing IoT devices
- Data processing framework such as ***Apache Kafka*** for collecting and processing data from IoT devices
- Containerization technology such as ***Docker*** for deploying and managing microservices
- Backend framework such as ***Spring Boot*** for building microservices
- Frontend framework such as **React** for building the dashboard presentation layer
4. **The Is3 application** can be designed using a **microservices** **architecture**. The components of the architecture may include *IoT devices*, *data collection and processing services*, *dashboard presentation layer*, *query processing services*, *authentication and authorization services*, and *a database for storing device information* and *user data*. These components will need to be mapped out and integrated to ensure that the application is able to gather and process data from *IoT devices*, present it in a visually pleasing way, and allow users to execute queries to gain additional information about their devices. The technology stack for the Is3 application can include IoT platform such as *Google Cloud IoT* for connecting and managing IoT devices, data processing framework such as *Apache Kafka* for collecting and processing data from IoT devices, containerization technology such as *Docker* for deploying and managing microservices, backend framework such as *Spring Boot* for building microservices, and frontend frameworks such as *React* or *Angular* for building the dashboard presentation layer.
<center>

Figure 3: System Architecture
</center>
5. **Architecture Document for the Is3 Application**
This document outlines the design and implementation of the Is3 application, which is a dashboard system that reports on the status of registered IoT devices in almost real-time.
## Requirements
### Functional Requirements
- The Is3 application should gather stateless information from registered IoT devices.
- The application should format the data into a visually pleasing dashboard that provides information on the status of the customer's devices.
- The application should allow for pre-defined queries to be executed by the customer in order to gain access to more information with respect to the devices.
### Nonfunctional Requirements
- The Is3 application should be highly available and scalable.
- The application should be modular in design to allow for flexibility and future expansion.
- The system should be designed to reduce the risk of system failure by isolating different parts of the system and allowing them to operate independently.
## Architecture
The Is3 application will be designed using a microservices architecture to ensure future scalability and flexibility. The components of the architecture will include:
- IoT devices
- Data collection and processing services
- Dashboard presentation layer
- Query processing services
- Authentication and authorization services
- Database for storing device information and user data
The IoT devices will be connected to the Is3 application using an IoT platform such as Google Cloud IoT. The data collected from the IoT devices will be processed using data processing framework such as Apache Kafka and stored in a database for future reference.
The Is3 application will consist of several microservices that will be deployed using containerization technologies such as Docker. The microservices will be built using backend framework such as Spring Boot and frontend framework such as React will be used to build the dashboard presentation layer.
Authentication and authorization services will be used to ensure that only authorized users can access the Is3 application. The system will be designed to reduce the risk of system failure by isolating different parts of the system and allowing them to operate independently.