This project is a full-stack web application for a blog platform that allows users to create, view, search, and interact with blog posts. The platform is designed with a modern tech stack, featuring a React-based frontend and an Express.js backend, integrated with MongoDB for data storage and Firebase for image storage.
- User Authentication: Users can sign up, log in, and manage their profiles.
- Blog Post Creation: Users can create new blog posts with text and images.
- Search Functionality: Users can search for blog posts by title, author, description, or category.
- Commenting System: Users can comment on blog posts.
- Like and Unlike: Users can like and unlike blog posts.
- Category and Author Pages: Users can view blog posts filtered by categories or specific authors.
- Responsive Design: The application is designed to be responsive and user-friendly across various devices.
- React: A JavaScript library for building user interfaces.
- React Router: A library for handling routing in React applications.
- Axios: A promise-based HTTP client for making requests to the backend.
- Tailwind CSS: A utility-first CSS framework for styling the application.
- Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine.
- Express.js: A web application framework for Node.js.
- Mongoose: An ODM (Object Data Modeling) library for MongoDB and Node.js.
- MongoDB: A NoSQL database for storing blog posts, user data, and comments.
- GridFS: A specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.
- Multer: A middleware for handling
multipart/form-data, primarily used for uploading files. - JWT (JSON Web Tokens): For secure user authentication.
- components: Contains reusable React components like
BlogPost,Comment,SearchResults, etc. - pages: Contains page components for different routes like
Home,Profile,Search, etc. - App.jsx: The main component that sets up routing and includes global providers.
- index.js: The entry point of the React application.
- blogController.js: Handles logic for creating, retrieving, updating, deleting blogs, and searching blogs.
- commentController.js: Manages comments on blog posts.
- blogRoutes.js: Defines routes for blog-related endpoints.
- authRoutes.js: Manages authentication-related routes.
- blogModel.js: Mongoose schema and model for blog posts.
- userModel.js: Mongoose schema and model for users.
- commentModel.js: Mongoose schema and model for comments.
- gridFsConfig.js: Configures GridFS for storing images.
- Node.js and npm installed
- MongoDB instance running
-
Clone the repository:
git clone https://github.com/yourusername/blog-platform.git cd blog-platform -
Navigate to the
backenddirectory:cd backend -
Install backend dependencies:
npm install
-
Create a
.envfile and add your MongoDB connection string:MONGO_URI=your_mongodb_connection_string PORT=5555 -
Start the backend server:
npm start
-
Navigate to the
frontenddirectory:cd frontend -
Install frontend dependencies:
npm install
-
Start the frontend development server:
npm start
For deployment, you can use platforms like Heroku, Vercel, or AWS for the backend and Netlify or Vercel for the frontend. Ensure that the environment variables are set correctly and that MongoDB is accessible from the deployed environment.
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.