A powerful and scalable RESTful API for a blogging platform built using Node.js, Express.js, and MongoDB. Blogify API supports authentication, post management.
Blogify API is designed to provide backend services for a modern blogging platform. It includes secure JWT authentication, CRUD operations for blog posts.
- 🔐 JWT Authentication & Authorization
- 👤 User Registration & Login
- 📝 Blog Post CRUD Operations
- 📄 Cursor Pagination
- 🌍 MongoDB Atlas Cloud Database
- ⚡ RESTful API Architecture
- 🛡️ Protected Routes Middleware
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose
- Authentication: JWT (JSON Web Tokens)
- Cloud Database: MongoDB Atlas
Before running this project, make sure you have installed:
- Node.js (v18 or higher)
- npm or yarn
- MongoDB Atlas account
git clone https://github.com/yourusername/blogify-api.git
cd blogify-apinpm installCreate a .env file in the root directory.
# Server
PORT=3000
# MongoDB
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/blogify
# JWT
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=7d
---
# ▶️ Running the Project
## Development Mode
```bash
npm run devnpm startServer runs on:
http://localhost:3000| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | ❌ |
| POST | /api/auth/login |
User login | ❌ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/posts |
Get all posts | ❌ |
| GET | /api/posts/:id |
Get single post | ❌ |
| POST | /api/posts |
Create post | ✅ |
| PUT | /api/posts/:id |
Update post | ✅ |
| DELETE | /api/posts/:id |
Delete post | ✅ |
blogify-api/
│
├── controllers/
├── middleware/
├── models/
├── routes/
├── config/
├── utils/
├── .env
├── server.js
├── package.json
└── README.mdYou can test the API using:
- Postman
- Thunder Client
- Insomnia
Example Request:
POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}This API can be deployed using:
- Render
- Railway
- Cyclic
- Vercel (serverless)
- AWS EC2
Contributions are welcome!
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
This project is licensed under the MIT License.
Developed by Nith
- GitHub: https://github.com/Nith88