This project is a
backend API
for asocial media
mock-up built withDjango REST Framework
. It provides functionalities foruser authentication
,post management
,friend management
, andpost reactions
, offering a rich foundation for building a social media platform.
Download and install Docker Engine.
Change directory and go to simple_social
cd simple_social
Run docker compose build command to build the Docker images for the services defined in the docker-compose file.
docker compose -f docker-compose.yml build
Run docker compose up command to start and run the containers for the services defined in the docker-compose.yml file.
docker compose -f docker-compose.yml up
You backend should be up and accessible from here.
- Uses JWT for secure authentication.
- Endpoint to refresh JWT access token by sending a refresh token is available.
- Endpoint:
/account/api/signup/
- Method:
POST
- This API endpoint allows a new user to sign up.
- Request Body:
{ "username": "Zve", "first_name": "string", "last_name": "string", "email": "[email protected]", "country_code": "string", "phone_number": "string", "password": "string", "confirm_password": "string" }
- Endpoint:
/account/api/signin/
- Method:
POST
- This API endpoint allows a user to log in.
- Request Body:
{ "username": "string", "password": "string" }
- Endpoint:
/account/api/signin/refresh/
- Method:
POST
- This API endpoint allows a user to refresh their JWT access token by sending a refresh token.
- Request Body:
{ "token": "string" }
- Endpoint:
/post/api/create/
- Method:
POST
- This API endpoint allows a user to create a new post.
- Request Body:
{ "images": [ { "image": "string" } ], "tags": [ { "tag": "string", "type": "HASHTAG" } ], "text_content": "string", "share_with": "PUBLIC", "is_active": true }
- Endpoint:
/post/api/{uuid}/
- Method:
GET
PUT
PATCH
DELETE
- This API endpoint allows a user to retrieve a specific post using the
GET
method, allows a user to update a post usingPUT
orPATCH
methods and allows a user to delete a post using theDELETE
method.
- Endpoint:
/post/api/{uuid}/react/
- Method:
POST
- The application supports reactions to posts such as LIKE, WOW, SAD, ANGRY, LOVE, and HAHA.
- Reactions are processed in batches every 10 seconds.
-
- Request Body:
{ "type": "LIKE" }
The application manages friendships using a Neo4J
database.
- Endpoint:
/relations/api/send_friend_requests/{uuid}/
- Method:
POST
- This API endpoint allows a user to send a friend request.
- Endpoint:
/relations/api/accept_friend_requests/{uuid}
- Method:
POST
- This API endpoint allows a user to accept a friend request.
- Endpoint:
/relations/api/cancel_friend_requests/{uuid}/
- Method:
DELETE
- This API endpoint allows a user to cancel a sent friend request.
- Endpoint:
/relations/api/reject_friend_requests/{uuid}/
- Method:
POST
- This API endpoint allows a user to reject a friend request.
- Endpoint:
/relations/api/unfriend/{uuid}/
- Method:
POST
- This API endpoint allows a user to unfriend a user who is already a friend.
- Endpoint:
/relations/api/friend_requests_sent
- Method:
GET
- This API endpoint allows a user to retrieve the friend requests they have sent.
- Endpoint:
/relations/api/friend_requests_received/
- Method:
GET
- This API endpoint allows a user to retrieve the friend requests they have received.
The application provides friend recommendations, which are generally friends of friends.
These recommendations are pre-calculated daily and stored in a Redis
cache.
- Endpoint:
/relations/api/friend_recommendations/
- Method:
GET
- This API endpoint allows a user to retrieve friend recommendations.
The user's timeline is generated and calculated daily, then stored in a Redis cache.
- Endpoint:
/retrieve-post/api/timeline/
- Method:
GET
- This API endpoint allows a user to retrieve their timeline.
- Endpoint:
/retrieve-post/api/post_by_user/{uuid}/
- Method:
GET
- This API endpoint allows a user to retrieve the posts of a specific user.
Backend: Python
Django
Django REST Framework
Authentication: JWT
Database: PostgreSQL
Graph Database: Neo4J
Cache: Redis
Async Processing: Celery
Detailed API documentationis provided via a dedicated API documentation tool Swagger
.
Refer to the documentation for specific endpoint details, request parameters, and response formats here.
You can use tools like curl or Postman to interact with the APIs.
Contributions are welcome! Please open an issue or submit a pull request for any changes or improvements.
👤 Prashant Mishra
- LinkedIn: @prashant-manoj-mishra
- Github: @mishraprashant1
- Twitter: @iamjunooo