An open API service indexing awesome lists of open source software.

https://github.com/mahmovdsayed/blogplatform

Blogging Platform is a comprehensive solution that enables users to easily create, manage, and share blog posts. The platform features secure user authentication, allowing authors to create, edit, and delete their posts, organize content with categories and tags, and engage with readers through comments.
https://github.com/mahmovdsayed/blogplatform

bcrypt cloudinary cors expressjs jwt mongoose multer nodejs nodemailer typescript zod

Last synced: 3 months ago
JSON representation

Blogging Platform is a comprehensive solution that enables users to easily create, manage, and share blog posts. The platform features secure user authentication, allowing authors to create, edit, and delete their posts, organize content with categories and tags, and engage with readers through comments.

Awesome Lists containing this project

README

          

# Blog Platform API

A robust backend API for a modern blogging platform built with Node.js, TypeScript, and Express.

![Node.js](https://img.shields.io/badge/Node.js-18+-green)
![TypeScript](https://img.shields.io/badge/TypeScript-5+-blue)
![Express](https://img.shields.io/badge/Express-4.x-lightgrey)

## Features

- **User Authentication** (JWT)
- **Image Upload** (Cloudinary integration)
- **Validation Middleware** (Zod schema validation)
- **Database Models** (Mongoose)
- **Error Handling** (Custom error responses)

## Technologies Used

- **Runtime:** Node.js
- **Language:** TypeScript
- **Framework:** Express
- **Database:** MongoDB (Mongoose)
- **Authentication:** JWT
- **File Storage:** Cloudinary
- **Validation:** Zod

# Contributing

Pull requests are welcome. Please open an issue first to discuss what you would like to change.

## Installation

1. Clone the repository:
```bash
git clone https://github.com/Mahmovdsayed/blogPlatform.git
cd blog-platform
```
2. Install dependencies:
```bash
npm install
```
3. Run in development mode:

```bash
npm run dev
```

## API Endpoints

### Authentication

| Method | Endpoint | Description |
|--------|--------------------|-------------------------------------------------------|
| POST | `/auth/signup` | Register a new user (sends OTP email) |
| POST | `/auth/signin` | User login (returns JWT token) |
| POST | `/auth/verify-otp` | Verify email using OTP |
| POST | `/auth/resend-otp` | Request new OTP (if expired or not received) |
| POST | `/auth/forgot-password` | Request password reset (sends reset token via email) |
| POST | `/auth/reset-password` | Reset password using valid token |
| GET | `/auth/user` | Get user profile (protected by auth middleware) |
| PATCH | `/auth/update` | Update user profile (protected by auth middleware) |
| DELETE | `/auth/delete` | Delete user account (protected by auth middleware) |

---

### Blogs

| Method | Endpoint | Description |
|--------|------------------|---------------------------------------|
| POST | `/blog/add` | Add a new blog post (auth required) |
| PATCH | `/blog/update` | Update an existing blog post (auth) |
| DELETE | `/blog/delete` | Delete a blog post (auth) |
| GET | `/blog/` | Get a single blog post by `blogID` |
| GET | `/blog/all` | Get all blog posts |

---

### Likes

| Method | Endpoint | Description |
|--------|------------------|---------------------------------------|
| POST | `/like/add` | Like a blog post (auth required) |
| DELETE | `/like/remove` | Remove a like from a blog post (auth) |
| GET | `/like/all` | Get all likes (optionally filtered) |

---

### Comments

| Method | Endpoint | Description |
|--------|------------------|---------------------------------------|
| POST | `/comment/add` | Add a comment (auth required) |
| DELETE | `/comment/delete` | Delete a comment (auth required) |
| GET | `/comment/all` | Get all comments |

---

© 2025 Mahmoud Sayed. All rights reserved.