← Back to list

ExpRes : Social Media Platform using ResDB

A Decentralised Social Media Platform with Enhanced Security, Resilience, and Content Traceability. ExpRes is based on Blockchain…

Priyadharshini Ganeshkumar · 2024-12-06 00:04 · 1 claps · 9.0 min read
#resilientdb #distributed-database #chat-application #social-media-platforms #blockchain
Open on Medium ↗
Wiki topics: CRY · Crypto & Web3 🔒 · Cybersecurity 🚀 · Self Improvement

ExpRes : Social Media Platform using ResDB

A Decentralised Social Media Platform with Enhanced Security, Resilience, and Content Traceability. ExpRes is based on Blockchain technology. To guarantee a safe and reliable user experience, ExpRes uses ResilientDB for fault-tolerant data storage, secure identity verification, transparent content governance, and privacy-preserving features.

Table of Contents:

  1. What is ExpRes ?
  2. Why Expres ?
  3. A Peek Inside ExpRes ‘s Design
  4. ExpRes Workflow
  5. Key Features & Functionalities of ExpRes
  6. Get Started with ExpRes
  7. Demo
  8. Future Scope of ExpRes
  9. Contributors

What is ExpRes ?

In today’s digital age, social media applications are essential for real-time, reliable communication. However building a chat application with message transparency and traceability is very challenging. The motivation behind this project is to develop a next-generation social media chat application — ‘ExpRes’ using ResilientDB. By leveraging the strengths of ResilientDB, the application will support seamless and reliable messaging among a large user base, while focussing on fault-tolerance, accountability and user experience. This chat platform will be tailored for ease of use and responsiveness, allowing multiple users to communicate in real-time without compromising on data integrity or performance.

Additionally, features such as immutable message history and verifiable user identities will foster trust and transparency within the community. Ultimately this project seeks to redefine online communication by integrating cutting-edge technology with an intuitive interface, setting a new standard for reliable and accountable social media interactions.

Why ExpRes ?

  • Real-time Communication : ExpRes provides real-time messaging without ever compromising on the privacy of the users or the integrity of the data. It always provides reliable communication to all kinds of users.
  • Scalability and Fault-tolerance : Since ExpRes is built on ResilientDB, it provides fault-tolerant architecture, great performance, and support for massive user bases. This guarantees that there won’t be any performance deterioration as the application grows.
  • Accountability and Traceability : ExpRes pays huge attention to the traceability and accountability of every message. Messages can be transparent and tracked, if need be. This would generate trust among its users, therefore enhancing trust in its integrity.
  • Secure Communication Ecosystem : ExpRes provides a safer, more reliable communication ecology wherein all exchanges are secure for holding valuable, effective communication.

A Peek Inside ExpRes ‘s Design :

ExpRes : Architecture Diagram

ExpRes : Architecture Diagram

Frontend (React)

For the frontend, we used ReactJS for the interactive and responsible user interface. Main features of ExpRes frontend : user registration, login, chat, create posts, report message. Here’s how we approached it:

  • Component-based Architecture: We developed reusable components for essential features like login, registration, and chat, ensuring the code remains modular and easy to maintain.
  • State Management: React’s Context API manages user authentication state to persist seamless and consistent User experiences across the app.
  • Routing: We integrated react-router-dom to route through the different pages without any page reloads.
  • API Integration: For smooth data exchange, we used Axios to connect the frontend with the backend.
  • Styling: Utilised CSS to ensure modern UI, responsiveness, and best look on all devices.

Backend (FastAPI)

The backend is designed using FastAPI, which offers speed, flexibility, and ease of integration with modern web technologies. FastAPI acts as an intermediary between the frontend and databases for tasks such as user authentication, chat management, posting creation, sending friend requests, reporting posts, and viewing chat history. It interacts with MongoDB and ResilientDB efficiently to handle data without hiccups.

  • API Development: FastAPI creates fast and scalable endpoints to handle user interactions and backend processes.
  • Database Integration: FastAPI is connected to MongoDB for storing user data and ResilientDB for decentralised storage of user posts, chats, and transaction IDs.
  • Dependency Management: FastAPI’s dependency injection system helps keep the code clean, reusable, and easy to maintain.

