A full-stack blog application that allows users to create, read, update, and delete blog posts.
- User authentication and authorization
- Create, read, update, and delete blog posts
- Comment on blog posts
- User profiles
- Responsive design
- Frontend: React.js,Tailwind CSS
- Backend: Node.js, Express.js
- Database: MongoDB
- Authentication: JWT (JSON Web Tokens)
The application follows a client-server architecture:
-
Frontend (Client-Side):
- Built with React.js, a JavaScript library for building user interfaces. It handles the presentation layer, allowing users to interact with the application.
- Styled with Tailwind CSS, a utility-first CSS framework for rapid UI development.
- Communicates with the backend via HTTP requests to the defined API endpoints.
- Manages user sessions and interactions.
-
Backend (Server-Side):
- Developed using Node.js and the Express.js framework. It provides a RESTful API for the frontend.
- Handles business logic, including:
- User authentication and authorization using JWT (JSON Web Tokens).
- CRUD (Create, Read, Update, Delete) operations for blog posts.
- Data validation and processing.
- Interacts with the database to store and retrieve data.
-
Database:
- MongoDB, a NoSQL document database, is used for data persistence. It stores user information, blog posts, and potentially other related data like comments.
-
Overall Structure:
- The frontend and backend are developed as separate concerns but are part of the same project.
- The backend exposes a set of API endpoints that the frontend consumes to display data and perform actions.
- This separation allows for independent development and scaling of the frontend and backend components.
- Node.js (v14 or later)
- MongoDB
- npm or yarn
-
Clone the repository:
git clone https://github.com/dawgdevv/Blog_app.git cd Blog_application -
Install dependencies:
# Install backend dependencies npm install # Install frontend dependencies cd client npm install cd ..
-
Environment Configuration: Create a
.envfile in the root directory with the following variables:PORT=5000 MONGODB_URI=mongodb://localhost:27017/blog_app JWT_SECRET=your_jwt_secret_key
-
Start the development servers:
# Run backend and frontend concurrently on seprate terminals npm run dev -
The application will be running at:
- Backend: http://localhost:5000
- Frontend: http://localhost:5173
-
URL:
/api/users/register -
Method:
POST -
Body:
{ "name": "string", "email": "string", "password": "string" } -
Response: JWT token with success message
-
URL:
/api/users/login -
Method:
POST -
Body:
{ "email": "string", "password": "string" } -
Response: JWT token with success message
- URL:
/api/users/profile - Method:
GET - Auth: Required
- Response: User profile object
-
URL:
/api/blogs/getblogs -
Method:
GET -
Query Parameters:
page: Page number (default: 1)limit: Posts per page (default: 6)
-
Response:
{ "blogs": [Array of blog objects], "totalPages": "number", "currentPage": "number", "totalCount": "number" }
- URL:
/api/blogs/getblogs/:id - Method:
GET - Response: Blog object with populated author details
-
URL:
/api/blogs/create -
Method:
POST -
Auth: Required
-
Body:
{ "title": "string", "content": "string", "coverImage": "string" } -
Response: Created blog object
-
URL:
/api/blogs/update/:id -
Method:
PUT -
Auth: Required (post owner only)
-
Body:
{ "title": "string", "content": "string", "coverImage": "string" } -
Response: Updated blog object
- URL:
/api/blogs/delete/:id - Method:
DELETE - Auth: Required (post owner only)
- Response: Deleted blog with success message
- URL:
/api/blogs/getblogs/user - Method:
GET - Auth: Required
- Response: Array of blog objects authored by current user
- URL:
/api/blogs/getblogs/user/:userId - Method:
GET - Auth: Required
- Response: Array of blog objects authored by specified user
- URL:
/api/blogs/like/:id - Method:
POST - Auth: Required
- Response: Like status with counts
- URL:
/api/blogs/dislike/:id - Method:
POST - Auth: Required
- Response: Dislike status with counts
- URL:
/api/blogs/like-status/:id - Method:
GET - Auth: Required
- Response: Current like/dislike status and counts
- URL:
/api/comments/blog/:blogId - Method:
GET - Response: Array of comment objects with replies
-
URL:
/api/comments/create -
Method:
POST -
Auth: Required
-
Body:
{ "content": "string", "blogId": "string", "parentCommentId": "string (optional)" } -
Response: Created comment object
-
URL:
/api/comments/update/:id -
Method:
PUT -
Auth: Required (comment author only)
-
Body:
{ "content": "string" } -
Response: Updated comment object
- URL:
/api/comments/delete/:id - Method:
DELETE - Auth: Required (comment author only)
- Response: Success message
- Grammar checking and corrections
- Content enhancement suggestions
- Tone adjustment for better engagement
- Real-time writing feedback using Hugging Face AI API
- Three analysis modes:
- Grammar & Style
- Content Enhancement
- Tone Adjustment
- Confidence scoring for suggestions
- Batch apply improvements
-
Streak System
- Daily writing streaks
- Streak freezes (3 per user)
- Weekly challenges
- Activity heatmap
- Consistency tracking
-
Level System
- Experience points (XP) for activities
- Level progression
- Milestone rewards
- XP bonuses for consistency
-
Badges
- First Post ๐
- Week Warrior ๐ฅ (7-day streak)
- Month Master ๐ (30-day streak)
- Century Champion ๐ (100-day streak)
- Rising Star โญ (Level 5)
- Blog Veteran ๐๏ธ (Level 10)
- Like/Dislike system
- Nested comments
- Reading time estimates
- Post reaction statistics
- Author profiles
PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
HUGGINGFACE_API_KEY=your_huggingface_api_key- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.