A modern, fullβstack blogging platform featuring authentication, rich content, realβtime interactions, AI suggestions, analytics, and payments.
- Features
- Tech Stack
- Monorepo Structure
- Environment Variables
- Install & Run Locally
- API Overview
- Frontend Highlights
- Real-time (SocketIO)
- Stripe Setup
- AI Suggestions
- Security & Best Practices
- Testing
- Deployment Notes
- Roadmap
- License
- JWT + Refresh Tokens
- Google OAuth (planned UI)
- Role-based access control (Reader / Author / Admin)
- Drafts & publishing
- Tags, categories, slugs, SEO, reading time
- Bookmarks, likes, and shares
- Images and rich media support
- Threaded replies
- Likes, edit/delete
- Real-time updates via Socket.IO
- Hugging Face API for content generation
- Graceful fallback to rule-based suggestions
- Views, engagement (likes/comments/bookmarks/shares)
- Monthly & daily trends
- In-app notifications
- Optional email notifications
- Full-text search
- Suggestions, trending tags/categories
- Stripe one-off payments & subscriptions
- Webhooks included
- Multer + static file serving
- Helmet CSP, rate limiting
- XSS & NoSQL sanitization, HPP
- React + Vite
- Tailwind CSS
- Framer Motion animations
- React Query for data fetching
- Toast notifications
| Layer | Technology |
|---|---|
| Backend | Node.js, Express, Mongoose, Socket.IO, Stripe, Nodemailer |
| Frontend | React 19, Vite, Tailwind CSS, React Router, Framer Motion, React Query |
| Tooling | ESLint, Nodemon, Vitest, Chart.js |
Scribble_blog/
ββ backend/
β ββ controllers/
β ββ middleware/
β ββ models/
β ββ routes/
β ββ services/
β ββ socket/
β ββ server.js
ββ frontend/
ββ src/ (components, pages, context, hooks, utils)
ββ vite.config.js
# Database
MONGO_URI=mongodb://localhost:27017/scribble_blog
REDIS_URL=redis://localhost:6379
# Auth
JWT_SECRET=replace_me
REFRESH_TOKEN_SECRET=replace_me
JWT_EXPIRE=7d
REFRESH_TOKEN_EXPIRE=30d
# Google OAuth
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# Stripe
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
# Email
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=
EMAIL_PASS=
# AI
HUGGINGFACE_API_KEY=
OPENAI_API_KEY=
# Server
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173VITE_API_URL=http://localhost:5000/api
VITE_SOCKET_URL=http://localhost:5000
VITE_STRIPE_PUBLISHABLE_KEY=
VITE_GOOGLE_CLIENT_ID=
VITE_APP_NAME=Scribble Blogcd backend
npm install
npm run devcd frontend
npm install
npm run dev- Vite dev server: http://localhost:5173
- API server: http://localhost:5000
Base URL: /api
POST /register,POST /login,POST /google-authGET /profile,PUT /profile- Follow/unfollow:
POST /:userId/follow,DELETE /:userId/follow - Public profile:
GET /:username
- CRUD:
GET /,POST /,PUT /:id,DELETE /:id - Likes & bookmarks:
POST /:id/like,POST /:id/bookmark - Trending & featured:
GET /trending,GET /featured
GET /:postId,POST /,PUT /:id,DELETE /:id- Like:
POST /:id/like
POST /suggest
POST /create-payment-intent,POST /create-subscriptionGET /subscription,POST /cancel-subscriptionPOST /webhook
GET /,GET /unread-countPUT /:id/read,PUT /mark-all-readDELETE /:id
GET /posts,GET /usersGET /suggestions,GET /tags/popular,GET /categories/popular
- Global Providers:
AuthProvider,SocketProvider,QueryClientProvider - Pages: Home, SignIn, SignUp, Profile, Create/Edit Post, Post Detail, Analytics, Search, Favorites, Notifications, Settings, Pricing, Admin
- Components: Modern header, buttons, inputs, loading spinner, error boundary
- Styling: Tailwind CSS + Framer Motion animations
- Rooms:
user_{id}for notifications,post_{id}for comments/typing/likes - Connection setup:
backend/server.js+frontend/src/context/SocketContext.jsx
- Set
STRIPE_SECRET_KEYandSTRIPE_WEBHOOK_SECRET - In development:
stripe listen --forward-to localhost:5000/api/payments/webhook- Uses Hugging Face API
- If missing API key, falls back to simple rule-based suggestions
- Helmet CSP, rate limiter, XSS/NoSQL sanitize, HPP
- Role-based route protection via middleware
- Input validation via
express-validator - Sensitive keys managed via
.env
- Backend: Jest + Supertest
- Frontend: Vitest + React Testing Library
- Build frontend:
cd frontend && npm run build - Serve backend:
cd backend && npm start - Use a reverse proxy (Nginx) with SSL for production
- Rich text editor UI
- Media management
- Admin moderation tools
- Email templates & in-app inbox
- Push notifications
- Advanced analytics dashboards & exports
MIT License
Made with β€οΈ by the Scribble Blog Team