Architecture
Architected with a classic Client-Server-Database structure
Frontend (React)
This app is built as a Single Page Application (SPA) using the React JavaScript library written in JSX.
- State Management: Utilizes React Hooks such as useState and useEffect to do asynchronous fetch requests and update data without reloading page.
- Networking: Asynchronous fetch requests utilizing the useEffect hook and global variables to update chat data without reloading page.
- Storage: Utilizes internal browser databases to store chat data to lighten the load of the database and only refresh new messages.
- Styling: Implemented with CSS modules and Bootstrap5 classes for a clean and responsive UI.
Backend (Node.js & Express.js)
This app utilizes a simple backend library express.js to deliver the api for data transfer and real-time events.
- REST API: Handles authentication, profile management, and refreshing data.
- Socket.io: Manages active web socket connections and broadcasts signals to users when a message is read or sent. If sent then that user is contacted and instructed to force a refresh of state.
- Middleware: Implements CORS for security, multer for file processing, and sharp for resizing photo size.
Database (MYSQL)
Relational database used to store and query all user data including profiles, messages, and contacts.
- Users: Stores hashed credentials for users and display names.
- Profile: Stores profile data linked to user by id.
- Profile Pictures: Stores all profile pictures that a user may have uploaded. Returns a standard template if none exist.
- Messages: Stores all messages linked with a from and to id linked to each user.