A modern, full-stack blogging platform built with the MERN stack
Features β’ Screenshots β’ Tech Stack β’ Getting Started β’ API Reference β’ Contributing
Content Creation
- π MDX Editor with live preview and syntax highlighting
- πΌοΈ Cover image support for posts
- π·οΈ Categories and tags organization
- π± Fully responsive design
User Experience
- π Secure JWT authentication with refresh tokens
- π€ User profiles with bio and avatar
- π₯ Follow/unfollow system
- β€οΈ Like and comment on posts
- π¬ Nested comment replies
- π Full-text search
Analytics & Admin
- π Performance dashboard with views, likes, and engagement metrics
- π Admin panel for content management
- π Post analytics and insights
Developer Experience
- β‘ Vite for lightning-fast development
- π¨ Styled Components with theme support
- π Light/Dark mode
- π React Query for efficient data fetching
View All Screenshots
Category slideshow hero with featured topics and latest posts feed.

Browse and filter posts by category with trending sidebar.

Clean, Medium-style reading experience with engagement features.

MDX editor with live preview, categories, and publishing options.

| Technology | Purpose |
|---|---|
| React 19 | UI Framework |
| Vite | Build Tool |
| React Router v7 | Routing |
| TanStack Query | Data Fetching |
| Styled Components | Styling |
| MDX Editor | Rich Text Editing |
| Lucide Icons | Icons |
| React Hot Toast | Notifications |
| Technology | Purpose |
|---|---|
| Node.js | Runtime |
| Express.js | Web Framework |
| MongoDB | Database |
| Mongoose | ODM |
| JWT | Authentication |
| bcryptjs | Password Hashing |
| Express Validator | Input Validation |
- Node.js v18 or higher
- MongoDB (local installation or MongoDB Atlas)
- npm or yarn
1. Clone the repository
git clone https://github.com/Purvesh-PJ/blogging_platform.git
cd blogging_platform2. Install dependencies
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../client
npm install3. Environment Setup
Create .env file in the backend directory:
DB_URI=mongodb://127.0.0.1:27017/bloghub
PORT=5000
JWT_SECRET=your_super_secret_jwt_key_hereCreate .env file in the client directory:
VITE_API_URL=http://localhost:50004. Seed Database (Recommended)
Populate the database with sample data for testing:
cd backend
npm run seedThis creates:
- 15 users with profiles
- 22 posts across 10 categories
- 99 comments and 177 likes
- Analytics data for dashboard
Test Accounts:
| Role | Password | |
|---|---|---|
| User | [email protected] | password123 |
| Admin | [email protected] | admin123 |
Start the backend server:
cd backend
npm run devServer runs on http://localhost:5000
Start the frontend (new terminal):
cd client
npm run devApp runs on http://localhost:5173
blogging_platform/
β
βββ backend/
β βββ config/ # Database configuration
β βββ controllers/ # Request handlers
β βββ middlewares/ # Auth & validation middleware
β βββ models/ # Mongoose schemas
β βββ routes/ # API route definitions
β βββ services/ # Business logic layer
β βββ index.js # Server entry point
β βββ seed.js # Database seeder
β
βββ client/
β βββ public/
β β βββ screenshots/ # App screenshots
β βββ src/
β β βββ components/ # Reusable UI components
β β β βββ common/ # Shared components
β β β βββ layout/ # Layout components
β β βββ config/ # API configuration
β β βββ context/ # React Context providers
β β βββ pages/ # Page components
β β βββ services/ # API service functions
β β βββ styles/ # Theme and global styles
β β βββ App.jsx # Root component
β β βββ main.jsx # Entry point
β βββ index.html
β βββ vite.config.js
β
βββ README.md
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/signup |
Register new user |
| POST | /api/auth/signin |
Login user |
| POST | /api/auth/refreshToken |
Refresh access token |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/posts |
Get all posts | No |
| GET | /api/posts/:id |
Get single post | No |
| POST | /api/posts |
Create post | Yes |
| PUT | /api/posts/:id |
Update post | Yes |
| DELETE | /api/posts/:id |
Delete post | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/users/getUser |
Get current user | Yes |
| PUT | /api/users/setUser |
Update profile | Yes |
| GET | /api/users/getUserPosts |
Get user's posts | Yes |
| POST | /api/users/followUser |
Follow user | Yes |
| POST | /api/users/unfollowUser |
Unfollow user | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/categories |
Get all categories | No |
| POST | /api/categories |
Create category | Admin |
| POST | /api/categories/attachCategories |
Attach to post | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/comments |
Create comment | Yes |
| POST | /api/comments/replies |
Reply to comment | Yes |
| POST | /api/likes |
Like a post | Yes |
| DELETE | /api/likes/:postId |
Unlike a post | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/search/:query |
Search posts | No |
| GET | /api/analytics |
Get analytics | Yes |
npm start # Start production server
npm run dev # Start development server (nodemon)
npm run seed # Seed database with sample data
npm run lint # Run ESLint
npm run format # Format with Prettiernpm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
npm run format # Format with PrettierContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ by Purvesh

