{"id":23402643,"url":"https://github.com/emam-bokhari/blog-server","last_synced_at":"2026-04-04T22:31:43.637Z","repository":{"id":269170634,"uuid":"905651422","full_name":"Emam-Bokhari/Blog-Server","owner":"Emam-Bokhari","description":"This repository contains a Blog application server site codebase. It allows users to create and manage their own blog posts, and advanced filtering and sorting for a smooth blogging experience.","archived":false,"fork":false,"pushed_at":"2024-12-21T12:54:48.000Z","size":143,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T04:44:18.865Z","etag":null,"topics":["bearer-token","expressjs","jwt","mongoose","typescript"],"latest_commit_sha":null,"homepage":"https://blogs-wheat-six.vercel.app","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/Emam-Bokhari.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-19T08:59:49.000Z","updated_at":"2024-12-21T12:54:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6bd28a6-e6b5-44b5-964a-f794647d7b6c","html_url":"https://github.com/Emam-Bokhari/Blog-Server","commit_stats":null,"previous_names":["emam-bokhari/blog-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Emam-Bokhari/Blog-Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emam-Bokhari%2FBlog-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emam-Bokhari%2FBlog-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emam-Bokhari%2FBlog-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emam-Bokhari%2FBlog-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Emam-Bokhari","download_url":"https://codeload.github.com/Emam-Bokhari/Blog-Server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emam-Bokhari%2FBlog-Server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31416770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bearer-token","expressjs","jwt","mongoose","typescript"],"created_at":"2024-12-22T12:29:51.266Z","updated_at":"2026-04-04T22:31:43.600Z","avatar_url":"https://github.com/Emam-Bokhari.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Blog Project\n\nThis **blog site** is a **dynamic application** designed for **sharing and exploring content**, developed using `TypeScript`, `Node.js`, `Express.js`, and `MongoDB` with `Mongoose`. It includes **user roles** (`Admin` and `User`), **secure login**, and a **public API** with options for **search**, **sorting**, and **filtering**.\n\n### 🌐 Live Deployment \u0026 🎥 Explanation Video Link\n\n- **Live Site**: [Visit the Deployment](https://blogs-wheat-six.vercel.app)\n- **Video Explanation**: [Watch the Video](https://moshfiqur-rahman-workspace.neetorecord.com/watch/123b9dc7-2b96-4135-be3e-23259ec2abf0)\n\n## 🔑 Key Features\n\n- **User Roles**:\n\n  - `Admin`: Can delete any blog and block specific users.\n  - `User`: Can create, update, and delete only their own blogs.\n\n- **Authentication \u0026 Authorization**:\n\n  - Secure login using **Bearer Token** for accessing protected routes and performing actions based on roles.\n\n- **Blog Management**:\n\n  - Users can efficiently manage their own blogs (create, update, delete).\n  - Admins have the authority to manage blogs globally.\n\n- **User Management**:\n\n  - Admin can block users to restrict their access.\n  - Users maintain access to their blogs as long as they are not blocked.\n\n- **Search, Filter \u0026 Sort**:\n  - Search blogs by `title` and `content`.\n  - Filter blogs by `author ID`.\n  - Sort blogs based on specific criteria for better data organization.\n\n## 🛠️ Installation and Setup\n\nTo get started with the project locally, follow these steps:\n\n### 1. Clone the Repository\n\nFirst, clone the repository to your local machine:\n\n```bash\ngit clone https://github.com/Emam-Bokhari/Blog-Server\n```\n\n### 2. Navigate to the Project Folder\n\nGo to the project directory:\n\n```bash\ncd Blog-Server\n```\n\n### 3. Install Dependencies\n\nInstall the required dependencies using npm or yarn:\n\n```bash\nnpm install\n# or\nyarn install\n```\n\n### 4. Setup Environment Variables\n\nCreate a `.env` file in the root of the project and add the following environment variables:\n\n```bash\nNODE_ENV=development\nPORT=3000\nDATABASE_URL=mongodb+srv://blog:ESdHhAZ5qz9jep06@cluster0.kndeci6.mongodb.net/blog-DB?retryWrites=true\u0026w=majority\u0026appName=Cluster0\nBCRYPT_SALT_ROUNDS=12\nACCESS_TOKEN_SECRET=519c5d4a4bcca5ae7ad5e9879d1da60579b991d9c553a128db0e19f97c4853eb7b16295ddce66bf0b45d29e73d81c8bedf381dda5122997e18eeb04f1d0e11c8\nACCESS_TOKEN_EXPIRES_IN=30d\n```\n\n### 5. Admin Login Credentials\n\nTo access the admin panel, use the following credentials:\n\n- **Email:** `admin@gmail.com`\n- **Password:** `admin123`\n\n### 6. Run the Application\n\nStart the development server:\n\n```bash\nnpm run start:dev\n```\n\nYour application should now be running at `http://localhost:3000`.\n\n### 7. Access the Application\n\n- Visit the site in your browser at `http://localhost:3000`.\n- You can now use the application to create, update, delete, and manage blogs based on the user roles.\n\n### 8. Additional Notes\n\n- To access protected routes, use Bearer Tokens for authentication.\n\n## ⚙️ Technologies Used\n\nThis project is built using technologies that ensure smooth performance and easy development:\n\n### Backend\n\n- **Node.js**: Runtime environment for executing JavaScript server-side.\n- **Express.js**: Web framework for building RESTful APIs.\n- **MongoDB**: NoSQL database for storing data.\n- **Mongoose**: ODM (Object Data Modeling) library for MongoDB.\n- **TypeScript**: Typed superset of JavaScript for maintaining type safety.\n\n### Authentication \u0026 Authorization\n\n- **JWT (JSON Web Tokens)**: Secure authentication and user verification.\n- **Bearer Token**: A method of transmitting the JWT in the `Authorization` header to protect routes and ensure only authorized access to APIs.\n\n### Validation\n\n- **Zod**: Schema-based data validation.\n\n### Testing \u0026 Development Tools\n\n- **Postman**: API testing and debugging.\n- **Nodemon**: Auto-restarting for development.\n- **ESLint**: Code linting to enforce consistent coding standards.\n- **Prettier**: Code formatter to maintain clean and readable code.\n\n### Deployment\n\n- **Vercel**: For seamless deployment and hosting.\n- **dotenv**: Environment variable management.\n\n### Other Tools\n\n- **bcryptjs**: For hashing passwords securely.\n- **CORS**: Middleware to enable cross-origin resource sharing.\n\nThese technologies work together to create a secure, scalable, and user-friendly blogging platform.\n\n## 📁 Folder Structure\n\nBelow is the folder structure for the project:\n\n```bash\n├── dist/                                             # Compiled Code\n│   ├── app/\n│   ├── app.js\n│   └── server.js\n├── node_modules/                                     # Project dependencies\n├── src/                                              # Source code\n│   ├── app/                                          # Main application logic\n│   │   ├── builder/\n│   │   ├── config/                                   # Configuration files (e.g., database, JWT, etc.)\n│   │   ├── errors/                                   # Custom error handling classes and utilities\n│   │   ├── interface/                                # TypeScript interfaces and types\n│   │   ├── middleware/                               # Express middleware functions\n│   │   ├── modules/                                  # Feature-specific modules\n│   │   │   ├── blog/                                 # Blog-related logic and components\n│   │   │   └── user/                                 # User-related logic and components\n│   │   ├── routes/                                   # Express routes (API endpoints)\n│   │   ├── utils/\n│   ├── app.ts                                        # Application entry point\n│   └── server.ts                                     # Main server file\n├── .env                                              # Environment variables\n├── .gitignore                                        # Specifies which files should not be tracked by Git\n├── .prettierignore                                   # Prettier configuration to ignore specific files\n├── .prettierrc                                       # Prettier configuration file\n├── .eslint.config.mjs                                # ESLint configuration file\n└── etc                                               # Other files (e.g., documentation, package-lock.json etc.)\n```\n\n## 🤖 💻 API Endpoints\n\nThe following API endpoints are available in this project:\n\n| HTTP Method | Endpoint                         | Description                                 | Access          |\n| ----------- | -------------------------------- | ------------------------------------------- | --------------- |\n| `POST`      | `/api/auth/register`             | Register a new user                         | Public          |\n| `POST`      | `/api/auth/login`                | Log in and receive a JWT                    | Public          |\n| `GET`       | `/api/blogs`                     | Get all blogs with search, filter, and sort | Public          |\n| `POST`      | `/api/blogs`                     | Create a new blog                           | Logged-in User  |\n| `PATCH`     | `/api/blogs/:id`                 | Update a specific blog                      | Blog Owner Only |\n| `DELETE`    | `/api/blogs/:id`                 | Delete a specific blog                      | Blog Owner Only |\n| `PATCH`     | `/api/admin/users/:userId/block` | Block a user                                | Admin Only      |\n| `DELETE`    | `/api/admin/blogs/:id`           | Delete a specific blog                      | Admin Only      |\n\n### Notes\n\n- **Public Access**: No authentication required.\n- **Admin Only**: Only accessible to admin users.\n- **Blog Owner Only**: Only the owner of the blog can perform this action.\n- **Admin/Owner Only**: Accessible to both admin and the blog owner.\n\n## 📞 Contact\n\nFor any inquiries, or suggestions, feel free to reach out:\n\n- **Email**: [moshfiqurrahman37@gmail.com](mailto:moshfiqurrahman37@gmail.com)\n- **GitHub**: [Emam-Bokhari](https://github.com/Emam-Bokhari)\n- **LinkedIn**: [Moshfiqur Rahman](https://www.linkedin.com/in/moshfiqur-rahman-a302b32a3/)\n\nI am always open to feedback ! 😊\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femam-bokhari%2Fblog-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femam-bokhari%2Fblog-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femam-bokhari%2Fblog-server/lists"}