{"id":31585095,"url":"https://github.com/sakhawat71/reviewhub-server","last_synced_at":"2026-05-09T03:32:04.865Z","repository":{"id":317862724,"uuid":"991400164","full_name":"Sakhawat71/ReviewHub-Server","owner":"Sakhawat71","description":"Product Review Platform","archived":false,"fork":false,"pushed_at":"2025-10-03T13:21:07.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-03T15:27:06.945Z","etag":null,"topics":["cloudinary","exrpessjs","jwt","nodejs","postgresql","prisma-orm","psql","typescript","zod-validation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sakhawat71.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-27T15:06:57.000Z","updated_at":"2025-10-03T13:21:12.000Z","dependencies_parsed_at":"2025-10-03T15:28:03.460Z","dependency_job_id":"7ed943e5-466c-4a2e-b33a-267dada6b7d8","html_url":"https://github.com/Sakhawat71/ReviewHub-Server","commit_stats":null,"previous_names":["sakhawat71/reviewhub-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Sakhawat71/ReviewHub-Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sakhawat71%2FReviewHub-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sakhawat71%2FReviewHub-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sakhawat71%2FReviewHub-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sakhawat71%2FReviewHub-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sakhawat71","download_url":"https://codeload.github.com/Sakhawat71/ReviewHub-Server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sakhawat71%2FReviewHub-Server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278547776,"owners_count":26004772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudinary","exrpessjs","jwt","nodejs","postgresql","prisma-orm","psql","typescript","zod-validation"],"created_at":"2025-10-06T01:27:29.621Z","updated_at":"2025-10-06T01:27:31.476Z","avatar_url":"https://github.com/Sakhawat71.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ReviewHub API Server\n\n``` Main Git Repo https://github.com/abumahid/ReviewHub-Server/graphs/contributors ```\n\n## 🚀 Project Overview\n\nThis is a backend server application built with Node.js, Express, and Prisma ORM. The application provides authentication and authorization services with role-based access control (ADMIN, COMPANY, USER). It includes features like user registration, login, profile management, and password management.\n\n## ✨ Key Features\n\n- **Authentication \u0026 Authorization**\n    - User registration with role-based accounts (Admin, Company, User)\n    - Secure login with JWT authentication\n    - Role-based access control\n    - Token refresh mechanism\n    - Password change functionality\n\n- **Security**\n    - Password hashing with bcrypt\n    - JWT token-based authentication\n    - HTTP-only cookies for refresh tokens\n\n- **Error Handling**\n    - Global error handling middleware\n    - Custom error classes\n    - Validation using Zod\n\n- **Database**\n    - Prisma ORM for database operations\n    - Transaction support for data integrity\n\n## 🛠️ Getting Started\n\n### 1. Clone the Repository\n\n\nA powerful review management platform with comprehensive API for creating, managing, and interacting with reviews.\n\n[![Live Demo](https://img.shields.io/badge/Live-Demo-brightgreen)](https://your-live-url-here)\n[![TypeScript](https://img.shields.io/badge/TypeScript-4.9.5-blue)](https://www.typescriptlang.org/)\n[![Express](https://img.shields.io/badge/Express-4.18.2-lightgrey)](https://expressjs.com/)\n[![Prisma](https://img.shields.io/badge/Prisma-4.12.0-blueviolet)](https://www.prisma.io/)\n[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-14.0-blue)](https://www.postgresql.org/)\n\n## 📋 Table of Contents\n\n- [🌟 ReviewHub](#-reviewhub)\n  - [📋 Table of Contents](#-table-of-contents)\n  - [✨ Features](#-features)\n  - [🛠 Tech Stack](#-tech-stack)\n  - [📚 API Documentation](#-api-documentation)\n    - [🔐 Authentication](#-authentication)\n      - [Create User](#create-user)\n\n## ✨ Features\n\n- **User Authentication** - Secure signup and login functionality\n- **Review Management** - Create, read, update, and delete reviews\n- **Categorization** - Organize reviews by categories\n- **Comments** - Allow users to comment on reviews\n- **Voting System** - Upvote or downvote reviews\n- **Premium Content** - Monetize premium reviews with payment integration\n- **Admin Controls** - Moderation tools for review approval\n\n## 🛠 Tech Stack\n\n- **Backend**: Node.js, Express.js\n- **Language**: TypeScript\n- **Database**: PostgreSQL.\n- **ORM**: Prisma\n- **Authentication**: JWT (JSON Web Tokens)\n- **Deployment**: Render\n\n## 📚 API Documentation\n\nBase URL: `https://assignment-9-server-7r96.onrender.com/api`\n\n### 🔐 Authentication\n\n#### Create User\n\n### Improving Your GitHub README\n\nI'll create an enhanced version of your README with better organization, formatting, and visual appeal.\n\n```markdown project=\"ReviewHub\" file=\"README.md\"\n...\n```\n\n**Request Body:**\n\n```json\n{\n  \"name\": \"John Doe\",\n  \"email\": \"john@example.com\",\n  \"password\": \"securePassword123\"\n}\n```\n\n#### Login User\n\n```plaintext\nPOST /auth/login\n```\n\n**Request Body:**\n\n```json\n{\n  \"email\": \"john@example.com\",\n  \"password\": \"securePassword123\"\n}\n```\n\n### 📂 Categories\n\n#### Create Category (Admin only)\n\n```plaintext\nPOST /category/create-category\n```\n\n**Request Body:**\n\n```json\n{\n  \"name\": \"Gadgets\"\n}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {admin_token}`\n\n#### Get All Categories\n\n```plaintext\nGET /category\n```\n\n#### Get Single Category\n\n```plaintext\nGET /category/{categoryId}\n```\n\n### 📝 Reviews\n\n#### Create Review\n\n```plaintext\nPOST /review/create-review\n```\n\n**Request Body:**\n\n```json\n{\n  \"title\": \"Amazing Noise Cancelling Headphones\",\n  \"description\": \"These headphones provide crystal clear sound and outstanding noise cancellation. Battery life is also impressive with over 30 hours of playback.\",\n  \"rating\": 5,\n  \"purchaseSource\": \"BestBuy\",\n  \"imageUrls\": [\n    \"https://example.com/images/headphone-front.jpg\",\n    \"https://example.com/images/headphone-side.jpg\"\n  ],\n  \"excerp\": \"Top-notch noise cancelling headphones with long battery life.\",\n  \"isPremium\": true,\n  \"price\": 7.99,\n  \"isPublished\": false,\n  \"categoryId\": \"8b00f961-4a54-4419-bd37-bf149d163e34\"\n}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n#### Get All Reviews\n\n```plaintext\nGET /review\n```\n\n**Query Parameters:**\n\n- `searchTerm` - Search by text\n- `page` - Page number for pagination\n- `limit` - Items per page\n- `categoryId` - Filter by category\n- `isPaid` - Filter by payment status (true/false/\"\")\n- `isPublished` - Filter by publication status (true/false/\"\")\n\n#### Get Single Review\n\n```plaintext\nGET /review/{reviewId}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n#### Get My Reviews\n\n```plaintext\nGET /review/my-reviews\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n#### Get Pending Reviews (Admin only)\n\n```plaintext\nGET /review/pending-reviews\n```\n\n**Headers:**\n\n- `Authorization: Bearer {admin_token}`\n\n#### Publish Review (Admin only)\n\n```plaintext\nPATCH /review/make-review-published/{reviewId}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {admin_token}`\n\n#### Update Review\n\n```plaintext\nPATCH /review/update-review/{reviewId}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}` (must be review owner)\n\n#### Delete Review\n\n```plaintext\nDELETE /review/delete-review/{reviewId}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}` (must be review owner or admin)\n\n### 💬 Comments\n\n#### Create Comment\n\n```plaintext\nPOST /comment/create-comment\n```\n\n**Request Body:**\n\n```json\n{\n  \"content\": \"This review was very helpful, thank you!\",\n  \"reviewId\": \"de71f985-3a61-4a28-8d05-ad258d656bff\"\n}\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n#### Get My Comments\n\n```plaintext\nGET /comment/my-comments\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n### 👍 Votes\n\n#### Create Vote\n\n```plaintext\nPOST /vote/create-vote\n```\n\n**Request Body:**\n\n```json\n{\n  \"type\": \"UP\",\n  \"reviewId\": \"de71f985-3a61-4a28-8d05-ad258d656bff\"\n}\n```\n\n**Note:** A user can vote on a review only once. Valid vote types are \"UP\" or \"DOWN\".\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n#### Get My Votes\n\n```plaintext\nGET /vote/my-votes\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n### 💰 Payments\n\n#### Make Order\n\n```plaintext\nPOST /payment/make-order/{reviewId}\n```\n\n**Note:** A user can purchase a premium review only once.\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n#### Get My Payments\n\n```plaintext\nGET /payment/my-payments\n```\n\n**Headers:**\n\n- `Authorization: Bearer {user_token}`\n\n## 🚀 Installation\n\n1. **Clone the repository**\n\n```shellscript\ngit clone https://github.com/HumayunKabirSobuj/ReviewHub-Server.git\ncd ReviewHub-Server\n```\n\n2. **Install dependencies**\n\n```shellscript\nnpm install\n```\n\n3. **Set up environment variables**\n   Create a `.env` file in the root directory (see Environment Variables section)\n4. **Run the development server**\n\n```shellscript\nnpm run dev\n```\n\n## 🔑 Environment Variables\n\nCreate a `.env` file in the root directory with the following variables:\n\n```plaintext\n# Database\nDATABASE_URL=your_supabase_api_link\nDIRECT_URL=your_supabase_direct_url\n\n# API\nVITE_API_LINk=your_api_link\nPORT=5000\nENABLE_PRISMA_CACHING=false\n\n# Authentication\nJWT_SECRET=your_jwt_secret\nEXPIRES_IN=1d\nREFRESH_TOKEN_SECRET=your_refresh_token_secret\nREFRESH_TOKEN_EXPIRES_IN=7d\nJWT_REFRESH_SECRET=your_jwt_refresh_secret\nJWT_REFRESH_EXPIRES_IN=7d\n\n# URLs\nBACKEND_API_LINK=your_backend_live_api_link\nCLIENT_LINK=your_frontend_live_link\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n```\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakhawat71%2Freviewhub-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsakhawat71%2Freviewhub-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakhawat71%2Freviewhub-server/lists"}