A modern, feature-rich blogging platform built with MongoDB, Express.js, React (Vite), and Node.js. Perfect for content creators, bloggers, and organizations looking for a complete content management solution.
Zidio.Dev.Project.2.mp4
- π Multi-tier Authentication - User, Admin, and Super Admin roles
- π Advanced Rich Text Editor - Powered by Tiptap with extensive formatting options
- π Intelligent Search & Filters - Advanced search with AI-powered suggestions
- π¬ Interactive Comments System - Nested comments with real-time updates
- β€οΈ Social Features - Like, bookmark, and share functionality
- π€ Comprehensive User Profiles - Customizable profiles with activity tracking
- π± Fully Responsive Design - Seamless experience across all devices
- π Dark/Light Theme Support - User preference-based theming
- π Advanced Analytics Dashboard - User, content, and engagement metrics
- π₯ User Management System - Role-based access control and user moderation
- π Content Analytics - Blog performance tracking and insights
- οΏ½ Admin Request System - Secure admin privilege request workflow
- π οΈ Super Admin Controls - System-wide management and configuration
- β‘ High Performance - Optimized React components with Redux Toolkit
- π Enterprise Security - JWT authentication with bcrypt encryption
- π‘ RESTful API Design - Well-documented, scalable backend architecture
- π¨ Modern UI/UX - Tailwind CSS with custom design system
- π Real-time Updates - Live notifications and content updates
- Framework: React 18.3.1 with Vite
- State Management: Redux Toolkit
- Styling: Tailwind CSS with custom components
- Rich Text Editor: Tiptap (migrated from React Quill for better SSR support)
- HTTP Client: Axios with interceptors
- Routing: React Router DOM v6
- Icons: React Icons
- Notifications: React Hot Toast
- Runtime: Node.js with Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT tokens with bcrypt hashing
- File Upload: Multer with Cloudinary integration
- Security: Helmet, CORS, rate limiting
- Validation: Express validator middleware
- Frontend Dev Server: Vite (Fast HMR)
- Backend Dev Server: Nodemon
- Code Quality: ESLint, Prettier
- Version Control: Git with GitHub
- Node.js (v16.0.0 or higher)
- MongoDB Atlas account or local MongoDB installation
- Git for version control
-
Clone the Repository
git clone https://github.com/omkar2816/Zidio-Dev-Project-2.git cd Zidio-Dev-Project-2 -
Install Dependencies
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install # Install root dependencies (if any) cd .. npm install
-
Environment Configuration
Backend Environment (.env in /backend/)
PORT=5000 MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/blog-web-application JWT_SECRET=your_super_secret_jwt_key_min_32_characters NODE_ENV=development # Optional: For image uploads (Cloudinary) CLOUDINARY_CLOUD_NAME=your_cloudinary_name CLOUDINARY_API_KEY=your_cloudinary_key CLOUDINARY_API_SECRET=your_cloudinary_secret
Frontend Environment (.env in /frontend/)
VITE_API_URL=http://localhost:5000/api
-
Database Setup
# Test database connection cd backend node checkDatabase.js # Create super admin (optional) node scripts/createSuperAdmin.js
-
Start Development Servers
# Terminal 1: Start Backend Server cd backend npm start # Backend runs on: http://localhost:5000 # Terminal 2: Start Frontend Server cd frontend npm run dev # Frontend runs on: http://localhost:5174
-
Sign Up: Navigate to
/registerand create an account- Choose username, email, and secure password
- Optionally request admin access during registration
- Account verification via email (if configured)
-
Login: Access your account at
/login- Supports User, Admin, and Super Admin roles
- Auto-redirect based on user permissions
- Remember me functionality
- π€ User: Create, edit, and manage your own blogs
- π‘οΈ Admin: Moderate users and content, access analytics
- β‘ Super Admin: Full system control, manage admins, system settings
- Navigate to Create: Click "Create" button or visit
/create - Fill Blog Details:
- Title: Engaging, SEO-friendly title
- Category: Choose from predefined categories
- Tags: Add relevant tags (comma-separated)
- Featured Image: Upload file or provide URL
- Content Creation: Use the rich text editor
- Formatting: Bold, italic, headers, lists
- Media: Insert images, add links
- Layout: Text alignment, spacing
- Publish: Click "Publish Blog" to make it live
- Text Formatting: Bold, italic, strikethrough
- Headers: H1, H2, H3 for content structure
- Lists: Bullet points and numbered lists
- Alignment: Left, center, right text alignment
- Links: Add hyperlinks with custom text
- Images: Insert images via URL with preview
- Responsive: Works on desktop and mobile
- Edit Blogs: Visit
/edit/:idto modify your posts - Delete Blogs: Remove unwanted content
- Draft System: Save work in progress (coming soon)
- Analytics: Track views, likes, and engagement
- Smart Search: AI-powered search with synonyms
- Category Filter: Browse by technology, tutorials, etc.
- Sort Options: Latest, most liked, most viewed, alphabetical
- Advanced Filters: Combine multiple criteria
- Like Posts: Show appreciation for great content
- Bookmark: Save posts for later reading (
/bookmarks) - Comment: Engage with authors and other readers
- Share: Social media integration (coming soon)
- Profile Information: Update name, bio, avatar
- Activity Overview: Your blogs, comments, likes
- Statistics: Content performance metrics
- Account Settings: Password, email preferences
- Password Management: Update passwords securely
- Account Visibility: Control profile visibility
- Data Export: Download your content (coming soon)
- User Management: View, edit, delete users
- Content Moderation: Manage all blog posts
- Analytics: System-wide statistics and insights
- Role Management: Promote/demote user roles (Super Admin only)
- System Overview: Complete platform statistics
- Admin Management: Manage admin users
- Admin Requests: Approve/reject admin access requests
- System Settings: Platform configuration
| Method | Endpoint | Description | Access |
|---|---|---|---|
| POST | /api/auth/register |
User registration | Public |
| POST | /api/auth/login |
User authentication | Public |
| GET | /api/auth/me |
Get current user | Private |
| PUT | /api/auth/profile |
Update profile | Private |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/blogs |
Get all published blogs | Public |
| GET | /api/blogs/:id |
Get single blog post | Public |
| POST | /api/blogs |
Create new blog | Private |
| PUT | /api/blogs/:id |
Update blog post | Private (Author/Admin) |
| DELETE | /api/blogs/:id |
Delete blog post | Private (Author/Admin) |
| POST | /api/blogs/:id/like |
Like/unlike blog | Private |
| GET | /api/blogs/user/:userId |
Get user's blogs | Public |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/blogs/:id/comments |
Get blog comments | Public |
| POST | /api/blogs/:id/comments |
Add comment | Private |
| PUT | /api/comments/:id |
Update comment | Private (Author/Admin) |
| DELETE | /api/comments/:id |
Delete comment | Private (Author/Admin) |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/users/:id |
Get user profile | Public |
| PUT | /api/users/:id |
Update user profile | Private (Self/Admin) |
| GET | /api/admin/users |
Get all users | Admin |
| DELETE | /api/admin/users/:id |
Delete user | Admin |
| PUT | /api/admin/users/:id/role |
Update user role | Super Admin |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/admin/analytics |
System analytics | Admin |
| GET | /api/admin-request/pending |
Pending admin requests | Super Admin |
| PUT | /api/admin-request/:id/approve |
Approve admin request | Super Admin |
| PUT | /api/admin-request/:id/reject |
Reject admin request | Super Admin |
BlogHub/
βββ π backend/ # Express.js Backend
β βββ π config/ # Database & app configuration
β β βββ db.js # MongoDB connection
β βββ π controllers/ # Route controllers
β β βββ authController.js # Authentication logic
β β βββ blogController.js # Blog CRUD operations
β β βββ userController.js # User management
β β βββ adminController.js # Admin operations
β β βββ adminRequestController.js # Admin request handling
β βββ π middleware/ # Custom middleware
β β βββ authMiddleware.js # JWT authentication
β β βββ errorMiddleware.js # Error handling
β βββ π models/ # MongoDB schemas
β β βββ User.js # User model with roles
β β βββ Blog.js # Blog post model
β βββ π routes/ # API route definitions
β β βββ authRoutes.js # Authentication routes
β β βββ blogRoutes.js # Blog management routes
β β βββ userRoutes.js # User profile routes
β β βββ adminRoutes.js # Admin panel routes
β β βββ adminRequestRoutes.js # Admin request routes
β βββ π scripts/ # Utility scripts
β β βββ createSuperAdmin.js # Super admin creation
β βββ π uploads/ # File upload directory
β βββ .env # Environment variables
β βββ package.json # Backend dependencies
β βββ server.js # Express server entry point
β
βββ π frontend/ # React Frontend
β βββ π public/ # Static assets
β βββ π src/
β β βββ π components/ # Reusable React components
β β β βββ Navbar.jsx # Navigation component
β β β βββ BlogCard.jsx # Blog preview card
β β β βββ SearchBar.jsx # Advanced search component
β β β βββ TiptapEditor.jsx # Rich text editor
β β β βββ AnalyticsChart.jsx # Data visualization
β β β βββ AdminRequestStatus.jsx # Admin request component
β β βββ π pages/ # Page components
β β β βββ Home.jsx # Landing page
β β β βββ Login.jsx # Authentication page
β β β βββ Register.jsx # User registration
β β β βββ CreateBlog.jsx # Blog creation
β β β βββ EditBlog.jsx # Blog editing
β β β βββ BlogDetails.jsx # Individual blog view
β β β βββ MyProfile.jsx # User profile page
β β β βββ Bookmarks.jsx # Saved posts
β β β βββ AdminDashboard.jsx # Admin panel
β β β βββ SuperAdminPanel.jsx # Super admin interface
β β βββ π store/ # Redux state management
β β β βββ store.js # Redux store configuration
β β β βββ slices/ # Redux slices
β β β βββ authSlice.js # Authentication state
β β β βββ blogSlice.js # Blog management state
β β β βββ themeSlice.js # Theme preferences
β β βββ π services/ # API service functions
β β β βββ blogService.js # Blog API calls
β β β βββ userService.js # User API calls
β β β βββ synonymService.js # Search enhancement
β β βββ π utils/ # Utility functions
β β βββ π styles/ # CSS and styling
β β β βββ globals.css # Global styles
β β β βββ tiptap.css # Rich editor styles
β β βββ App.jsx # Main application component
β β βββ main.jsx # React entry point
β βββ .env # Frontend environment variables
β βββ package.json # Frontend dependencies
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ vite.config.js # Vite build configuration
β
βββ π README.md # This documentation file
βββ π PROJECT_REPORT.md # Detailed project report
βββ π TIPTAP_MIGRATION.md # Editor migration guide
βββ π package.json # Root project configuration
-
Build the project:
cd frontend npm run build -
Deploy to Netlify:
- Upload
frontend/distfolder to Netlify - Set build command:
npm run build - Set publish directory:
dist - Set environment variables:
VITE_API_URL=https://your-backend-url.com/api
- Upload
- Connect GitHub repository
- Configure build settings:
- Framework Preset: Vite
- Root Directory:
frontend - Build Command:
npm run build - Output Directory:
dist
- Add environment variables:
VITE_API_URL=https://your-backend-url.com/api
- Connect your GitHub repository
- Set root directory:
backend - Environment variables:
PORT=5000 MONGO_URI=mongodb+srv://user:pass@cluster.mongodb.net/database JWT_SECRET=your_production_jwt_secret NODE_ENV=production CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret
- Create new Web Service
- Build Command:
cd backend && npm install - Start Command:
cd backend && npm start - Add environment variables (same as above)
- Create Heroku app:
heroku create your-app-name
- Set buildpack:
heroku buildpacks:set heroku/nodejs
- Configure environment variables:
heroku config:set MONGO_URI=your_mongo_uri heroku config:set JWT_SECRET=your_jwt_secret
-
Create MongoDB Atlas Account
- Sign up at MongoDB Atlas
- Create a new cluster (free tier available)
-
Configure Database Access
- Create database user with read/write permissions
- Whitelist IP addresses (0.0.0.0/0 for all IPs)
-
Get Connection String
- Click "Connect" β "Connect your application"
- Copy the connection string
- Replace
<password>with your actual password
-
Database Collections The application will automatically create the following collections:
users- User accounts and profilesblogs- Blog posts and contentcomments- User comments (embedded in blogs) Collections which you have to make:bookmarks- Store Bookmarked post for each usercategories- Various categories of Blogs (Web Development, etc.)likes- Store likes of Blogstags- Hashtag to make blog trendviews- To Store views
-
Code Editor Setup
- VS Code (recommended) with extensions:
- ES7+ React/Redux/React-Native snippets
- Tailwind CSS IntelliSense
- MongoDB for VS Code
- GitLens
- VS Code (recommended) with extensions:
-
Development Tools
# Install nodemon globally for backend development npm install -g nodemon # Install Redux DevTools browser extension # Available for Chrome and Firefox
- Frontend: ESLint + Prettier configuration
- Backend: Node.js best practices with error handling
- Database: Mongoose schema validation
- Git: Conventional commit messages
cd backend
npm run testcd frontend
npm run test- Code Splitting: Lazy loading for routes
- Image Optimization: WebP format, lazy loading
- Bundle Analysis: Use
npm run build -- --analyze - Caching: Service worker for offline support
- Database Indexing: Optimized queries
- Caching: Redis for session management
- Rate Limiting: API protection
- Compression: Gzip compression enabled
Issue: Vite dev server not starting
# Solution: Clear cache and reinstall dependencies
rm -rf node_modules package-lock.json
npm install
npm run devIssue: Environment variables not loading
# Solution: Check .env file format (no spaces around =)
VITE_API_URL=http://localhost:5000/apiIssue: Build fails with TypeScript errors
# Solution: Check component imports and prop types
npm run build -- --no-strictIssue: MongoDB connection fails
# Solution: Check connection string and network access
# Verify MongoDB Atlas IP whitelist includes your IPIssue: JWT authentication not working
# Solution: Verify JWT_SECRET is set and same across all instances
echo $JWT_SECRETIssue: File upload errors
# Solution: Check Cloudinary credentials and upload preset
# Verify file size limits in middlewareIssue: Duplicate key errors
# Solution: Check unique indexes and handle conflicts
# Use proper error handling in try-catch blocksIssue: Slow query performance
# Solution: Add database indexes for frequently queried fields
# Use MongoDB Compass to analyze query performance# Backend debugging
DEBUG=blog:* npm start
# Frontend debugging
VITE_DEBUG=true npm run dev- Network Tab: Monitor API calls and responses
- Application Tab: Check localStorage and sessionStorage
- Console: View React and Redux logs
- GitHub Issues: Report bugs and feature requests
- Documentation: Check
PROJECT_REPORT.mdfor detailed technical documentation - Migration Guide: See
TIPTAP_MIGRATION.mdfor editor implementation details
cd backend
node scripts/createSuperAdmin.jsFor development and testing purposes:
Super Admin:
- Email:
superadmin@bloghub.com - Password:
SuperAdmin123!
Regular Admin:
- Email:
admin@bloghub.com - Password:
Admin123!
Test User:
- Email:
user@bloghub.com - Password:
User123!
β οΈ Security Note: Change default passwords in production!
- Frontend Load Time: < 2 seconds
- API Response Time: < 200ms average
- Database Query Time: < 100ms average
- SEO Score: 90+ (Lighthouse)
- Accessibility Score: 95+ (WCAG AA)
- Horizontal Scaling: Stateless backend design
- Database Sharding: MongoDB cluster support
- CDN Ready: Static asset optimization
- Caching Layer: Redis integration ready
- Load Balancing: Multiple instance support
- π Real-time Collaboration: Live editing and comments
- π Advanced Analytics: Detailed content performance metrics
- π Multi-language Support: Internationalization (i18n)
- π± Mobile App: React Native mobile application
- π Push Notifications: Real-time user notifications
- π§ Email Integration: Newsletter and notifications
- π¨ Theme Customization: Custom blog themes and layouts
- π€ AI Content Assistance: AI-powered writing suggestions
- π Advanced Search: Elasticsearch integration
- π° Monetization: Ad management and premium features
- π API Marketplace: Third-party integrations
- π A/B Testing: Content optimization tools
We welcome contributions from the community! Please read our contributing guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Create issues for bugs and feature requests
- Follow conventional commit message format
- Ensure tests pass before submitting PR
- Update documentation for new features
This project is licensed under the MIT License - see the LICENSE file for details.
Project Lead: Omkar Korgaonkar
Organization: Zidio Development
Project Type: Full-Stack MERN Development
- Tiptap team for the excellent rich text editor
- MongoDB team for the robust database solution
- React and Vite teams for the development framework
- Tailwind CSS for the utility-first CSS framework
Made by the Omkar Korgaonkar
π Star this repository if you found it helpful!
π Found a bug? Report it here
π‘ Have suggestions? Start a discussion