Welcome to the Blog API V2! This project is an advanced version of the Blog API, designed to provide a comprehensive and efficient backend for managing blog posts, users, and comments. It is built using modern web technologies and follows best practices in API design.
- Features
- Prerequisites
- Installation
- Running the Application
- Technologies Used
- Screenshots
- Contributing
- Endpoints
- Contributing
- License
- User authentication and authorization and Logout
- JWT-based authentication
- CRUD operations for blog posts
- CRUD operations for comments and Like
- Following (Friend Request) and Follower
- Public and Private Post
- Pagination and filtering of blog posts
- Notification
- Chatting to user
- User authentication with JSON Web Tokens
- Real-time chat with WebSockets
- Create new chat rooms for Private message and Group message
- Send and receive messages in real time
- View the list of all users
- View the history of previous messages
- send files in chatroom
- user online or offline or typing message other user can see.
- user profile management.
- Python == 3.11.7
- Django == 4.0
- Redis server or you can use direct in-memory database ( comment redis server and uncomment memory database from settings.py
- node == 20.9.0
- npm == 10.1.0
- React
-
Clone the repository:
git clone https://github.com/krishna2808/Blog-API--V2.git cd Blog-API--V2
-
Install the dependencies for both the frontend and backend:
cd frontend && npm install npm start
-
Install the dependencies for the backend:
python3 -m venv venv source venv/bin/activate #Linux (activated venv) cd backend pip install -r requirements.txt python manage.py makemigrations python manage.py migrate # note if it will not proper migration then makemigrations and migrate with manually app sudo apt-get install redis-server # note if you don't want to use redis then in-memory database for development environment. sudo systemctl restart redis-server
-
Start the backend server:
cd backend python manage.py runserver
-
In a separate terminal, start the frontend application:
cd frontend npm start
-
Open your browser and navigate to
http://localhost:3000
to see the application in action.
- Sqlite: Database for storing data
- Django Rest Framework: Drf framework for building REST APIs
- React: Library for building user interfaces
- WebSockets channel: Real-time communication between client and server
- JWT: Authentication using JSON Web Tokens
- Redis server: Redis server for Websocket.
To use the API, you can send HTTP requests to the endpoints described below. You can use tools like Postman or cURL to interact with the API.
Here are some of the main endpoints available in this API:
- Register:
POST /api/auth/register
- Login:
POST /api/auth/login
- Get all users:
GET /api/users
- Get user by ID:
GET /api/users/:id
- Update user:
PUT /api/users/:id
- Delete user:
DELETE /api/users/:id
- Get all posts:
GET /api/posts
- Get post by ID:
GET /api/posts/:id
- Create new post:
POST /api/posts
- Update post:
PUT /api/posts/:id
- Delete post:
DELETE /api/posts/:id
- Get all comments:
GET /api/comments
- Get comment by ID:
GET /api/comments/:id
- Create new comment:
POST /api/comments
- Update comment:
PUT /api/comments/:id
- Delete comment:
DELETE /api/comments/:id
We welcome contributions to this project! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name
) - Make your changes
- Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature-name
) - Open a pull request
This project is licensed under the MIT License. See the LICENSE file for details.