Skip to content

About

The backend API for the Blogify application - Kalvium BEWD SQ128

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Blogify API

Node.js Express.js MongoDB JWT Stripe Cloudinary

A powerful and scalable RESTful API for a blogging platform built using Node.js, Express.js, and MongoDB. Blogify API supports authentication, post management.


📖 Description

Blogify API is designed to provide backend services for a modern blogging platform. It includes secure JWT authentication, CRUD operations for blog posts.


✨ Features

  • 🔐 JWT Authentication & Authorization
  • 👤 User Registration & Login
  • 📝 Blog Post CRUD Operations
  • 📄 Cursor Pagination
  • 🌍 MongoDB Atlas Cloud Database
  • ⚡ RESTful API Architecture
  • 🛡️ Protected Routes Middleware

🛠️ Tech Stack

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB with Mongoose
  • Authentication: JWT (JSON Web Tokens)
  • Cloud Database: MongoDB Atlas

📋 Prerequisites

Before running this project, make sure you have installed:

  • Node.js (v18 or higher)
  • npm or yarn
  • MongoDB Atlas account

⚙️ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/yourusername/blogify-api.git
cd blogify-api

2️⃣ Install Dependencies

npm install

3️⃣ Configure Environment Variables

Create 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 dev

Production Mode

npm start

Server runs on:

http://localhost:3000

📡 API Endpoints

🔐 Authentication

Method Endpoint Description Auth Required
POST /api/auth/register Register new user ❌
POST /api/auth/login User login ❌

📝 Posts

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 ✅


📁 Project Structure

blogify-api/
│
├── controllers/
├── middleware/
├── models/
├── routes/
├── config/
├── utils/
├── .env
├── server.js
├── package.json
└── README.md

🧪 API Testing

You 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"
}

🚀 Deployment

This API can be deployed using:

  • Render
  • Railway
  • Cyclic
  • Vercel (serverless)
  • AWS EC2

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to your branch
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License.


👨‍💻 Author

Developed by Nith

About

The backend API for the Blogify application - Kalvium BEWD SQ128

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages