A full-stack blog application built with React (Vite), Node.js, Express, MongoDB, and Tailwind CSS. This project allows users to create, edit, save drafts, and publish blog posts with a clean and modern UI.
- ✍️ Rich text blog editor (TinyMCE)
- 📝 Auto-save drafts every 5 seconds of inactivity
- 💾 Manual "Save as Draft" button
- ✅ "Publish" button to move blog to published list
- 🗂 View Published Blogs and Drafts separately
- 🔁 Edit existing drafts or published posts
- 🔔 Toast notifications for actions (save, publish, etc.)
- Responsive UI with Tailwind CSS
- React.js (Vite)
- Tailwind CSS
- TinyMCE (rich text editor)
- React Router
- Node.js
- Express.js
- MongoDB (Atlas)
- Mongoose
- CORS, dotenv
BlogApp/
├── | # React frontend
│ |─ src/
│ │ ├── pages/
│ │ ├── components/
│ ├── public/
│ └── package.json
├── server/ # Node.js backend
│ ├── models/
│ ├── index.js
│ ├── package.json
├── README.md
git clone https://github.com/MOHDNEHALKHAN/BlogApp.git
cd BlogApp
npm installcd server
npm install- Create a MongoDB cluster on MongoDB Atlas.
- Whitelist your IP and create a database user.
- Create a
.envfile in/server:
MONGO_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/blogDB?retryWrites=true&w=majority- Start the backend server:
npm run devBackend runs at: http://localhost:3000
npm install
npm run devFrontend runs at: http://localhost:5173
Important: Run the frontend and backend servers in separate terminal windows to ensure both are running simultaneously.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/blogs/save-draft |
Create or update a draft |
| POST | /api/blogs/publish |
Publish a blog |
| GET | /api/blogs |
Get all blogs (draft + published) |
| GET | /api/blogs/:id |
Get blog by ID |