PenThread is a modern, full-stack blogging platform designed for content creators, readers, and moderators to collaborate seamlessly. Built with enterprise-grade architecture, it delivers:
๐ Rich content creation with categories and tags ๐ Role-based dashboards (User, Author, Admin) ๐ฌ Advanced comment system with moderation โค๏ธ Social interactions (likes, favorites, views) ๐ Real-time notifications ๐จ Beautiful, responsive UI with dark mode
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PENTHREAD PLATFORM โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ
โ โ REACT FRONTEND โโโโโโโโโบโ EXPRESS BACKEND โ โ
โ โ โ REST โ โ โ
โ โ โข Vite + React โ API โ โข Node.js โ โ
โ โ โข Tailwind CSS โ โ โข JWT Auth โ โ
โ โ โข Zustand โ โ โข Mongoose ODM โ โ
โ โ โข Axios โ โ โข Joi Validation โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ
โ โฒ โฒ โ
โ โ โ โ
โ โ โผ โ
โ โ โโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ MONGODB DATABASE โ โ
โ โ โ โ โ
โ โ โ โข Users โ โ
โ โ โ โข Posts โ โ
โ โ โ โข Comments โ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โข Interactions โ โ
โ JWT + localStorage โ โข Notifications โ โ
โ โโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- JWT-based secure authentication
- Role-based access control (User, Author, Admin)
- Password reset with email verification
- Token refresh mechanism
- Rich blog post creation and editing
- Category and tag organization
- Draft/Publish workflow
- Author-owned content management
- Nested comment threads
- Author/Admin comment moderation (Approve/Reject)
- Comment status tracking (Pending/Approved/Rejected)
- Comment owner deletion rights
- Like posts
- Favorite/bookmark posts
- View count tracking
- User interaction history
- User Dashboard: Personal activity and stats
- Author Dashboard: Post performance metrics
- Admin Dashboard: Platform-wide analytics
- Comment notifications
- Moderation updates
- Interaction alerts
- Mark as read/unread
- Responsive design (mobile-first)
- Dark mode support
- Smooth animations (Framer Motion)
- Accessibility compliant
| Technology | Purpose |
|---|---|
| React 18 | UI component library |
| Vite 5 | Build tool & dev server |
| Tailwind CSS 3 | Utility-first styling |
| Zustand | State management |
| React Router 6 | Client-side routing |
| Axios | HTTP client |
| Framer Motion | Animations |
| Lucide React | Icon library |
| Technology | Purpose |
|---|---|
| Node.js 18+ | Runtime environment |
| Express 4 | Web framework |
| MongoDB 6 | NoSQL database |
| Mongoose | ODM for MongoDB |
| JWT | Authentication tokens |
| Joi | Request validation |
| Bcryptjs | Password hashing |
| Winston | Logging |
| Nodemailer | Email notifications |
๐ฆ penthread/
โ
โโโ ๐ backend/ # Node.js + Express API
โ โโโ src/
โ โ โโโ config/ # DB, logger, env configs
โ โ โโโ modules/ # Feature modules (auth, posts, etc.)
โ โ โโโ middlewares/ # Auth, validation, error handling
โ โ โโโ utils/ # Helpers, constants
โ โ โโโ app.js # Express app setup
โ โ โโโ server.js # Server entry point
โ โโโ .env
โ โโโ package.json
โ โโโ README.md
โ
โโโ ๐ frontend/ # React + Vite SPA
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โโโ pages/ # Route pages
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ services/ # API service layer
โ โ โโโ store/ # Zustand stores
โ โ โโโ context/ # React contexts
โ โ โโโ utils/ # Helper functions
โ โ โโโ App.jsx
โ โ โโโ main.jsx
โ โโโ .env
โ โโโ package.json
โ โโโ README.md
โ
โโโ ๐ README.md # This file- Node.js 18+ and npm 9+
- MongoDB 6+ (local or Atlas)
- Git
git clone https://github.com/yourusername/penthread.git
cd penthreadcd backend
npm install
cp .env.sample .env
# Edit .env with your MongoDB URI, JWT secret, etc.
npm run db:seed # Seed database with sample data
npm run dev # Start backend on port 5000cd ../frontend
npm install
cp .env.sample .env
# Set VITE_API_BASE_URL=http://localhost:5000/api
npm run dev # Start frontend on port 5173- Frontend:
http://localhost:5173 - Backend API:
http://localhost:5000/api
| Role | Password | |
|---|---|---|
| Admin | admin@example.com | Admin@123 |
| Author | author@example.com | Author@123 |
| User | user@example.com | User@123 |
http://localhost:5000/api
| Module | Endpoints | Auth Required |
|---|---|---|
| Auth | /auth/register, /auth/login, /auth/refresh |
Mixed |
| Users | /users, /users/:id, /users/profile |
โ |
| Posts | /posts, /posts/:id, /posts/:id/publish |
โ |
| Comments | /posts/:postId/comments, /comments/pending |
โ |
| Categories | /categories, /categories/:id |
Mixed |
| Tags | /tags, /tags/:id |
Mixed |
| Interactions | /interactions/like, /interactions/favorite |
โ |
| Notifications | /notifications, /notifications/:id/read |
โ |
| Dashboard | /dashboard/admin, /dashboard/author |
โ |
Import Postman Collection: backend/postman_collection.json
| Feature | User | Author | Admin |
|---|---|---|---|
| View published posts | โ | โ | โ |
| Create posts | โ | โ | โ |
| Edit own posts | โ | โ | โ |
| Edit any post | โ | โ | โ |
| Comment on posts | โ | โ | โ |
| Moderate own post comments | โ | โ | โ |
| Moderate all comments | โ | โ | โ |
| Manage categories/tags | โ | โ | โ |
| View analytics | Own | Own | All |
| User management | โ | โ | โ |
โ Authentication
- JWT access & refresh tokens
- Bcrypt password hashing (10 rounds)
- HTTP-only cookies (optional)
โ Authorization
- Role-based middleware protection
- Resource ownership validation
- API endpoint guarding
โ Data Protection
- Request validation with Joi schemas
- MongoDB injection prevention
- XSS protection via React JSX
- CORS configuration
- Rate limiting (Helmet + express-rate-limit)
โ Best Practices
- Environment variable isolation
- Centralized error handling
- Audit logging with Winston
- Secure HTTP headers
- users - User accounts with role and profile info
- posts - Blog posts with status, categories, tags
- comments - Comments with moderation status
- categories - Post categorization
- tags - Post tagging
- interactions - Likes, favorites, views
- notifications - User notifications
- activityLogs - Audit trail
- Users โ Posts (1:N - author relationship)
- Posts โ Comments (1:N)
- Posts โ Categories (N:M)
- Posts โ Tags (N:M)
- Users โ Interactions (1:N)
cd backend
npm run test # Run Jest tests (to be implemented)Postman Collection:
- Automated tests for all endpoints
- Environment variables for token management
- Complete workflow testing
cd frontend
npm run test # Run Vitest (to be implemented)
npm run test:e2e # Run Playwright E2E tests# Build command
npm install
# Start command
npm run start
# Environment variables
NODE_ENV=production
MONGO_URI=<your-mongodb-atlas-uri>
JWT_SECRET=<your-secret># Build command
npm run build
# Output directory
dist/
# Environment variables
VITE_API_BASE_URL=https://your-backend-api.com/api- Full authentication system
- Post CRUD with workflow
- Comment system with moderation
- Dashboard analytics
- Social interactions
- Real-time notifications (WebSocket)
- Rich text editor (TinyMCE/Quill)
- Image upload (Cloudinary)
- Advanced search & filters
- Email queue system
- Multi-language support (i18n)
- Mobile app (React Native)
- SEO optimization
- Analytics dashboard v2
- AI-powered content suggestions
We welcome contributions! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation
This project is licensed under the MIT License - see the LICENSE file for details.
- Email: hemanths7.dev@gmail.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- React team for the amazing framework
- Express.js community
- MongoDB for flexible data modeling
- Tailwind CSS for beautiful styling
- All open-source contributors
If you find PenThread helpful, please give it a โญ on GitHub!
๐ Built with MERN, designed for scale, crafted with care. Made by developers, for developers and content creators.