https://github.com/jeevan42/post-it-blog-app-backend
๐ Backend Repo for a MERN blog app with JWT-based user authentication, bcrypt password hashing, and full CRUD API for blog posts using Node.js, Express, and MongoDB.
https://github.com/jeevan42/post-it-blog-app-backend
backend bcrypt blog-api crud-api express jwt-authentication mern-stack mongodb nodejs rest-api
Last synced: 2 months ago
JSON representation
๐ Backend Repo for a MERN blog app with JWT-based user authentication, bcrypt password hashing, and full CRUD API for blog posts using Node.js, Express, and MongoDB.
- Host: GitHub
- URL: https://github.com/jeevan42/post-it-blog-app-backend
- Owner: jeevan42
- Created: 2025-06-08T13:49:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-08T18:17:06.000Z (about 1 year ago)
- Last Synced: 2025-08-14T19:11:39.702Z (10 months ago)
- Topics: backend, bcrypt, blog-api, crud-api, express, jwt-authentication, mern-stack, mongodb, nodejs, rest-api
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ง Post-It Blog App - Backend
This is the backend Repo for the **Post-It Blog App**, a full-stack blogging application built with the MERN stack. It handles user authentication using JWT, password hashing with bcrypt, and CRUD operations for blog posts.
## ๐ ๏ธ Tech Stack
- Node.js
- Express.js
- MongoDB (Mongoose)
- JWT Authentication
- Bcrypt for password hashing
## ๐ฆ Features
- User registration and login
- JWT-based authentication
- CRUD operations on blog posts (Create, Read, Update, Delete)
- Authorization: Only post authors can update or delete their posts
## ๐ API Routes
### ๐ Auth Routes
- `POST /api/register` - Register a new user
- `POST /api/login` - Log in and receive a JWT token
### ๐ Blog Post Routes
- `GET /api/posts` - Get all blog posts
- `POST /api/posts` - Create a new blog post (Protected)
- `PUT /api/posts/:id` - Update a blog post (Protected)
- `DELETE /api/posts/:id` - Delete a blog post (Protected)
## ๐งช Tools & Libraries
- `dotenv` - Environment variable management
- `jsonwebtoken` - Token-based authentication
- `bcrypt` - Secure password hashing
- `cors` - Cross-origin resource sharing
- `mongoose` - MongoDB object modeling
## ๐ Folder Structure
post-it-blog-app-backend/
โโโ controllers/
โ โโโ auth.controller.js
โ โโโ post.controller.js
โโโ models/
โ โโโ User.js
โ โโโ Post.js
โโโ routes/
โ โโโ auth.js
โ โโโ posts.js
โโโ middleware/
โ โโโ auth.js
โโโ config/
โ โโโ db.js
โโโ .env.example
โโโ server.js
## ๐ Setup Instructions
```bash
git clone https://github.com/jeevan42/post-it-blog-app-backend
cd post-it-blog-app-backend
npm install
# Add .env file with your MongoDB URI and JWT_SECRET
npm start
```
## ๐ Contributing
PRs and stars are welcome. For major changes, open an issue first to discuss what you would like to change.