From bc4eeac61a9b94ecf493bee2e3a4d2dbb20a9446 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:04:04 +0300 Subject: [PATCH 01/13] Add backend documentation and setup instructions --- README.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d2e224..7ce84dc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,83 @@ # Temaribet-API -## Node Express with Postgresql + +## Overview + +This repository hosts the backend for [Temaribet](https://temaribet.net/),a professional tutoring platform based in Addis Ababa, Ethiopia. Temaribet connects parents and students with highly qualified tutors, making personalized learning accessible, efficient, and stress-free for busy parents, ensuring academic success for children. + + +## Tech Stack + +- **Backend Framework**: [Express.js](https://expressjs.com/) +- **ORM**: [Prisma](https://www.prisma.io/) +- **Database**: [MongoDB](https://www.mongodb.com/) +- **Authentication**: [JSON Web Tokens (JWT)](https://jwt.io/) and [bcrypt](https://www.npmjs.com/package/bcrypt) +- **File Uploads**: [Multer](https://github.com/expressjs/multer) and [Cloudinary](https://cloudinary.com/) +- **Environment Variables**: [dotenv](https://github.com/motdotla/dotenv) +- **Email Services**: [EmailJS](https://www.emailjs.com/) +- **Development Tools**: [Nodemon](https://nodemon.io/) + +--- + +## Project Structure + +```plaintext +├── config/ # Configuration files for the application. +├── lib/ # Library files and utilities. +├── middlewares/ # Middleware functions for request handling. +├── prisma/ # Prisma ORM setup and migrations. +├── routes/ # Route handlers for different endpoints. +├── utils/ # Utility functions and helpers. +├── server.js # Entry point of the application. +└── README.md # Documentation. +``` + +## Architecture Diagram ++-------------------+ +-------------------+ +-------------------+ +| | | | | | +| Client (UI) +-------> Express.js +-------> MongoDB | +| | | (Backend) | | (Database) | ++-------------------+ +-------------------+ +-------------------+ + ^ | ^ | + | | | | + | v | | + | +-------------------+ | + | | | | + +-------------------+ Prisma ORM +<---------------+ + | | + +-------------------+ + + +## Setup Instructions + +### Prerequisites + +- Install [Node.js](https://nodejs.org/) (v18.x or later recommended). +- Install [npm](https://www.npmjs.com/). + +### Steps + +1. **Clone the repository**: + + ```bash + git clone https://github.com/habasefa/tts-api.git + ``` + +2. **Navigate to the project directory**: + + ```bash + cd tts-api + ``` + +3. **Install dependencies**: + ```bash + npm install + ``` +4. **Run the development server**: + + ```bash + + npm run dev + ``` + +5. **Access the application**: + The application will be accessible at [http://localhost:3000](http://localhost:3000). From d80a4876486e3ed68704ff75d94a47064ce578bc Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:07:25 +0300 Subject: [PATCH 02/13] diagram test --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ce84dc..6b59566 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof ``` ## Architecture Diagram -+-------------------+ +-------------------+ +-------------------+ + +-------------------+ +-------------------+ +-------------------+ | | | | | | | Client (UI) +-------> Express.js +-------> MongoDB | | | | (Backend) | | (Database) | @@ -47,6 +47,8 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof +-------------------+ + + ## Setup Instructions ### Prerequisites From 07b7b386405760b2457a34e532fd8ac7fb6e7b8a Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:08:42 +0300 Subject: [PATCH 03/13] diagram test 2 --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b59566..3d78062 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,10 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof ``` ## Architecture Diagram - +-------------------+ +-------------------+ +-------------------+ + +```plaintext + ++-------------------+ +-------------------+ +-------------------+ | | | | | | | Client (UI) +-------> Express.js +-------> MongoDB | | | | (Backend) | | (Database) | @@ -47,7 +50,7 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof +-------------------+ - +``` ## Setup Instructions From 97e326de9a6c1a28603030cd9d23e866ffba1bc5 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:12:47 +0300 Subject: [PATCH 04/13] diagram test 3 --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d78062..e593264 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,17 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof +-------------------+ -``` +``` + +```mermaid +flowchart TD + A[Client (UI)] --> B[Express.js (Backend)] + B --> C[MongoDB (Database)] + B --> D[Prisma ORM] + D --> B + C --> B + A --> B +``` ## Setup Instructions From ad03a9e01e92d1fb10c977d45ef88602f02237ec Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:15:08 +0300 Subject: [PATCH 05/13] Add flowchart to README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e593264..cae9db7 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof ``` ```mermaid + flowchart TD A[Client (UI)] --> B[Express.js (Backend)] B --> C[MongoDB (Database)] From cc88e40f8bebe9710a2aca08f67bc493c6ededb6 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:17:28 +0300 Subject: [PATCH 06/13] diagram test 4 --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cae9db7..a8b3c04 100644 --- a/README.md +++ b/README.md @@ -52,12 +52,18 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof ``` + + ```mermaid flowchart TD - A[Client (UI)] --> B[Express.js (Backend)] - B --> C[MongoDB (Database)] - B --> D[Prisma ORM] + A--> B + B --> C + B --> D D --> B C --> B A --> B From 6de7f23094481a29504199fa9453742956129136 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:19:42 +0300 Subject: [PATCH 07/13] diagram test 5 --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a8b3c04..cb9fbee 100644 --- a/README.md +++ b/README.md @@ -61,12 +61,12 @@ D[Prisma ORM] --> ```mermaid flowchart TD - A--> B - B --> C - B --> D - D --> B - C --> B - A --> B + A[Client (UI)] --> B[Express.js (Backend)] + B[Express.js (Backend)] --> C[MongoDB (Database)] + B[Express.js (Backend)] --> D[Prisma ORM] + D[Prisma ORM] --> B[Express.js (Backend)] + C[MongoDB (Database)] --> B[Express.js (Backend)] + A[Client (UI)] --> B[Express.js (Backend)] ``` ## Setup Instructions From b76c37dba73afd8d2ac45cff1de692da06cdffbf Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:24:15 +0300 Subject: [PATCH 08/13] Refactor flowchart in README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cb9fbee..4c2bda8 100644 --- a/README.md +++ b/README.md @@ -61,12 +61,12 @@ D[Prisma ORM] --> ```mermaid flowchart TD - A[Client (UI)] --> B[Express.js (Backend)] - B[Express.js (Backend)] --> C[MongoDB (Database)] - B[Express.js (Backend)] --> D[Prisma ORM] - D[Prisma ORM] --> B[Express.js (Backend)] - C[MongoDB (Database)] --> B[Express.js (Backend)] - A[Client (UI)] --> B[Express.js (Backend)] + Client (UI) --> Express.js (Backend) + Express.js (Backend) --> MongoDB (Database) + Express.js (Backend) --> Prisma ORM + Prisma ORM --> Express.js (Backend) + MongoDB (Database) --> Express.js (Backend) + Client (UI) --> Express.js (Backend) ``` ## Setup Instructions From f202c23a76dc3532a0965cfbdb76de8fba690005 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 19:27:02 +0300 Subject: [PATCH 09/13] Refactor application architecture --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4c2bda8..7e743c5 100644 --- a/README.md +++ b/README.md @@ -59,14 +59,13 @@ C[MongoDB (Database)] D[Prisma ORM] --> ```mermaid - flowchart TD - Client (UI) --> Express.js (Backend) - Express.js (Backend) --> MongoDB (Database) - Express.js (Backend) --> Prisma ORM - Prisma ORM --> Express.js (Backend) - MongoDB (Database) --> Express.js (Backend) - Client (UI) --> Express.js (Backend) + Client_UI --> Express_Backend + Express_Backend --> MongoDB_Database + Express_Backend --> Prisma_ORM + Prisma_ORM --> Express_Backend + MongoDB_Database --> Express_Backend + Client_UI --> Express_Backend ``` ## Setup Instructions From 2fff67e3c21c784c04dce78b2c2f6b3763400aec Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 20:11:35 +0300 Subject: [PATCH 10/13] Add flowchart for data flow between components --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7e743c5..4b53b92 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,15 @@ flowchart TD MongoDB_Database --> Express_Backend Client_UI --> Express_Backend ``` +```mermaid +flowchart TD + Client_UI -->|HTTP Requests| Express_Backend + Express_Backend -->|ORM| Prisma_ORM + Prisma_ORM -->|Database Operations| MongoDB_Database +``` + + + ## Setup Instructions From 6083946f89b3da7c9b74938ed3bb7eec33ac0114 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 20:16:41 +0300 Subject: [PATCH 11/13] Update flowchart connections --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4b53b92..3069112 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,12 @@ D[Prisma ORM] --> ```mermaid flowchart TD - Client_UI --> Express_Backend - Express_Backend --> MongoDB_Database - Express_Backend --> Prisma_ORM - Prisma_ORM --> Express_Backend - MongoDB_Database --> Express_Backend - Client_UI --> Express_Backend + Client_UI -->|HTTP Requests| Express_Backend + Express_Backend -->|ORM| Prisma_ORM + Prisma_ORM -->|Database Operations| MongoDB_Database + MongoDB_Database -->|Responses| Prisma_ORM + Prisma_ORM -->|Responses| Express_Backend + Express_Backend -->|HTTP Responses| Client_UI ``` ```mermaid flowchart TD From 708e461581a25d781ca91acc7ac4a52a40391696 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 20:17:51 +0300 Subject: [PATCH 12/13] Refactor architecture diagram --- README.md | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/README.md b/README.md index 3069112..4143824 100644 --- a/README.md +++ b/README.md @@ -33,31 +33,6 @@ This repository hosts the backend for [Temaribet](https://temaribet.net/),a prof ## Architecture Diagram -```plaintext - -+-------------------+ +-------------------+ +-------------------+ -| | | | | | -| Client (UI) +-------> Express.js +-------> MongoDB | -| | | (Backend) | | (Database) | -+-------------------+ +-------------------+ +-------------------+ - ^ | ^ | - | | | | - | v | | - | +-------------------+ | - | | | | - +-------------------+ Prisma ORM +<---------------+ - | | - +-------------------+ - - -``` - - - ```mermaid flowchart TD Client_UI -->|HTTP Requests| Express_Backend @@ -67,12 +42,6 @@ flowchart TD Prisma_ORM -->|Responses| Express_Backend Express_Backend -->|HTTP Responses| Client_UI ``` -```mermaid -flowchart TD - Client_UI -->|HTTP Requests| Express_Backend - Express_Backend -->|ORM| Prisma_ORM - Prisma_ORM -->|Database Operations| MongoDB_Database -``` From d9bdb22efaafec7a923d962f6f217f4cb75bd295 Mon Sep 17 00:00:00 2001 From: Eba Adisu Date: Mon, 2 Dec 2024 20:50:12 +0300 Subject: [PATCH 13/13] Update application port to 4000 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4143824..ca6dd17 100644 --- a/README.md +++ b/README.md @@ -79,4 +79,4 @@ flowchart TD ``` 5. **Access the application**: - The application will be accessible at [http://localhost:3000](http://localhost:3000). + The application will be accessible at [http://localhost:4000](http://localhost:4000).