{"id":22600565,"url":"https://github.com/zilean12/restful-api","last_synced_at":"2026-04-28T16:32:14.526Z","repository":{"id":266931767,"uuid":"897460994","full_name":"Zilean12/RESTful-API","owner":"Zilean12","description":"MERN Stack RESTful API with Authentication","archived":false,"fork":false,"pushed_at":"2024-12-07T04:00:00.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T20:17:13.260Z","etag":null,"topics":["authentication","crud-application","mern-stack","mongodb","nodejs","postman"],"latest_commit_sha":null,"homepage":"","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/Zilean12.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":"2024-12-02T17:06:52.000Z","updated_at":"2024-12-07T04:01:26.000Z","dependencies_parsed_at":"2024-12-07T04:24:48.039Z","dependency_job_id":"c07ad3fa-fb98-4f09-b7b6-24d94500517f","html_url":"https://github.com/Zilean12/RESTful-API","commit_stats":null,"previous_names":["zilean12/restful-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilean12%2FRESTful-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilean12%2FRESTful-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilean12%2FRESTful-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilean12%2FRESTful-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zilean12","download_url":"https://codeload.github.com/Zilean12/RESTful-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246093178,"owners_count":20722403,"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":["authentication","crud-application","mern-stack","mongodb","nodejs","postman"],"created_at":"2024-12-08T12:10:29.147Z","updated_at":"2026-04-28T16:32:14.497Z","avatar_url":"https://github.com/Zilean12.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 MERN Stack RESTful API with Authentication\n\n## 📋 Project Overview\n\nA comprehensive RESTful API built with the MERN stack, offering robust authentication and user management features.\n\n## ✨ Key Features\n\n- 🔐 **Secure Authentication**\n  - User registration and login\n  - JWT-based token authentication\n  - Secure password encryption\n  - Protected routes\n\n- 🛡️ **User Management**\n  - Create, Read, Update, and Delete (CRUD) user operations\n  - User profile management\n  - Role-based access control\n\n- 💬 **Comment System**\n  - Add comments to posts\n  - Update and delete own comments\n  - View all comments on posts\n  - Author-based comment authorization\n\n- 🔒 **Security Measures**\n  - JWT token authentication\n  - Bcrypt password hashing\n  - Middleware route protection\n  - Comprehensive error handling\n\n## 🛠️ Technology Stack\n\n**Frontend:**\n- React.js with modern hooks\n- React Router for navigation\n- Axios for API communication\n- Responsive CSS design\n\n**Backend:**\n- Node.js, Express.js\n- Database: MongoDB\n- Authentication: JWT (JSON Web Tokens)\n- Password Encryption: Bcrypt\n\n## 🔧 Prerequisites\n\n- Node.js (v14 or later)\n- MongoDB\n- npm or yarn\n\n## 📦 Installation\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/Zilean12/RESTful-API.git\ncd RESTful-API\n```\n\n### 2. Install Dependencies\n\n```bash\n# Install backend dependencies\nnpm install\n\n# Install frontend dependencies\ncd client \u0026\u0026 npm install\ncd ..\n```\n\n### 3. Configure Environment Variables\n\nCreate a `.env` file in the root directory:\n\n```env\n# Server Configuration\nPORT=3000\nMONGODB_URI=mongodb://localhost:27017/mern-api\nJWT_SECRET=your_very_secret_and_long_random_string\nNODE_ENV=development\n\n# Google OAuth Configuration\nGOOGLE_CLIENT_ID=your_google_oauth_client_id\nGOOGLE_CLIENT_SECRET=your_google_oauth_client_secret\nGOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback\n```\n\n### Google OAuth Setup\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Navigate to \"APIs \u0026 Services\" \u003e \"Credentials\"\n4. Create a new OAuth 2.0 Client ID\n5. Set up the authorized redirect URIs\n6. Copy the Client ID and Client Secret into your `.env` file\n\n### 4. Run the Application\n\n### 4. Run the Application\n\n**Development (with both frontend and backend):**\n```bash\n# Run both frontend and backend concurrently\nnpm run dev:full\n```\n\n**Backend only:**\n```bash\nnpm run dev\n```\n\n**Frontend only:**\n```bash\nnpm run client\n```\n\n**Production:**\n```bash\n# Build frontend\nnpm run build\n\n# Start production server\nnpm start\n```\n\nThe frontend will be available at `http://localhost:3001` and backend at `http://localhost:3000` in development.\n\n## 🎨 Frontend Features\n\n- **Modern React App** with functional components and hooks\n- **Responsive Design** that works on all devices\n- **Authentication UI** with login and registration forms\n- **Protected Routes** with automatic redirects\n- **User Dashboard** showing user management features\n- **Profile Management** with update and delete functionality\n- **Google OAuth Integration** (configure in .env)\n- **Error Handling** with user-friendly messages\n\n## 🌐 API Endpoints\n\n### Authentication Endpoints\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| `POST` | `/api/auth/register` | Register a new user |\n| `POST` | `/api/auth/login` | User login |\n| `POST` | `/api/auth/logout` | User logout |\n| `GET` | `/api/auth/me` | Get user profile |\n\n### User Management Endpoints\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| `GET` | `/api/users/` | Get all users (protected) |\n| `GET` | `/api/users/:id` | Get user by ID (protected) |\n| `PUT` | `/api/users/:id` | Update user (protected) |\n| `DELETE` | `/api/users/:id` | Delete user (protected) |\n\n### Comment Management Endpoints\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| `GET` | `/api/posts/:postId/comments` | Get all comments for a post (protected) |\n| `POST` | `/api/posts/:postId/comments` | Create a new comment on a post (protected) |\n| `PUT` | `/api/posts/:postId/comments/:id` | Update a comment (protected) |\n| `DELETE` | `/api/posts/:postId/comments/:id` | Delete a comment (protected) |\n\n**Note:** All comment endpoints require authentication. Users can only update or delete their own comments.\n\n## 🧪 Postman Testing\n\n1. Register a new user\n2. Login and receive JWT token\n3. Use token in Authorization header for protected routes\n   - Header Key: `Authorization`\n   - Header Value: `Bearer your_jwt_token`\n\n### Testing Comments System\n\n1. Create a post first using `POST /api/posts`\n2. Add comments to the post using `POST /api/posts/:postId/comments`\n3. View comments using `GET /api/posts/:postId/comments`\n4. Update your comments using `PUT /api/posts/:postId/comments/:id`\n5. Delete your comments using `DELETE /api/posts/:postId/comments/:id`\n\n## 🛡️ Security Features\n\n- JWT-based authentication\n- Password hashing with bcrypt\n- Protected routes\n- Token-based logout\n- Comprehensive error handling middleware\n\n## 🚨 Troubleshooting\n\n- Ensure MongoDB is running\n- Verify `.env` file configuration\n- Check Node.js and npm versions\n\n## 📜 License\n\nThis project is open-source and available under the MIT License.\n\n\n## 🌟 Contributing\n\nContributions are welcome! Please check the GitHub repository for contribution guidelines.\n\n---\n\n**Happy Coding! 👨‍💻👩‍💻**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilean12%2Frestful-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzilean12%2Frestful-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilean12%2Frestful-api/lists"}