Skip to content

BlogApp is a blogging platform that I build where the bloggers can do the CRUD operations, following other bloggers. And normal users can like, save, comment on blogs along with customizing their profiles.

Notifications You must be signed in to change notification settings

aakritrajput/BlogAppBackend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlogApp Backend

This is the backend for BlogApp, a blogging platform that allows users to create, read, update, and delete blog posts. It includes user authentication, media uploads, and email verification.

🚀 Tech Stack

  • Backend Framework: Express.js
  • Database: MongoDB (with Mongoose ODM)
  • Authentication: JWT (JSON Web Token)
  • File Uploads: Cloudinary & Multer
  • Security: bcrypt for password hashing
  • Email Service: Nodemailer
  • Other Dependencies: CORS, dotenv, cookie-parser

🔗 API Documentation

For full API documentation and testing, visit the following Postman collection:

📖 View API Documentation

🌐 Deployment

The backend is deployed on Render.

⚙️ Installation & Setup

1️⃣ Clone the repository

git clone https://github.com/aakritrajput/BlogAppBackend.git
cd BlogAppBackend

2️⃣ Install dependencies

npm install

3️⃣ Configure environment variables

Create a .env file in the root directory and add the following:

PORT=
MONGODB_URI=
CORS_ORIGIN=
ACCESS_TOKEN_SECRET=
ACCESS_TOKEN_EXPIRY=
REFRESH_TOKEN_SECRET=
REFRESH_TOKEN_EXPIRY=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
VERIFICATION_TOKEN_SECRET=
VERIFICATION_TOKEN_EXPIRY=
PROJECT_OWNER_EMAIL=
PROJECT_OWNER_PASSWORD=
NODE_ENV=

4️⃣ Start the server

npm start

🛠 Features

✅ User authentication (JWT-based) ✅ CRUD operations for blog posts ✅ Image upload using Cloudinary ✅ Email verification via Nodemailer ✅ Pagination using mongoose-aggregate-paginate-v2

📁 Project Structure

BlogAppBackend/
│-- public/       # Stores images locally during upload
│-- src/
│   ├── controllers/  # Business logic for routes
│   ├── routes/       # API route handlers
│   ├── middlewares/  # Middleware functions (auth, error handling)
│   ├── models/       # Mongoose models (User, Post, etc.)
│   ├── utils/        # Helper utilities (email, file upload, etc.)
│   ├── db/           # Database connection setup
│   ├── index.js      # Entry point
│-- .env.example  # Environment variable sample
│-- package.json  # Dependencies and scripts

🎯 Author: Aakrit Rajput

About

BlogApp is a blogging platform that I build where the bloggers can do the CRUD operations, following other bloggers. And normal users can like, save, comment on blogs along with customizing their profiles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published