A Java + Spring Boot-based REST API that simulates a basic social media platform with features like user registration, friend requests, posts, and graph-based relationship analysis.
- User registration, friend request system, and mutual connections
- Create, update, and delete user posts
- Graph-based relationship system using BFS for:
- Shortest path between users
- Identifying top influencers
- API tested using Postman
- Persistent data storage with JSON using Gson and custom TypeAdapters
- Modular design with clean class structure and file handling
- Basic frontend integration using HTML/CSS
- Java 17
- Spring Boot (REST Controller, Dependency Injection)
- Java Collections Framework:
ArrayList,HashMap,HashSet,Queue - Gson for JSON serialization/deserialization
- Postman for API testing
- File I/O for data persistence
- HTML/CSS for UI
friendhub/ ├── src/ ├── libs/ ├── Users/ ├── Posts/ ├── .idea/ ├── https://raw.githubusercontent.com/Arfa01/FriendHub/main/.idea/libraries/Hub_Friend_3.2.zip ├── https://raw.githubusercontent.com/Arfa01/FriendHub/main/.idea/libraries/Hub_Friend_3.2.zip ├── https://raw.githubusercontent.com/Arfa01/FriendHub/main/.idea/libraries/Hub_Friend_3.2.zip
| Method | Endpoint | Description |
|---|---|---|
| POST | /users |
Register a new user |
| GET | /users |
View all users |
| POST | /friends/request |
Send friend request |
| POST | /posts |
Create a post |
| GET | /graph/shortest-path |
Shortest connection path |
| GET | /graph/influencers |
List top influencers |
- Open in IntelliJ or VS Code
- Make sure Java 17+ is installed
- Run
https://raw.githubusercontent.com/Arfa01/FriendHub/main/.idea/libraries/Hub_Friend_3.2.zip - Test endpoints via Postman or browser (if using HTML frontend)
Developed as a Data Structures & Algorithms semester project at COMSATS University, with focus on applying graph theory to real-world use cases.
- Add user authentication (JWT-based)
- Replace JSON with MySQL or MongoDB
- Build complete frontend with React or Vue