{"id":30171969,"url":"https://github.com/techycode-01/mern-blog","last_synced_at":"2025-08-11T22:46:12.772Z","repository":{"id":307726935,"uuid":"1030516137","full_name":"techycode-01/mern-blog","owner":"techycode-01","description":"MERN blog using tailwind css","archived":false,"fork":false,"pushed_at":"2025-08-01T19:34:59.000Z","size":146,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-01T21:42:45.904Z","etag":null,"topics":["mern-blog","mern-project","mern-stack","mern-stack-development"],"latest_commit_sha":null,"homepage":"https://mern-blog-qwor.onrender.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techycode-01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-01T19:20:36.000Z","updated_at":"2025-08-01T19:49:37.000Z","dependencies_parsed_at":"2025-08-01T21:42:49.217Z","dependency_job_id":"ed60a0a9-33ff-4099-9876-a24a18b3d7da","html_url":"https://github.com/techycode-01/mern-blog","commit_stats":null,"previous_names":["techycode-01/mern-blog"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/techycode-01/mern-blog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techycode-01%2Fmern-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techycode-01%2Fmern-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techycode-01%2Fmern-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techycode-01%2Fmern-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techycode-01","download_url":"https://codeload.github.com/techycode-01/mern-blog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techycode-01%2Fmern-blog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269969916,"owners_count":24505444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mern-blog","mern-project","mern-stack","mern-stack-development"],"created_at":"2025-08-11T22:46:08.375Z","updated_at":"2025-08-11T22:46:12.737Z","avatar_url":"https://github.com/techycode-01.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MERN Blog\n\nA full-stack blog platform built with the MERN stack (MongoDB, Express, React, Node.js).\n\n## Table of Contents\n- [Features](#features)\n- [Project Structure](#project-structure)\n- [Tech Stack](#tech-stack)\n- [API Endpoints](#api-endpoints)\n- [Main Components](#main-components)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n- [Running the App](#running-the-app)\n- [Deployment](#deployment)\n- [Contributing](#contributing)\n- [Security](#security)\n- [License](#license)\n- [Credits](#credits)\n\n## Features\n- User authentication (Sign Up, Sign In, OAuth)\n- Create, update, and delete blog posts\n- Commenting and liking system\n- User dashboard with admin and private routes\n- Responsive and modern UI with Tailwind CSS\n- State management with Redux\n- Theming support (dark/light mode)\n- Admin dashboard for managing users, posts, and comments\n- Like and reply to comments\n- Search and filter posts\n- Cloudinary integration for image uploads\n- Persistent login with JWT and cookies\n\n## Project Structure\n\n```\nmern-blog/\n├── api/                        # Backend (Node.js, Express)\n│   ├── controllers/            # Route controllers\n│   │   ├── auth.controller.js\n│   │   ├── comment.controller.js\n│   │   ├── post.controller.js\n│   │   └── user.controller.js\n│   ├── models/                 # Mongoose models\n│   │   ├── comment.model.js\n│   │   ├── post.model.js\n│   │   └── user.model.js\n│   ├── routes/                 # API routes\n│   │   ├── auth.route.js\n│   │   ├── comment.route.js\n│   │   ├── post.route.js\n│   │   └── user.route.js\n│   ├── utils/                  # Utility functions and middleware\n│   │   ├── error.js\n│   │   └── verifyUser.js\n│   └── index.js                # Server entry point\n├── client/                     # Frontend (React, Vite)\n│   ├── src/\n│   │   ├── components/         # Reusable UI components\n│   │   │   ├── CallToAction.jsx\n│   │   │   ├── Comment.jsx\n│   │   │   ├── CommentSection.jsx\n│   │   │   ├── DashboardComp.jsx\n│   │   │   ├── DashComments.jsx\n│   │   │   ├── DashPosts.jsx\n│   │   │   ├── DashProfile.jsx\n│   │   │   ├── DashSidebar.jsx\n│   │   │   ├── DashUsers.jsx\n│   │   │   ├── Footer.jsx\n│   │   │   ├── Header.jsx\n│   │   │   ├── OAuth.jsx\n│   │   │   ├── OnlyAdminPrivateRoute.jsx\n│   │   │   ├── PostCard.jsx\n│   │   │   ├── PrivateRoute.jsx\n│   │   │   ├── ScrollToTop.jsx\n│   │   │   └── ThemeProvider.jsx\n│   │   ├── firebase.js         # Firebase configuration\n│   │   ├── pages/              # Main pages\n│   │   │   ├── About.jsx\n│   │   │   ├── CreatePost.jsx\n│   │   │   ├── Dashboard.jsx\n│   │   │   ├── Home.jsx\n│   │   │   ├── PostPage.jsx\n│   │   │   ├── Projects.jsx\n│   │   │   ├── Search.jsx\n│   │   │   ├── SignIn.jsx\n│   │   │   ├── SignUp.jsx\n│   │   │   └── UpdatePost.jsx\n│   │   ├── redux/              # Redux state management\n│   │   │   ├── store.js\n│   │   │   ├── theme/\n│   │   │   │   └── themeSlice.js\n│   │   │   └── user/\n│   │   │       └── userSlice.js\n│   │   ├── main.jsx            # React entry point\n│   │   └── index.css           # Global styles\n│   ├── index.html              # HTML template\n│   ├── package.json            # Frontend dependencies\n│   ├── postcss.config.js       # PostCSS config\n│   ├── tailwind.config.js      # Tailwind CSS config\n│   └── vite.config.js          # Vite config\n├── .env                        # Environment variables\n├── package.json                # Project metadata and scripts\n└── README.md                  # Project documentation\n```\n\n## Tech Stack\n- **Frontend:** React, Vite, Redux Toolkit, Tailwind CSS, Flowbite React, React Router, Cloudinary\n- **Backend:** Node.js, Express, MongoDB, Mongoose, JWT, bcryptjs, cookie-parser, dotenv\n- **Other:** ESLint, PostCSS, Vite Proxy, React Icons\n\n## API Endpoints\n\n### Auth\n- `POST /api/auth/signup` — Register a new user\n- `POST /api/auth/signin` — Login\n- `POST /api/auth/google` — Google OAuth login\n\n### User\n- `GET /api/user/getusers` — Get all users (admin)\n- `GET /api/user/:userId` — Get user by ID\n- `PUT /api/user/update/:userId` — Update user\n- `DELETE /api/user/delete/:userId` — Delete user\n- `POST /api/user/signout` — Sign out\n\n### Post\n- `POST /api/post/create` — Create post (admin)\n- `GET /api/post/getposts` — Get posts (with filters)\n- `PUT /api/post/updatepost/:postId/:userId` — Update post (admin)\n- `DELETE /api/post/deletepost/:postId/:userId` — Delete post (admin)\n\n### Comment\n- `POST /api/comment/create` — Add comment\n- `GET /api/comment/getPostComments/:postId` — Get comments for a post\n- `PUT /api/comment/likeComment/:commentId` — Like a comment\n- `PUT /api/comment/editComment/:commentId` — Edit comment\n- `DELETE /api/comment/deleteComment/:commentId` — Delete comment\n- `GET /api/comment/getcomments` — Get all comments (admin)\n\n## Main Components\n- **Header/Footer:** Navigation and branding\n- **Dashboard:** Admin/user dashboard with stats and management\n- **PostCard:** Displays blog post summary\n- **CommentSection/Comment:** Add, view, and like comments\n- **Auth (SignIn/SignUp/OAuth):** User authentication\n- **PrivateRoute/OnlyAdminPrivateRoute:** Route protection\n- **ThemeProvider:** Dark/light mode support\n- **Projects/About:** Informational pages\n\n## Getting Started\n\n### Prerequisites\n- Node.js\n- npm or yarn\n- MongoDB database (cloud or local)\n\n### Installation\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/yourusername/mern-blog.git\n   cd mern-blog\n   ```\n\n2. Install backend dependencies:\n   ```sh\n   npm install\n   ```\n\n3. Install frontend dependencies:\n   ```sh\n   cd client\n   npm install\n   cd ..\n   ```\n\n4. Create a `.env` file in the root directory and add your MongoDB URI and JWT secret:\n   ```env\n   MONGO=your_mongodb_connection_string\n   JWT_SECRET=your_jwt_secret\n   ```\n\n5. Set up Cloudinary for image uploads in `client/.env`:\n   ```env\n   VITE_CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name\n   VITE_CLOUDINARY_UPLOAD_PRESET=your_cloudinary_upload_preset\n   ```\n\n## Running the App\n\n1. Start the backend server:\n   ```sh\n   npm run dev\n   ```\n\n2. In a new terminal, start the frontend development server:\n   ```sh\n   cd client\n   npm run dev\n   ```\n\n## Deployment\n\n### Backend Deployment\n- Deploy to platforms like Render or Heroku\n- Ensure environment variables are set in the deployment environment\n- MongoDB connection should be configured\n\n### Frontend Deployment\n- Build the frontend:\n  ```sh\n  cd client\n  npm run build\n  ```\n- Deploy to platforms like Vercel or Netlify\n- Configure environment variables for Cloudinary\n\n### Combined Deployment\n- The Express backend is already configured to serve static files from the client build\n- After building the frontend, you can deploy the entire application together\n\n## Contributing\n\n1. Fork the repository\n2. Create a new branch (`git checkout -b feature/your-feature`)\n3. Commit your changes (`git commit -m 'Add some feature'`)\n4. Push to your fork (`git push origin feature/your-feature`)\n5. Open a Pull Request\n\n## Security\n\n- Never commit sensitive data (like real `.env` values)\n- Use HTTPS in production\n- JWT and cookies are used for secure authentication\n- Passwords are hashed with bcryptjs\n- Input validation is implemented on both frontend and backend\n- CORS is configured to allow only trusted origins\n\n## License\n\nThis project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.\n\n## Credits\n\n- Inspired by modern blog platforms\n- Built by Anuj\n- Uses open source libraries and tools:\n  - [React](https://reactjs.org/)\n  - [Node.js](https://nodejs.org/)\n  - [Express](https://expressjs.com/)\n  - [MongoDB](https://www.mongodb.com/)\n  - [Tailwind CSS](https://tailwindcss.com/)\n  - [Redux Toolkit](https://redux-toolkit.js.org/)\n  - [Cloudinary](https://cloudinary.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechycode-01%2Fmern-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechycode-01%2Fmern-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechycode-01%2Fmern-blog/lists"}