A modern, full-stack blogging platform with rich text editing, syntax highlighting, authentication, and AI-powered blog generation. Built with the MERN stack and Google GenAI.
-
π Secure authentication system with:
- Access & Refresh Tokens (JWT)
- HttpOnly cookies for storing tokens securely
- Hashed passwords using
bcrypt
-
ποΈ Rich Text Editor using Quill.js
-
π€ AI Blog Writing powered by Google GenAI
-
π‘ Syntax Highlighting with Highlight.js
-
β±οΈ Relative timestamps with Moment.js
-
π§Ό HTML sanitization using
dompurify -
π οΈ File uploads via Multer and ImageKit
-
π§βπΌ Admin dashboard with blog and comment moderation tools:
- View all blogs created by the logged-in admin
- Approve or delete user comments
- Toggle publish/unpublish status of blogs
- Access dashboard metrics (total blogs, drafts, and comments count)
-
βοΈ State Management via Redux Toolkit
-
π£ Toast Notifications with
react-hot-toast -
π¨ Tailwind CSS for styling
-
π Smooth animations using Framer Motion
-
βοΈ Frontend deployed on Vercel
-
βοΈ Backend deployed on Railway - Deployed Backend repo
- React 18 (latest stable)
- Vite 7
- Tailwind CSS 4
- React Router v7
- Quill.js (Rich Text Editor)
- Highlight.js (Code syntax highlighting)
- Redux Toolkit (State management)
- Axios
- DOMPurify (HTML sanitization)
- Moment.js
- Framer Motion (Animations)
- react-hot-toast (Notifications)
- @tailwindcss/vite (Vite plugin for Tailwind)
- Node.js (ESModules)
- Express v5
- MongoDB with Mongoose
- JWT Authentication:
- Access Token (short-lived)
- Refresh Token (long-lived)
bcryptfor secure password hashing π- Google GenAI SDK (
@google/genai) for AI blog creation - Multer (File uploads handling)
- ImageKit SDK (Cloud image uploads)
- Cookie-parser (HttpOnly cookie support)
- CORS & dotenv for environment config
- Nodemon (Dev server reload)
- Prettier (Code formatting)
backend
βββ public
β βββ temp ( for storing the image uploaded on server )
βββ src
βββ app.js
βββ constants.js
βββ controllers
β βββ admin.controller.js
β βββ blog.controller.js
β βββ user.controller.js
βββ db
β βββ connection.js
βββ gemini
β βββ gemini.js
βββ index.js ( entry point )
βββ middleware
β βββ auth.middleware.js
β βββ multer.middleware.js
βββ models
β βββ blog.model.js
β βββ comments.model.js
β βββ user.model.js
βββ routes
β βββ admin.route.js
β βββ auth.route.js ( refresh access token )
β βββ blog.route.js
β βββ user.routes.js
βββ utils
βββ apiError.js
βββ apiResponse.js
βββ asyncHandler.js
βββ imageKit.js
frontend
βββ index.html
βββ public
β βββ favicon.svg
βββ src
β βββ App.css
β βββ App.jsx
β βββ assets/
β βββ components
β β βββ Blogcard.jsx
β β βββ Bloglist.jsx
β β βββ Footer.jsx
β β βββ Header.jsx
β β βββ Loader.jsx
β β βββ Logo.jsx
β β βββ NavBar.jsx
β β βββ Newsletter.jsx
β β βββ ProtectedRoute.jsx
β β βββ admin
β β βββ BlogTableItem.jsx
β β βββ CommentTableItem.jsx
β β βββ Login.jsx
β β βββ Register.jsx
β β βββ Sidebar.jsx
β βββ hooks
β β βββ typingHook.jsx
β βββ index.css
β βββ main.jsx
β βββ pages
β β βββ Blog.jsx
β β βββ Home.jsx
β β βββ admin
β β βββ Addblog.jsx
β β βββ Comments.jsx
β β βββ Dashboard.jsx
β β βββ Layout.jsx
β β βββ Listblog.jsx
β βββ store
β β βββ slices
β β β βββ appSlice.js
β β βββ store.js
β βββ utils
β βββ RefreshAccessToken.jsBelow is the backend model schema showing the relations between users, blogs, and comments tables:
git clone https://github.com/pixel-prady/blogify.git
cd blogifyCreate .env files in both your backend and frontend folders with the following variables:
PORT=8000
MONGODB_URI=your_mongodb_connection_string
CORS_ORIGIN=http://localhost:5173
IMAGEKIT_PUBLIC_KEY=your_imagekit_public_key
IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key
IMAGEKIT_URL_ENDPOINT=your_imagekit_url_endpoint
ACCESS_TOKEN_SECRET=your_jwt_access_token_secret
ACCESS_TOKEN_EXPIRY=30m
REFRESH_TOKEN_SECRET=your_jwt_refresh_token_secret
REFRESH_TOKEN_EXPIRY=2d
GEMINI_API_KEY=your_google_genai_api_keyVITE_BASE_URL="http://localhost:8000"cd backend
npm install
npm run devcd frontend
npm install
npm run devThe backend exposes the following API endpoints, grouped by functionality:
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Register a new user |
| POST | /login |
User login |
| POST | /logout |
Logout (authenticated) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /all |
Get all blogs |
| GET | /:blogId |
Get a blog by ID |
| POST | /add-comment |
Add a comment to a blog |
| POST | /comments |
Get comments for a blog |
| POST | /addBlog |
Add a new blog (authenticated) |
| POST | /delete |
Delete a blog by ID (authenticated) |
| POST | /toggle-publish |
Toggle publish status (authenticated) |
| POST | /generate |
Generate AI-powered blog content (authenticated) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /comments |
Get all comments (authenticated) |
| GET | /blogs |
Get all blogs of logged-in user (authenticated) |
| POST | /delete-comment |
Delete a comment by ID (authenticated) |
| POST | /approve-comment |
Approve a comment (authenticated) |
| GET | /dashboard |
Get admin dashboard data (authenticated) |
- Routes related to token refresh and authentication management.
Note: Routes marked with
(authenticated)require a valid JWT access token in the request headers.
Blogify handles images with a hybrid approach of temporary local storage and cloud hosting via ImageKit.io, ensuring fast delivery and optimized space usage.
β¨ Instant UI Transformation
Change a single CSS variable in your index.css to completely restyle the entire application β including all SVG icon colors:
@theme {
--color-primary: #711400;
}Contributions are welcome! Feel free to open issues or submit pull requests for improvements or bug fixes.

