From e0a155382b6aab5a000fdb35713f322353d77ff6 Mon Sep 17 00:00:00 2001 From: Ammar Qaffaf Date: Tue, 23 Apr 2024 09:10:31 -0400 Subject: [PATCH 1/3] updating the ReadMe --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dee6f14..ab85df8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,27 @@ # Backend -## Description +## Overview +This is the backend for an IoT application built using NestJS. It interfaces with the Tuya IoT cloud platform to manage homes, rooms, devices, ...etc. This is the backend APIs project, developed with NestJS for Syncrow IOT Project. +## Database Model +The database uses PostgreSQL and TypeORM. Below is an entity relationship diagram: + +The main entities are: + +User - Stores user account information +Home - Represents a home/space +Room - Represents a room/sub-space +Device - Represents a connected device +Product - Stores metadata about device products +Other Entities - sessions, OTPs, etc. + +The entities have a one-to-many relationship - a user has multiple homes, a home has multiple rooms, and a room has multiple devices. + +## Architecture +The application is deployed on Azure App Service using Docker containers. There are separate deployment slots for development, staging, and production environments. + + ## Installation First, ensure that you have Node.js `v20.11` or newer (LTS ONLY) installed on your system. From d8ea23e1a7a0660e5cbe227b34b245eeb95f4ce6 Mon Sep 17 00:00:00 2001 From: faris Aljohari <83524184+farisaljohari@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:56:12 +0300 Subject: [PATCH 2/3] Add ERD diagram to README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ab85df8..bdeaced 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,6 @@ $ npm run test:e2e $ npm run test:cov ``` +## ERD Diagram + +![Syncrow ERD Digram](https://github.com/SyncrowIOT/backend/assets/83524184/94273a2b-625c-4a34-9cd4-fb14415ce884) \ No newline at end of file From e078178f8087391285ead35360239e0a69b9371a Mon Sep 17 00:00:00 2001 From: Ammar Qaffaf Date: Wed, 24 Apr 2024 13:50:33 +0300 Subject: [PATCH 3/3] add architecture diagram --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bdeaced..67eb623 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,51 @@ $ npm run test:cov ## ERD Diagram -![Syncrow ERD Digram](https://github.com/SyncrowIOT/backend/assets/83524184/94273a2b-625c-4a34-9cd4-fb14415ce884) \ No newline at end of file +![Syncrow ERD Digram](https://github.com/SyncrowIOT/backend/assets/83524184/94273a2b-625c-4a34-9cd4-fb14415ce884) + + +## Architecture + +----------------------------------+ + | | + | Applications | + | | + +-----------------------------+-------------+--------------------+ + | | | + | | API Calls | + | | | + | v | + | +---------------------+------------------------+ | + | | | | | + | | Dev Slot | Staging Slot | | + | | | | | + | +---------------------+------------------------+ | + | | | | + | | | | + | | | | + | +------------------+ +---------------------+ | + | | Dev Database | | Staging Database | | + | +------------------+ +---------------------+ | + | | + | +-----------------------------------------+ | + | | | | + | | Production | | + | | | | + | +-----------------------------------------+ | + | | | | + | | | | + | | | | + | +------------------+ | | + | | Production DB | | | + | | Highly Available | | | + | | Cluster | | | + | +------------------+----------------+ | + | | Production DB | | | + | | Standby Node | | | + | +------------------+ | | + | | Production DB | | | + | | Standby Node | | | + | +------------------+ | | + | | Production DB | | | + | | Standby Node | | | + | +------------------+----------------+ | + +-----------------------------------------------------------------+