{"id":25790911,"url":"https://github.com/zn-rabby/blog-application","last_synced_at":"2026-04-11T05:36:22.232Z","repository":{"id":271393466,"uuid":"908573880","full_name":"zn-rabby/blog-application","owner":"zn-rabby","description":"Blog application server","archived":false,"fork":false,"pushed_at":"2025-01-07T13:22:37.000Z","size":250,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-17T05:40:32.751Z","etag":null,"topics":["express","jwt","mongoose","typescript"],"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/zn-rabby.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-26T12:03:59.000Z","updated_at":"2025-01-23T13:29:59.000Z","dependencies_parsed_at":"2025-01-07T13:20:36.684Z","dependency_job_id":"4e7217bb-dad9-4b47-bede-52fe55f3ffc2","html_url":"https://github.com/zn-rabby/blog-application","commit_stats":null,"previous_names":["rabby-web/blog-application","zn-rabby/blog-application"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zn-rabby/blog-application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zn-rabby%2Fblog-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zn-rabby%2Fblog-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zn-rabby%2Fblog-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zn-rabby%2Fblog-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zn-rabby","download_url":"https://codeload.github.com/zn-rabby/blog-application/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zn-rabby%2Fblog-application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31670374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","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":["express","jwt","mongoose","typescript"],"created_at":"2025-02-27T12:39:18.408Z","updated_at":"2026-04-11T05:36:22.177Z","avatar_url":"https://github.com/zn-rabby.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blog Application Server\r\n\r\n## Overview\r\n\r\nThis project provides the backend for a blogging platform where users can write, update, and delete blogs. It includes secure authentication, role-based access control, and a public API for viewing blogs with search, sort, and filter functionalities.\r\n\r\n---\r\n\r\n## Features\r\n\r\n### User Roles\r\n\r\n- **Admin**:\r\n  - Manually created in the database with predefined credentials.\r\n  - Can delete any blog.\r\n  - Can block any user by updating a property `isBlocked`.\r\n  - Cannot update any blog.\r\n- **User**:\r\n  - Can register and log in.\r\n  - Can create, update, and delete their own blogs.\r\n  - Cannot perform admin actions.\r\n\r\n### Authentication \u0026 Authorization\r\n\r\n- Secure user authentication using JWT.\r\n- Role-based access control for Admin and User roles.\r\n\r\n### Blog API\r\n\r\n- Public API for fetching blogs:\r\n  - Includes search, sort, and filter functionalities.\r\n  - Provides blog title, content, author details, and more.\r\n\r\n---\r\n\r\n## Technologies Used\r\n\r\n- **TypeScript**\r\n- **Node.js**\r\n- **Express.js**\r\n- **MongoDB with Mongoose**\r\n\r\n---\r\n\r\n## Installation\r\n\r\n### Steps\r\n\r\n1. Clone the repository:\r\n\r\n   ```bash\r\n   git clone https://github.com/rabby-web/blog-application.git\r\n   ```\r\n\r\n2. Install dependencies:\r\n   ```bash\r\n   npm install\r\n   ```\r\n3. Create an `.env` file in the root directory and configure the environment variables:\r\n   ```env\r\n   PORT=5000\r\n   MONGO_URI=mongodb://localhost:27017/blog-platform\r\n   JWT_SECRET=jwt_access_secret\r\n   ```\r\n4. Start the development server:\r\n   ```bash\r\n   npm run start:dev\r\n   ```\r\n5. Access the API at Vercel `https://blog-application-seven-xi.vercel.app/`.\r\n6. Access the API at Localhost `http://localhost:5000/`.\r\n\r\n---\r\n\r\n## API Endpoints\r\n\r\n### 1. Authentication\r\n\r\n- **POST** `/api/auth/register`\r\n- **POST** `/api/auth/login`\r\n\r\n### 2. Blog Management\r\n\r\n- **POST** `/api/blogs`\r\n- **PATCH** `/api/blogs/:id`\r\n- **DELETE** `/api/blogs/:id`\r\n- **GET** `/api/blogs`\r\n\r\n### 3. Admin Actions\r\n\r\n- **PATCH** `/api/admin/users/:userId/block`\r\n- **DELETE** `/api/admin/blogs/:id`\r\n\r\n---\r\n\r\n## Error Handling\r\n\r\nA consistent error response format is used across all API endpoints:\r\n\r\n```json\r\n{\r\n  \"success\": false,\r\n  \"message\": \"Error message\",\r\n  \"statusCode\": 400,\r\n  \"error\": { \"details\": \"Additional details\" },\r\n  \"stack\": \"Stack trace\"\r\n}\r\n```\r\n\r\n## Server live link\r\n\r\n[Blogs Website](https://blog-application-seven-xi.vercel.app/)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzn-rabby%2Fblog-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzn-rabby%2Fblog-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzn-rabby%2Fblog-application/lists"}