Connect with fellow book lovers through Readerly! You can create your profile to display your preferences in books and chat with friends who enjoy similar genres (which is made easier by our genre-specific search feature). You can discover new books through our genre-specific book search feature which fetches books through an API, upload photos of your current reads and reach out to other users to form book clubs to discuss and belong.
- Clone the repository
git clone https://github.com/anafarmus1/Readerly.git- Run the
Main.javafile
cd src/
javac Main.java
java MainMain.javais the entry point for client-server connection and GUI initialization.
- Phase 1 - Vocareum Workspace - Ana Farmus
- Phase 2 - Vocareum Workspace - Sahil Jain
- Phase 3 - Vocareum Workspace - Sahil Jain
- Presentation - Nandini Vakde
- Report - Nandini Vakde
UserInterface Class:Creates an interface for theUserclass.User Class:- Represents a user on the Readerly key attributes:
username, password, displayName, genre, and profilePhotoPath. - Manages lists of friends and blocked users.
- Provides methods to add, remove, block, unblock other users, access and modify user details.
- Implements Serializable to support data persistence.
- Represents a user on the Readerly key attributes:
MessageInterface Class:Creates an interface for theMessageclass.Message Class:- Represents a message of a
User. - Each message has attributes like
sender, chat and contents (text/photo). - The message class provides methods for storing message data and sending text and photo messages.
- Represents a message of a
ChatInterface Class:Creates an interface for theChatclass.Chat Class:- Represents a conversation between two users.
- It maintains a list of messages exchanged between the users.
- Provides functionality to add and get messages between two users.
InvalidChatException: Exception class for Invalid chats.
GroupChatInterface Class:Creates an interface for theChatclass.GroupChat Class:- Represents a group chat that allows multiple users to communicate.
- This class manages the list of members and the messages exchanged within the chat.
BooksAPI:- BooksAPI class provides functionality to fetch a list of books from the Google Books API based on a specified genre.
- The API uses the Google Books API key retrieved from environment variables and retrieves random book details — title, authors, description, and image URL for up to 10 books.
DatabaseInterface:Creates an interface for the Database class.Database:- The Database class provides a singleton implementation of a file-based database that stores
UserandChatobjects in a serialized format. - This class allows for adding, retrieving, searching, and deleting users and chats, as well as serializing the data to disk for persistence.
- The Database class provides a singleton implementation of a file-based database that stores
ClientInterface Class:Creates an interface for theClientclass.Client Class:Clientclass to handle communication with the server.- The class connects to the server, sends commands, and reads responses.
- It also handles the user object associated with the client and manages socket connections.
ServerInterface Class:Creates an interface for theserverclass.Server Class:- The
Serverclass is responsible for managing multiple client connections and handling different commands from clients. - It listens for incoming client connections and processes the following commands from client:
- The
1. "LOGIN | [jain719, purduecs]"
2. "CREATE_USER | [...User]"
3. "SEARCH_USER | {searchQuery}"
4. "REMOVE_USER | {username}"
5. "UPDATE_PROFILE | [{OLD} username, displayName, password] - [{NEW} username, displayName, password]"
6. "ADD_FRIEND | [{...User1}] - [{...User2}]"
7. "REMOVE_FRIEND | [{...User1}] - [{...User2}]"
8. "BLOCK_USER | [{...User1}] - [{...User2}]"
9. "UNBLOCK_USER | [{...User1}] - [{...User2}]"
10. "FETCH_BOOKS | {genreSearchQuery}"
11. "CREATE_TWO_USER_CHAT | [{...User1}] - [{...User2}]"
12. "CREATE_GROUP_CHAT | {groupChatName} - [{...User1}] - [{...User2}] - [{...User3}]"
13. "SEND_GROUP_MESSAGE | {groupChatName} - [{...senderUser}] - {messageToSend}"
14. "GET_CHATS | {username}"
15. "SEND_MESSAGE | [{...senderUser}] - [{...receiverUser}] - {messageToBeSent}"
16. "DELETE_MESSAGE | [{...senderUser}] - [{...receiverUser}] - {messageToBeDeleted}"
17. GET_USER | {username}
18. GET_USERS
1. "LOGIN | [jain719, purduecs]"
2. "CREATE_USER | [jain719, password, Sahil Jain, ROMANCE, /path/to/photo1]"
3. "REMOVE_USER | jain719"
4. "UPDATE_PROFILE | [jain719, purduecs, Sahil Jain] - [jain123, purduecs, Jain Sahil]"
5. "ADD_FRIEND | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani]"
6. "REMOVE_FRIEND | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani]"
7. "BLOCK_USER | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani]"
8. "UNBLOCK_USER | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani]"
9. "FETCH_BOOKS | romance"
10. "CREATE_TWO_USER_CHAT | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani]"
11. "CREATE_GROUP_CHAT | RollaRappaGang - [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani] - [rperiwal, Raghav Periwal]"
12. "SEND_GROUP_MESSAGE | RollaRappaGang - [jain719, Sahil Jain] - hello gang! wassup?"
13. "GET_CHATS | jain719"
14. "SEND_MESSAGE | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani] - haan mere cheeteh!"
15. "DELETE_MESSAGE | [jain719, Sahil Jain] - [fmekrani, Faheem Mekrani] - sorry cheeteh!"
16. "SEARCH_USER | ROMANCE"
- Standard button style with a dark blue background.
- Alternate style with a light blue background and dark blue text.
- Customizable background color.
- Rounded corners and smooth button appearance.
- Action listener to execute a custom action when the button is clicked.
- Holds all the constant values used throughout the application.
- Includes predefined colors, window dimensions, font settings, padding, and other UI-related properties.
- Referenced in other classes to maintain uniformity and avoid hardcoding values throughout the application.
- Represents the main GUI window for the application, which handles the layoutand management of different pages.
- Uses a CardLayout to switch between various pages in the application.
- Follows the Singleton pattern to ensure that only one instance of the window is created throughout the application.
- Allows customization of the label's text, font size, and boldness.
- Uses predefined color and font constants from the Constants class for consistent UI styling.
- Centered and visible with the specified appearance, including support for both regular and bold font weights.
- Used to load and display an image as a logo.
- Image is scaled to fit the specified width and height.
- If not found, a fallback text "Logo Not Found" is displayed instead. The logo is centered within the label.
- Extends
JPaneland is used to add a vertical margin or spacing between other components in the layout. - Height is configurable through the constructor
- Panel is set to be non-opaque so it does not render any background.
- Provides an enhanced
JPanelwith a default verticalBoxLayoutand a white background color. - Allows for customization of the layout manager
- panel style is initialized with visibility, opacity, and background color settings.
- Extends
JPasswordFieldand adds support for placeholder text that disappears when the field is focused and reappears when the field is empty. - Also provides styling with custom colors, font, and border.
- Implements the
Borderinterface and provides a border with rounded corners. - Border radius and color can be customized.
- Extends
JTextFieldto provide a text field with a placeholder text that disappears when the field is focused and reappears when the field is empty. - It also provides rounded corners for a smooth appearance.
- A base class representing a page in the application. It serves as a foundation for all specific pages (e.g., login page, dashboard, etc.) by providing essential functionality for initializing page content, adding components to the page, and handling error messages.
- Includes a reference to the current client (user), the GUI window that contains the page, and a custom panel to display components.
- Initialization occurs asynchronously using
SwingUtilitiesto ensure UI elements are updated on the Event Dispatch Thread. - Subclasses of Page should override the
initializeContentandaddComponentsmethods to define their specific UI components and layout.
- This interface outlines the structure that any page class must follow, including methods for initializing the content and adding components to the page.
- Implementing class will define how content is set up (e.g., labels, buttons, input fields) and how components are added to the page.
- The landing page that allows users to either log in or register for the app.
- The page where users log in using their username and password to access their accounts.
- Represents the registration page for new users.
- Allows a new user to enter their details (name, username, password, favorite genre), upload a profile photo, and register an account.
- Validates the input and communicates with the server to create a new user account
- Serves as the central hub for users to navigate through the application. It provides buttons for accessing various sections, including:
- View/Edit Profile - Search Users - Search Books - View Chats - Create Chat - Create Group Chat - View Friends - Logout - Also displays a personalized welcome message with the user's display name and username.
- Allows users to quickly access key features after logging in.
- Allows users to edit their profile information.
- This includes fields for updating the user's display name, username, password, favorite genre, and profile photo.
- Designed to provide a user-friendly interface for managing personal profile data
- Also allows users to upload a new profile photo. Upon saving, the updated information is sent to the server to update the user's profile.
- Represents the page where users can search for books by genre.
- Allows users to input a genre, perform the search, and display results in a separate dialog.
- Communicates with the BooksAPI to fetch the relevant books based on user input.
- Provides the user with an option to navigate back to the dashboard.
- Allows users to search for other users by username.
- Includes a text field where users can enter a search query, a button to initiate the search, and a list to display the search results.
- Results show the usernames of matching users, and clicking on a username opens their profile.
- Key features:
- Provides a search field for the user to input a query to search for other users.
- Displays a list of matching users based on the search query.
- Excludes the current user's own profile from the search results.
- Each search result is clickable, leading to the user's profile page.
- If no users are found, an informational message is displayed.
- Allows users to send and receive text messages, upload photos, and delete messages.
- Provides functionality to display the chat history and navigate back to the dashboard.
- Relies on a Client object for communication with the server and uses components such as labels, buttons, and panels to create the UI.
- This page allows the user to input the chat name and the usernames of two other users they wish to add to the group chat
- Sends a command to the server to create the chat and handles success or failure feedback.
- Uses components like text fields, labels, buttons, and a logo for user interaction and navigation.
- Enables the user to create a new one-on-one chat with another user. The user is prompted to enter the username of the second user, and upon submission, the system sends a request to the server to create the chat.
- Key features:
- User inputs the username of the person they want to chat with.
- A request is sent to the server to create the chat if the username is valid.
- Provides feedback on whether the chat creation was successful or failed.
ViewChatsPage- A page displaying a list of individual and group chats the user is part of.- Provides buttons for each chat, which, when clicked, will navigate the user to the corresponding chat page. The page also includes a back button that navigates to the dashboard.
- Key Features:
- Displays a list of individual chats (private chats).
- Displays a list of group chats.
- Clicking on a chat navigates to the corresponding chat page.
- Includes a back button to return to the dashboard.
- shows a list of friends, with each friend displayed as a button.
- When clicked, the button redirects the user to the selected friend's profile page. The page also includes a back button to return to the dashboard.
- Features:
- Displays a list of friends.
- Each friend's username is shown as a button.
- Clicking a friend's button opens their profile page.
- Includes a back button to return to the dashboard
- Creates a page that is shown after the "View Profile" button is clicked on the main menu.
- Displays the user's profile information, including their display name, username, favorite book genre, and options for interacting with the user (adding/removing as a friend, blocking/unblocking, and viewing their photo).
- Features:
- Displays user's display name, username, and favorite book genre.
- Buttons to add or remove the user as a friend.
- Buttons to block or unblock the user.
- Option to view the user's profile photo.
- A back button to return to the previous page or dashboard.
DatabaseTest:Unit tests for theDatabase&Userclass of the Readerly application. This class verifies core functionality such as adding, retrieving, deleting, blocking, and unblocking users, as well as friend management and data persistence. The tests ensure that each function of the Database class operates as expected.
ChatAndMessageTest:Unit tests for theChat&Messageclass, ensures proper functionality of chat creation, membership management, message handling, message sending, storing and retrieving message data, and message data persistence.
GroupChatTest:Unit tests for theGroupChatclass. Verifies proper functionality of the GroupChat class, including adding members, removing members, message sending, storing and retrieving message data, and message data persistence.
NetworkTest:Unit tests for theNetworkclass. It ensures that the server and client communication is working as expected and validates the commands issued to the server. The tests cover scenarios like user creation, login, profile updates, friend management, blocking/unblocking users, book fetching, chats, and group messaging functionality.
-
Photo Messaging:In theChatpage, users can upload and view photos while texting. -
Profile Photo Upload & View:In theView/Edit Profilepage, users can view their current profile photo which they uploaded during creating their account and upload a new profile photo as well.
.
└── Readerly/
├── assets/
│ ├── fonts/
│ │ └── Inter.ttf
│ ├── chat/
│ │ ├── All Chat photos (Photo messaging)
│ ├── childrenFetch.png
│ ├── horrorFetch.png
│ ├── landing.svg
│ ├── pfp.jpg
│ ├── pfpTest1.png
│ ├── pfpTest2.png
│ └── pfpTest3.png
├── data/
│ ├── chatData.dat
│ ├── groupChatData.dat
│ ├── networkTest.dat
│ ├── test.ser
│ ├── testData.dat
│ └── userData.dat
├── lib/
├── src/
│ ├── Components/
│ │ ├── Button.java
│ │ ├── Constants.java
│ │ ├── GUIWindow.java
│ │ ├── Label.java
│ │ ├── Logo.java
│ │ ├── Margin.java
│ │ ├── Panel.java
│ │ ├── PasswordField.java
│ │ ├── RoundedBorder.java
│ │ └── TextField.java
│ ├── Database/
│ │ ├── Database.java
│ │ └── DatabaseInterface.java
│ ├── Network/
│ │ ├── Client.java
│ │ ├── ClientCommands.java
│ │ ├── ClientInterface.java
│ │ ├── Server.java
│ │ ├── ServerCommands.java
│ │ └── ServerInterface.java
│ ├── Objects/
│ │ ├── API/
│ │ │ └── BooksAPI.java
│ │ ├── Exceptions/
│ │ │ ├── InvalidChatException.java
│ │ │ ├── InvalidChatExceptionInterface.java
│ │ │ ├── UserNotFoundException.java
│ │ │ └── UserNotFoundExceptionInterface.java
│ │ ├── Chat.java
│ │ ├── ChatInterface.java
│ │ ├── GroupChat.java
│ │ ├── GroupInterface.java
│ │ ├── Message.java
│ │ ├── MessageInterface.java
│ │ ├── User.java
│ │ └── UserInterface.java
│ ├── Pages/
│ │ ├── ChatPage.java
│ │ ├── CreateGroupChatPage.java
│ │ ├── CreateTwoUserChatPage.java
│ │ ├── DashboardPage.java
│ │ ├── EditProfilePage.java
│ │ ├── GroupChatPage.java
│ │ ├── LandingPage.java
│ │ ├── LoginPage.java
│ │ ├── Page.java
│ │ ├── PageInterface.java
│ │ ├── RegisterPage.java
│ │ ├── SearchBooksPage.java
│ │ ├── SearchUsersPage.java
│ │ ├── ViewChatsPage.java
│ │ ├── ViewFriendsPage.java
│ │ └── ViewProfilePage.java
│ └── Main.java
├── tests/
│ ├── ChatAndMessageTest.java
│ ├── DatabaseTest.java
│ ├── GroupChatTest.java
│ └── NetworkTest.java
├── .gitignore
├── README.md
└── Readerly.iml
- Aryan Bakshi (bakshi7@purdue.edu)
- Ana Farmus (afarmus@purdue.edu)
- Nandini Vakde (nvakde@purdue.edu)
- Sahil Jain (jain719@purdue.edu)



