{"id":24760728,"url":"https://github.com/tariqul420/kutto-server","last_synced_at":"2026-04-02T18:53:02.414Z","repository":{"id":273532325,"uuid":"920024060","full_name":"tariqul420/Kutto-Server","owner":"tariqul420","description":"Kutto Server is the backend for the Kutto platform, built with Node.js and Express. It manages user authentication, pet listings, and communication for a seamless pet adoption experience.","archived":false,"fork":false,"pushed_at":"2025-02-19T05:26:26.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T11:45:49.462Z","etag":null,"topics":["cookieparser","cors","dotenv","jwt","mongodb","morgan","nodemailer","stripe"],"latest_commit_sha":null,"homepage":"https://kutto-0.web.app","language":"JavaScript","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/tariqul420.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}},"created_at":"2025-01-21T12:37:33.000Z","updated_at":"2025-03-15T11:31:06.000Z","dependencies_parsed_at":"2025-01-21T13:41:24.402Z","dependency_job_id":"e103ef82-7fc4-4513-9b20-e086f9b0bb2c","html_url":"https://github.com/tariqul420/Kutto-Server","commit_stats":null,"previous_names":["tariqul420/kutto-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariqul420%2FKutto-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariqul420%2FKutto-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariqul420%2FKutto-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariqul420%2FKutto-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tariqul420","download_url":"https://codeload.github.com/tariqul420/Kutto-Server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245097841,"owners_count":20560317,"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","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":["cookieparser","cors","dotenv","jwt","mongodb","morgan","nodemailer","stripe"],"created_at":"2025-01-28T18:18:58.471Z","updated_at":"2025-12-30T22:32:34.003Z","avatar_url":"https://github.com/tariqul420.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kutto Backend\r\n\r\nThis is the backend server for the **Kutto** application, a pet adoption platform. The server handles authentication, pet management, adoption requests, donation campaigns, and other backend functionalities using `Node.js`, `Express.js`, `MongoDB`, and `JWT`.\r\n\r\n## 🚀 Project Overview\r\n\r\n- **Framework**: Node.js\r\n- **Database**: MongoDB\r\n- **Authentication**: JWT with cookies\r\n- **Environment Variables**: Managed using `.env` file\r\n\r\n## 🚀 Live Links\r\n\r\n- **Client Repo:** [_github/tariqul420/Kutto_](https://github.com/tariqul420/Kutto.git)\r\n- **Server Repo:** This repository serves as the main `Kutto` platform and includes the `backend` setup.\r\n- **Live Site:** [_Kutto.com_](https://kutto-0.web.app)\r\n- **Alternate Live Site:** [_Kutto-2.com_](https://kutto-0.firebaseapp.com)\r\n\r\n---\r\n\r\n## 📜 Features\r\n\r\n### 🔐 Authentication\r\n\r\n- JWT-based authentication.\r\n- Secure cookie storage for tokens.\r\n- Login and logout endpoints.\r\n\r\n### 🐾 Pet Management\r\n\r\n- Add, update, delete, and fetch pets.\r\n- Fetch pets based on adoption status.\r\n\r\n### 🏠 Adoption Requests\r\n\r\n- Request adoption for pets.\r\n- Fetch and manage adoption requests.\r\n\r\n### 💰 Donation Management\r\n\r\n- Create, update, and manage donation campaigns.\r\n- Fetch donation history and manage refunds.\r\n\r\n### 🔧 Middleware\r\n\r\n- `verifyToken`: Verifies the JWT token for protected routes.\r\n- `verifyAdmin`: Ensures that the user is an admin before accessing certain endpoints.\r\n\r\n---\r\n\r\n## 🛠 Technology Used\r\n\r\n- **Node.js**: Backend framework.\r\n- **Express.js**: Web server.\r\n- **MongoDB**: Database.\r\n- **JWT**: Authentication.\r\n- **dotenv**: Environment variable management.\r\n- **cors**: Cross-Origin Resource Sharing.\r\n- **cookie-parser**: For handling cookies.\r\n\r\n---\r\n\r\n## 🔗 Endpoints\r\n\r\n### Common Endpoints\r\n\r\n- **POST `/jwt`**: Generate JWT token.\r\n- **GET `/logout`**: Clear JWT token.\r\n- **POST `/users`**: Save User Mongodb\r\n\r\n### Common \u0026 Secure\r\n\r\n- **PATCH `/users/:email`**: Update user profile.\r\n- **GET `/users/role/:email`**: Get user role.\r\n- **POST `/create-payment-intent`**: Create payment intent.\r\n- **POST `/save-payment-history`**: Save payment history.\r\n\r\n### Public Endpoints\r\n\r\n- **GET `/all-pets`**: Fetch all pets.\r\n- **GET `/donation-campaign`**: Fetch all donation campaign.\r\n- **GET `/pets/:id`**: Fetch single pet details.\r\n- **GET `/donation-details/:id`**: Fetch single donation details.\r\n- **GET `/suggestion-donation-campaign`**: Fetch 3 suggestion donation campaign.\r\n- **GET `/pets-category/:category`**: Fetch all single pet category.\r\n\r\n### Protected Endpoints User (Require JWT)\r\n\r\n- **POST `/add-pet`**: Add a new pet to the database.\r\n- **GET `/my-pets/:email`**: Get all pets added by a specific user.\r\n- **PATCH `/adopt-pet/:id`**: Update the adoption status of a pet.\r\n- **POST `/adoption-request`**: Post an adoption request for a pet.\r\n- **GET `/adoption-request/:email`**: Get all adoption requests for a specific user.\r\n- **POST `/create-donation`**: Create a new donation campaign.\r\n- **GET `/my-donation/:email`**: Get all donation campaigns created by a specific user.\r\n- **GET `/my-donation-history/:email`**: Get the donation history of a specific user.\r\n- **PATCH `/refund-donation/:id`**: Refund the donation amount for a specific campaign.\r\n- **PUT `/update-donation-campaign/:id`**: Update details of a donation campaign.\r\n\r\n### Admin Endpoints (Require Admin Role)\r\n\r\n- **GET `/users`**: Get all users (except the current logged-in user).\r\n- **PATCH `/user-role-update/:email`**: Update the role of a user to \"admin\" and set their status to \"verified\".\r\n- **GET `/all-pet-admin`**: Get all pet data for admin (including adoption status).\r\n- **PATCH `/adoption-status-admin/:id`**: Update the adoption status of a pet (admin only).\r\n- **GET `/all-donation-campaign-admin`**: Get all donation campaigns for admin.\r\n- **DELETE `/donation-campaign-admin/:id`**: Delete a donation campaign (admin only).\r\n\r\n### Admin \u0026 User Both Endpoints\r\n\r\n- **PATCH `/donation-status/:id`**: Update the status of a donation campaign (User \u0026 Admin).\r\n- **DELETE `/delete-pet/:id`**: Delete a pet from the database (User \u0026 Admin).\r\n- **PUT `/update-pets/:id`**: Update pet details (User \u0026 Admin).\r\n\r\n---\r\n\r\n## 🛠 Installation\r\n\r\n### Prerequisites\r\n\r\n- **Node.js** and **npm** installed\r\n- **MongoDB** connection string\r\n\r\n---\r\n\r\n### Client Side Setup\r\n\r\n1. Clone the client-side repository:\r\n\r\n   ```bash\r\n   git clone https://github.com/tariqul420/Kutto.git\r\n   cd Kutto\r\n   ```\r\n\r\n2. Install dependencies:\r\n\r\n   ```bash\r\n   npm install\r\n   ```\r\n\r\n3. Start the development server:\r\n   ```bash\r\n   npm run dev\r\n   ```\r\n4. Open the project in a code editor:\r\n   ```bash\r\n   code .\r\n   ```\r\n5. Add the `.env` file in the root directory and include the following environment variables:\r\n   ```bash\r\n   VITE_API_KEY=_____________________________\r\n   VITE_AUTH_DOMAIN=_________________________\r\n   VITE_PROJECT_ID=__________________________\r\n   VITE_STORAGE_BUCKET=______________________\r\n   VITE_MESSAGE_SENDER_ID=___________________\r\n   VITE_APP_ID=______________________________\r\n   VITE_MEASUREMENT_ID=______________________\r\n   VITE_IMGBB_API_KEY=_______________________\r\n   VITE_SERVER_API_URL=______________________\r\n   VITE_STRIPE_CLIENT_SECRET=________________\r\n   ```\r\n   \u003e **Note:** Replace the `VITE_API_KEY` and `VITE_AUTH_DOMAIN`, along with other placeholders, with actual values.\r\n\r\n### Server Side Setup\r\n\r\n1. Clone the client-side repository:\r\n\r\n   ```bash\r\n   git clone https://github.com/tariqul420/Kutto-Server.git\r\n   cd Kutto-Server\r\n   ```\r\n\r\n2. Install dependencies:\r\n\r\n   ```bash\r\n   npm install\r\n   ```\r\n\r\n3. Start the server:\r\n\r\n   ```bash\r\n   node index.js\r\n   ```\r\n\r\n   --- OR ---\r\n\r\n   ```bash\r\n   nodemon index.js\r\n   ```\r\n\r\n4. Open the project in a code editor:\r\n   ```bash\r\n   code .\r\n   ```\r\n5. Add the `.env` file in the root directory and include the following environment variables:\r\n   ```bash\r\n   DATABASE_USERNAME=________________________\r\n   DATABASE_PASSWORD=________________________\r\n   ACCESS_TOKEN_SECRET=______________________\r\n   STRIPE_SECRET_KEY=________________________\r\n   ```\r\n   \u003e **Note:** Replace the `index.js` file's `mongo_uri` and the `.env` file's `DATABASE_USERNAME`, `DATABASE_PASSWORD`, `ACCESS_TOKEN_SECRET` and `STRIPE_SECRET_KEY` with actual values.\r\n\r\n## 🧑‍💻 Authors\r\n\r\n- Tariqul Islam (Lead Developer)\r\n- Lead Developer \u0026 Maintainer\r\n- Connect with me on [_GitHub_](https://github.com/tariqul420) \u0026 [_Facebook_](https://www.facebook.com/tariqul.islam.fb)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftariqul420%2Fkutto-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftariqul420%2Fkutto-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftariqul420%2Fkutto-server/lists"}