Databases and Additional Tools

  • MongoDB: Stores essential user data, including usernames, emails, passwords, post engagements (likes and comments), and user connections (friend requests).
  • ResilientDB: Manages the decentralised storage of user posts, chat history, and transaction IDs, ensuring efficient data handling and fault-tolerance.
  • Version Control: We used Git and GitHub to manage code changes, collaborate with the team, and maintain a smooth development process.

Together, this technology stack allows ExpRes to offer a fast, reliable, and scalable decentralised social media platform. It facilitates secure, seamless user interactions with assured data integrity and performance.

ExpRes Workflow :

Let’s see how message transfers happen in ExpRes..

Sequence Diagram 1: SendMessage

Sequence Diagram 1: SendMessage

The user initiates the process by clicking the Send Message button, which invokes the sendMessage() API. The frontend sends the request to the backend, where the FAST API processes it and acknowledges receipt by confirming that the request is received or if there’s an error in the input data.

The API then relays the message content to a Hash Algorithm, which generates cryptographic keys for secure handling of the data. These keys ensure the integrity and confidentiality of the message during its lifecycle. Once the cryptographic keys are generated, the data is passed to the GraphQL Request module, which integrates with a database layer.

asset: """
   {
     'data': 
          {
           'transactionId': 'Missing',
           'sender_username': 'Charlie', 
           'receiver_username': 'Alice'
          }
   }"""

The GraphQL request is formulated as an asset containing TransactionID, Sender and Receiver Username. Since this is a new message sent by the user, default value is assigned to the TransactionID in the asset. The asset is sent to ResDB, which returns a unique TransactionID back to the API. At last, the API sends this new TransactionID along with the content and user information to MongoDB completing the data flow cycle.

Now let’s see how forwarding a message works in ExpRes..

Sequence Diagram 2 : ForwardMessage

Sequence Diagram 2 : ForwardMessage

When a user initiates the forwarding of a message, the sendMessage() API is triggered along with the TransactionID of the original message to be forwarded. The API sends the message details to a Hash Algorithm, which generates the cryptographic keys necessary for secure communication. This ensures that the forwarded message is securely encrypted and authenticated.

Next, a GraphQL request is invoked to represent the forwarded message as an asset, with the TransactionID of original message retained in the request. This enables the system to maintain continuity and establish a linkage between the original and the forwarded message. The request is then sent to ResDB, which processes the forwarded message and generates a new TransactionID specific to the forwarded message and sends it back to the API. Again the API sends this new TransactionID along with the content and user information to MongoDB completing the data flow cycle.

Importantly, both the original message’s TransactionID and the forwarded message’s TransactionID are stored within the ResDB and MongoDB respectively. This dual storage facilitates seamless traceability of the message, enabling the system to track the lineage of the forwarded message back to its origin.

asset: """
   {
     'data': 
          {
           'transactionId': 'b6c102dd919f130c1147809550e359a97e0c72e339ebffc08d5fdc2a91299840',
           'sender_username': 'Charlie', 
           'receiver_username': 'Alice'
          }
   }"""

This process ensures secure, traceable message forwarding while maintaining data integrity and linkage between the original and forwarded messages. The system’s architecture guarantees that the relationships between messages are preserved for accountability and tracking purposes.

What if a message needs to be reported?

Sequence Diagram 3 : reportMessage

Sequence Diagram 3 : reportMessage

The process begins when the user triggers the **reportMessage()** FastAPI endpoint by selecting a message to report. This action sends the TransactionID of the reported message to the API. The Transaction ID is a unique identifier for the message, enabling the system to trace its origin and associated actions.

Once triggered, the API communicates with ResDB to retrieve the TransactionID of the original message from its audit trail of all actions performed on the platform. This allows the system to trace the message back to its source and identify the original sender.

With this information in hand, the API further queries MongoDB to find the user who sent the reported message and takes appropriate action. The user who sent the original or reported message is blocked. This is achieved by updating the user’s status in the database and setting **Block = TRUE**. The platform also confirms the action by sending a response back to the reporting user, ensuring transparency and closing the loop.

This mechanism ensures the traceability of all actions performed on the platform. By storing all user actions and accesses in ResDB, the system fosters accountability and prevents misuse. This robust reporting and moderation system strengthens trust in the platform while enabling efficient handling of reported content.

Key Features & Functionalities of ExpRes :

Register / Login — User Authentication and Account Management

Enables users to create a new account (register) or log in to existing account. This includes validating user credentials for secure access.

ExpRes : Homepage

