An open API service indexing awesome lists of open source software.

https://github.com/ana-yet/service-sys-server

The backend of Service Review System uses Node.js, Express, and MongoDB to provide a secure REST API. It handles user authentication via Firebase Admin SDK, manages services and reviews, calculates dynamic ratings, and supports CRUD operations, ensuring smooth communication between frontend and database for real-time functionality.
https://github.com/ana-yet/service-sys-server

database expressjs mongodb nodejs

Last synced: 3 months ago
JSON representation

The backend of Service Review System uses Node.js, Express, and MongoDB to provide a secure REST API. It handles user authentication via Firebase Admin SDK, manages services and reviews, calculates dynamic ratings, and supports CRUD operations, ensuring smooth communication between frontend and database for real-time functionality.

Awesome Lists containing this project

README

          

# ๐Ÿ”ง Service Review System - Backend

This is the **server-side application** for the Service Review System. It provides a RESTful API built with **Express.js** and **MongoDB**, handles authentication using **Firebase Admin SDK**, and performs core business logic like reviews, ratings, and service management.

๐Ÿ”— **Live Frontend Link**: [https://review-system-app.web.app/](https://review-system-app.web.app/)

---

## ๐Ÿš€ Features

- ๐Ÿ” JWT-based Firebase authentication middleware
- ๐Ÿ“ฆ Add, edit, delete services (protected routes)
- ๐Ÿ—ณ๏ธ Add, update, and delete reviews
- โญ Dynamic rating calculation per service
- ๐Ÿงฎ Dashboard count summary (users, reviews, services)
- ๐Ÿ” Filter and search services
- ๐Ÿ“š Distinct categories from service collection
- ๐Ÿง‘ User profile & services management
- โš™๏ธ MongoDB with three collections:
- `AllServices`
- `Review`
- `User`

---

## ๐Ÿ› ๏ธ Tech Stack

- **Node.js**
- **Express.js**
- **MongoDB (with MongoClient and ObjectId)**
- **Firebase Admin SDK** (JWT token verification)
- **dotenv** (Environment variables)
- **CORS** (Secure cross-origin requests)

---

## ๐Ÿ“ API Endpoints Overview

| Method | Endpoint | Description |
| ------ | ----------------------------- | ----------------------------------- |
| GET | `/services` | Get all services with search/filter |
| GET | `/services/:id` | Get single service by ID |
| POST | `/allServices` | Add new service (protected) |
| PATCH | `/my-service` | Update userโ€™s own service |
| DELETE | `/my-service` | Delete userโ€™s own service |
| GET | `/my-service/:email` | Get services by user email |
| GET | `/featured` | Get top 6 services by review count |
| GET | `/reviews?id=serviceId` | Get reviews for a service |
| POST | `/review` | Post a new review (protected) |
| PATCH | `/review/:id` | Update a review and refresh ratings |
| DELETE | `/review/:id` | Delete a review |
| GET | `/my-review?email=user@email` | Get user's reviews |
| GET | `/user?email=user@email` | Get single user |
| POST | `/user` | Create new user |
| GET | `/counts` | Get user, review, service counts |

---

## ๐Ÿ” Firebase Authentication (Admin SDK)

The API uses **Firebase Admin SDK** to verify tokens on protected routes.

- Protected routes use a middleware called `verifyToken`.
- JWT must be sent in the `Authorization` header:

## โš™๏ธ Installation & Setup

- 1. Clone the Repository

- 2. Install Dependencies
`npm install`
- 3. Add .env File
Follow the format above to configure your MongoDB URI and Firebase credentials.

- 4. Start Server

`npm start index.js`

## ๐Ÿ“‚ Folder Structure

```
โ”œโ”€โ”€ index.js # Main server file
โ”œโ”€โ”€ .env # Environment variables
โ”œโ”€โ”€ package.json # Project config
โ””โ”€โ”€ README.md
```