Eunoia simplifies event planning by integrating services like venues, catering, and photography into a single platform. Accessible via app and web, it features AI-powered recommendations and secure booking.
This project offers APIs for efficient event planning, enabling access to service provider directories, booking services, and user account management. Built with Express.js and tested with Jest, it includes AI-powered recommendations and secure transactions to enhance user experience.
Ensure you have the following installed:
- Node.js
- npm or yarn
-
Clone the repository:
git clone https://github.com/your-username/Eunoia-Backend.git cd Eunoia-Backend
-
Install dependencies:
npm install # or yarn install
-
Start the development server :
npm run dev # or yarn dev
-
The server should now be running at
http://localhost:3000
.
To run the test suite:
npm test
# or
yarn test
-
Endpoint:
api/v1/auth/register
-
Method:
Post
-
Body:
name
(string): user nameemail
(string): user emailpassword
(string): user passwordpasswordConfirm
(string): user confirm passwordrole
(string): user role (user/serviceProvider)
-
Example Request:
curl "http://localhost:3000/api/v1/auth/register"
-
Example Response:
[ { "status": "success", "token": "JWT TOKEN" } ]
-
Endpoint:
api/v1/auth/login
-
Method:
Post
-
Body:
email
(string): user emailpassword
(string): user password
-
Example Request:
curl "http://localhost:3000/api/v1/auth/login"
-
Example Response:
[ { "status": "success", "token": "JWT TOKEN" } ]
-
Endpoint:
api/v1/auth/logout
-
Method:
Post
-
Body:
- empty
-
Example Request:
curl "http://localhost:3000/api/v1/auth/logout"
-
Example Response:
[ { "status": "success" } ]
-
Endpoint:
api/v1/auth/forgotPassword
-
Method:
Post
-
Body:
email
(string): user email
-
Example Request:
curl "http://localhost:3000/api/v1/auth/forgotPassword"
-
Example Response:
[ { "status": "Success", "message": "Reset code sent to email" } ]
-
Endpoint:
api/v1/auth/forgotPassword
-
Method:
Post
-
Body:
otp
(number): The code sent to the email
-
Example Request:
curl "http://localhost:3000/api/v1/auth/verfiyCode"
-
Example Response:
[ { "status": "Success", "messgae": "Your Code has been successfully verified. You can now proceed to reset your password." } ]
-
Endpoint:
api/v1/auth/resetPassword
-
Method:
Patch
-
Body:
email
(string): your emailnewPassword
(string): your new password
-
Example Request:
curl "http://localhost:3000/api/v1/auth/resetPassword"
-
Example Response:
[ { "status": "success", "token": "JWT TOKEN" } ]
-
Endpoint:
api/v1/services
-
Method:
POST
-
Body:
businessName
(String)about
(string)location
(string)businessCategory
(string)phoneNumber
(number)avatar
(FormData)images
(FormData):array of imagesimageCover
(FormData)
-
Example Request:
curl "http://127.0.0.1:3000/api/v1/services/"
-
Example Response:
{ "status": "success", "message": "Service Profile created successfully", "data": { "_id": "660878526adb0cb6ece59904", "businessName": "The Garden", "about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.", "location": "Ismailia", "businessCategory": "Venues", "phoneNumber": "01234567890", "avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg", "imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg", "images": [ "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg" ], "owner": "660860be6adb0cb6ece598fe", "createdAt": "2024-03-30T20:38:43.001Z", "updatedAt": "2024-06-21T13:32:59.867Z", "ratingsAverage": 4, "ratingsQuantity": 2, "id": "660878526adb0cb6ece59904" } }
-
Endpoint:
api/v1/services
-
Method:
GET
-
Query Parameters:
page
(number): the number of page you want to return.limit
(number): the number of document you want to return in the page.sort
(string): (ratingsQuantity|ratingsAverage|updatedAt|updatedAt)limitFields
(string): name of field you want to return in the response (_id|businessName|about|location|businessCategory|phoneNumber|images|owner|ratingsQuantity|ratingsAverage)ratingsAverage
return the services which have ratingsAverage[gte(greater than or equal) || gt(greater than) || ls(less than ) || lte(less than or equal) ]:(number)sort
(field name): sort by filed name like ratingsAverage or ratingsquantity
-
Example Request:
curl "http://127.0.0.1:3000/api/v1/services/?page=2&limit=5&ratingsAverage[gte]=4.3&filter=DJs&sort=createdAt"
-
Example Response:
{ "results": 7, "paginationResult": { "currntPage": 1, "limit": 50, "numberOfPages": 1 }, "data": [ { "_id": "660878526adb0cb6ece59904", "businessName": "The Garden", "about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.", "location": "Ismailia", "businessCategory": "Venues", "phoneNumber": "01234567890", "avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg", "imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg", "images": [ "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg" ], "owner": "660860be6adb0cb6ece598fe", "createdAt": "2024-03-30T20:38:43.001Z", "updatedAt": "2024-06-21T13:32:59.867Z", "ratingsAverage": 4, "ratingsQuantity": 2, "id": "660878526adb0cb6ece59904" } // more services ... ] }
-
Endpoint:
api/v1/services/:id
-
Method:
GET
-
Query params:
id
(mongoID): mongoId of exist document
-
Example Request:
curl "http://127.0.0.1:3000/api/v1/services/660878526adb0cb6ece59904"
-
Example Response:
{ "data": { "_id": "660878526adb0cb6ece59904", "businessName": "The Garden", "about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.", "location": "Ismailia", "businessCategory": "Venues", "phoneNumber": "01234567890", "avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg", "imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg", "images": [ "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg", "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673192/Albums/serviceProfile/Albums0-2e6d3f3e-c654-4fc2-a0f0-64ab474406dc.jpg" ], "owner": "660860be6adb0cb6ece598fe", "createdAt": "2024-03-30T20:38:43.001Z", "updatedAt": "2024-06-21T13:32:59.867Z", "__v": 5, "ratingsAverage": 4, "ratingsQuantity": 2, "reviews": [ { "_id": "662aa6131bef1b61ca7c3e8e", "title": "amazing service\n", "ratings": 3, "user": { "_id": "6612f57ad4ff84c0ed4acced", "name": "omar ", "avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1713651559/avatar.jpg" }, "service": "660878526adb0cb6ece59904", "createdAt": "2024-04-25T18:50:59.017Z", "updatedAt": "2024-04-25T18:50:59.017Z", "__v": 0 }, { "_id": "6675810af4e1130ec348b254", "title": "", "ratings": 5, "user": { "_id": "6674a92b8217a177b6921aa0", "name": "Ali Nour", "avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1718922031/ProfilePicture/avatar/7219325b-667c-47db-a7f1-b25128955cc0.jpg" }, "service": "660878526adb0cb6ece59904", "createdAt": "2024-06-21T13:32:58.550Z", "updatedAt": "2024-06-21T13:32:58.550Z", "__v": 0 } ], "packages": [], "id": "660878526adb0cb6ece59904" } }
-
Endpoint:
api/v1/services/:id
-
Method:
DELETE
-
Query params:
id
(mongoID): mongoId of exist document (You should be the owner of the service to delete it)
-
Example Request:
curl "http://127.0.0.1:3000/api/v1/services/660878526adb0cb6ece59904"
-
Example Response:
{}
-
Endpoint:
api/v1/services/:id
-
Method:
PATCH
-
Query params:
id
(mongoID): mongoId of exist document (You should be the owner of the service to delete it)
-
Body:
-
businessName
:(String) -
about
:(String) -
images
:(formData) -
location
:(String) -
businessCategory
:(String) -
phoneNumber
:(number) -
avatar
:(formData) -
imageCover
:(formData) -
latitude
:(number) -
longitude
:(number) -
Example Request:
curl "http://127.0.0.1:3000/api/v1/services/660878526adb0cb6ece59904"
-
Example Response:
{ "data": { "_id": "660878526adb0cb6ece59904", "businessName": "The Garden", "about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.", "location": "Ismailia", "businessCategory": "Venues", "phoneNumber": "01234567890", "avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg", "imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg", "images": [ "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg", "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673192/Albums/serviceProfile/Albums0-2e6d3f3e-c654-4fc2-a0f0-64ab474406dc.jpg" ], "__v": 5, "ratingsAverage": 4, "ratingsQuantity": 2 } }
You can see all API docs here
- Postman Docs will be avaliable soon.
Here's the project structure based on the provided image:
eunoia-backend/
βββ **tests**/
β βββ service.test.js
βββ src/
β βββ config/
β β βββ db.js
β βββ controllers/
β β βββ authController.js
β β βββ errorController.js
β β βββ handelFactory.js
β β βββ orderController.js
β β βββ reviewController.js
β β βββ serviceController.js
β β βββ userController.js
β β βββ packageController.js
β β βββ requestController.js
β β βββ wishlistController.js
β βββ middlewares/
β β βββ uploadImageMiddleware.js
β β βββ emailMiddleware.js
β β βββ validatorMiddleware.js
β β βββ verifyPaymobRequest.js
β βββ models/
β β βββ orderModel.js
β β βββ packageModel.js
β β βββ requestModel.js
β β βββ reviewModel.js
β β βββ serviceModel.js
β β βββ userModel.js
β βββ routes/
β β βββ authRoutes.js
β β βββ orderRoutes.js
β β βββ packageRoutes.js
β β βββ requestRoutes.js
β β βββ reviewRoutes.js
β β βββ serviceRoutes.js
β β βββ userRoutes.js
β β βββ welcomeRoutes.js
β β βββ wishlistRoutes.js
β βββ utils/
β β βββ paymob/
β β β βββ authenticate.js
β β β βββ checkout.js
β β βββ validators/
β β β βββ packageValidator.js
β β β βββ requestValidator.js
β β β βββ reviewValidator.js
β β β βββ serviceValidator.js
β β βββ apiFeatures.js
β β βββ appError.js
β β βββ catchAsync.js
β β βββ cloudinary.js
β β βββ createToken.js
β β βββ logger.js
β β βββ paymob.js
β β βββ redis.js
β βββ app.js
β βββ server.js
βββ views/
β βββ email/
β β βββ \_style.pug
β β βββ baseEmail.pug
β β βββ passwordChanged.pug
β β βββ passwordReset.pug
β β βββ requestAccepted.pug
β β βββ requestDecline.pug
β β βββ welcome.pug
β βββ index.pug
βββ .env
βββ app.js
βββ server.js
βββ .gitignore
βββ package.json
βββ README.md
This project is licensed under the MIT License. See the LICENSE file for details.
This README provides a comprehensive guide for setting up, running, and testing the project, as well as detailed API documentation and project structure information.