ExpRes : Homepage

ExpRes : New User Registration and Existing User Login

ExpRes : New User Registration and Existing User Login

Send Friend Request — User Connection Management

Enables users to send friend requests to other users, initiating a connection for further interactions within the app.

Create / View Posts — Content Creation and Browsing

Allows users to create posts, share updates, and view posts created by themselves or others in their network.

ExpRes : Create New Post

ExpRes : Create New Post

Send Messages — Real-time or Asynchronous Communication

Allows users to send direct messages to their connections or friends. Message can also be forwarded to other users.

ExpRes : Chat

ExpRes : Chat

View Chat History — Message Retrieval and Display

Enables users to view their past conversations in chronological order, helping them continue conversations seamlessly.

ExpRes : Chat History

ExpRes : Chat History

Report a User — User moderation and community management

Allows users to report inappropriate content or behaviour, flagging it for review by moderators to ensure community guidelines are maintained.

ExpRes : Report a Post (1)

ExpRes : Report a Post (1)

Any user can report a post or message by using the “Report” flag button below the content if they find it offensive or inappropriate.

ExpRes : Report a Post (2)

ExpRes : Report a Post (2)

Once a message or post is reported, it will be immediately removed without further investigation, and the user who created the reported content will be flagged as BLOCKED.

ExpRes : Report a Post (3)

ExpRes : Report a Post (3)

Get Started with ExpRes :

Github Link : https://github.com/DevavratSinghBisht/ExpRes

Clone the repo using the command :

git clonehttps://github.com/DevavratSinghBisht/ExpRes.git

Follow the below steps to run the app locally -

  1. Use a terminal to cd backend in the repo.
  2. Install the dependencies using requirements.txt.
  3. Run uvicorn main:app --reload
  4. Backend should be available at localhost:8000 and the swagger documentation can be seen at localhost:8080/docs

To bring up the Frontend -

  1. Use a terminal to cd frontendin the repo.
  2. Run the commands npm install, npm build, npm start

Demo :

Here is a short overview followed by the Demo of ExpRes : https://youtu.be/KeddgKChJuA

Future Scope of ExpRes :

  1. Optimised Search Functionality : Currently, the “Find a Friend/User” feature works by just querying the database through a simple username-based search. This can be enhanced by using optimised search algorithms like prefix trees or full-text search engines to improve efficiency and accuracy.
  2. Enhanced Encryption & Decryption : In the current implementation, the transaction ID is sent to the user interface without protection, posing a potential security risk. This can be addressed by implementing efficient hashing algorithms such as SHA-256 to securely encrypt and decrypt sensitive information before transmission.
  3. Improved User Reporting Mechanism : At present, reporting a user or message leads to an immediate account block without investigation, which could result in unjustified actions. An admin UI can be developed with integrated sentiment analysis to assess the nature of reported messages. This will allow the system to make informed decisions, ensuring fairness and accuracy.
  4. Use of GraphDB for Connections : The current system fetches user connections based on the username queried through MongoDB. Migrating to GraphDB would yield an efficient way of persisting and fetching user relationships, allowing quick traversing and querying of complex social graphs.
  5. Enhanced User Experience and Wellbeing : By facilitating personalised content and network suggestions using machine learning tools, would give screen time tracking and setting up focus modes to actually try and lead customers to healthier habits online.
  6. Monetisation and Engagement Features : The platform will display text-based ads on the homepage to boost user engagement and generate new revenue opportunities. Additionally, a blockchain-based SocialCoin system can be introduced which will enable rewards, peer-to-peer payments, and ad purchases, enhancing user activity and ensuring transaction transparency.

Contributors :

Devavrat Singh Bisht : dkbisht@ucdavis.edu

Kunjal Agrawal : kmagrawal@ucdavis.edu

Priyadarshini Ganeshkumar : pganeshkumar@ucdavis.edu

Purva Khadke : pskhadke@ucdavis.edu

Vrushali Harane : vvharane@ucdavis.edu

Hope you enjoyed reading the blog :)


메타데이터
post_id
a74414219787
slug
expres-a74414219787
url
https://medium.com/@priyadharshini6508/expres-a74414219787
canonical_url
https://medium.com/@priyadharshini6508/expres-a74414219787
author_url
https://medium.com/@priyadharshini6508
status
ok
fetched_at
2026-09-07 22:17:05