This is a full-stack JavaScript blog application built with the MERN (MongoDB, Express.js, React, Node.js) stack. It provides a robust platform for users to create, share, and manage their blogs, with a rich set of features including AI-powered content generation, user interaction, and a comprehensive admin interface.
- Create and Edit Blogs: Users can post new blogs and modify their existing content.
- Public/Private Blogs: Users have the flexibility to mark their blogs as public or private.
- Like Functionality: Users can toggle likes on blogs and comments.
- Commenting System: Users can add comments to blogs, edit their own comments, and like comments.
- Follow/Unfollow Users: Users can follow other users and manage their following/followers lists.
- Firebase Google Authentication: Seamless user login and registration using Google accounts.
- AI-Generated Blog Content: Leverage Gemini to quickly generate blog content by providing a category and title.
The user dashboard offers multiple tabs for comprehensive management:
- Overview: Displays key metrics such as total likes received, total comments received, total blogs posted, and counts of public and private blogs.
- Following: Shows a list of users the current user is following, with the option to unfollow.
- Followers: Displays a list of users who are following the current user, with the option to remove followers.
- Profile: Allows users to update their password and change their avatar.
- Blogs: Provides a filterable and searchable view of the user's public, private, and all blogs. Blogs can be sorted in ascending, descending, or by popularity (based on likes).
Pagination is implemented in the Following, Followers, and Blogs tabs for efficient data display.
- Home Page: Features two main sections: "Recent Blogs" and "Popular Blogs" to highlight trending and new content.
- All Blogs Page: Accessible via the "Recent Blogs" button, this page displays all blogs with infinite scroll functionality. It includes a tab bar for filtering by blog category and a search bar for specific blog searches.
- Search Bar: A global search bar is available for users to find any specific blog.
- Admin Blog Posting: Administrators can also post blogs.
- All Public Blogs: The admin dashboard includes an "All Blogs" tab to view all public user blogs with pagination.
- User Management: The "Users" tab allows administrators to view all application users with pagination.
- Admin Overview: Provides application-wide statistics, including the total number of users and blogs.
- Frontend: Vite React
- Backend: Express.js
- Database: MongoDB
- AI Content Generation: Gemini
- Rate Limiting: Implemented to prevent abuse and ensure fair usage.
- Helmet Package: Used for setting various HTTP headers to enhance application security.
- JWT Authentication: Secure user authentication and authorization.
- Custom Error Handling: Centralized and efficient error management.
- API Response Classes: Standardized and consistent API responses.
- Swagger UI: Comprehensive API documentation for easy understanding and testing of endpoints.
- Async Handler Utility: Wraps controllers to eliminate the need for repetitive
try...catchblocks, promoting cleaner and more maintainable code. - Production Standard Coding Practices: Adherence to best practices for scalable and robust development.
To get a local copy up and running, follow these simple steps.
Ensure you have the following installed:
- Node.js (LTS version recommended)
- npm or yarn
- MongoDB (local installation or cloud-based service like MongoDB Atlas)
-
Clone the repository:
git clone <https://github.com/MuhaibShamsher/Javascript-Fullstack-Blog-App> cd Javascript-Fullstack-Blog-App/server
-
Install dependencies:
npm install # or yarn install -
Create a
.envfile in theserverdirectory and add your environment variables. Asample.envis provided as a guide. -
Run the backend server:
npm run dev # or yarn devThe backend server will typically run on
http://localhost:5000.
-
Navigate to the frontend directory:
cd Javascript-Fullstack-Blog-App/client -
Install dependencies:
npm install # or yarn install -
Create a
.envfile in theclientdirectory and add your environment variables. Asample.envis provided as a guide. -
Run the frontend development server:
npm run dev # or yarn devThe frontend application will typically open in your browser at
http://localhost:5173.