Skip to content

Purvesh-PJ/bloghub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BlogHub

BlogHub

A modern, full-stack blogging platform built with the MERN stack

Features β€’ Screenshots β€’ Tech Stack β€’ Getting Started β€’ API Reference β€’ Contributing

React Node.js MongoDB License


✨ Features

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

πŸ“Έ Screenshots

View All Screenshots

Home Page

Category slideshow hero with featured topics and latest posts feed. Home

Latest Posts

Browse and filter posts by category with trending sidebar. Latest Posts

Post Detail

Clean, Medium-style reading experience with engagement features. Post

Write Post

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

User Profile

Profile page with user stats, bio, and published posts. Profile

Analytics Dashboard

Track your content performance with detailed metrics. Dashboard


πŸ› οΈ Tech Stack

Frontend

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

Backend

Technology Purpose
Node.js Runtime
Express.js Web Framework
MongoDB Database
Mongoose ODM
JWT Authentication
bcryptjs Password Hashing
Express Validator Input Validation

πŸš€ Getting Started

Prerequisites

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

Installation

1. Clone the repository

git clone https://github.com/Purvesh-PJ/blogging_platform.git
cd blogging_platform

2. Install dependencies

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../client
npm install

3. 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_here

Create .env file in the client directory:

VITE_API_URL=http://localhost:5000

4. Seed Database (Recommended)

Populate the database with sample data for testing:

cd backend
npm run seed

This creates:

  • 15 users with profiles
  • 22 posts across 10 categories
  • 99 comments and 177 likes
  • Analytics data for dashboard

Test Accounts:

Role Email Password
User [email protected] password123
Admin [email protected] admin123

Running the Application

Start the backend server:

cd backend
npm run dev

Server runs on http://localhost:5000

Start the frontend (new terminal):

cd client
npm run dev

App runs on http://localhost:5173


πŸ“ Project Structure

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

πŸ“‘ API Reference

Authentication

Method Endpoint Description
POST /api/auth/signup Register new user
POST /api/auth/signin Login user
POST /api/auth/refreshToken Refresh access token

Posts

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

Users

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

Categories

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

Interactions

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

Search & Analytics

Method Endpoint Description Auth
GET /api/search/:query Search posts No
GET /api/analytics Get analytics Yes

πŸ“œ Available Scripts

Backend

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 Prettier

Frontend

npm 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 Prettier

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❀️ by Purvesh

About

A modern full-stack blogging platform with MDX editor, analytics dashboard, and social features. Built with React 19, Node.js, Express, and MongoDB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors