3Mail Chat Room is a decentralized chat application built on the Internet Computer blockchain. This project combines the power of blockchain with a fun, interactive chat room experience, allowing users to communicate securely and manage their identities in a decentralized manner.
- Users can log in using their Internet Identity.
- Users who do not log in are automatically assigned an NPC-style username (e.g., NPC-1234) to participate in the chat.
- Create Username:
- Users can create a username after logging in. A "Create Username" button is displayed, which reveals a text input and "Submit" button when clicked.
- Change Username:
- Users can change their username after 24 hours. The "Change Username" button is displayed after the cooldown period.
- Admins can delete messages in the chat room.
- Admins log out using a dedicated "Admin Logout" button, which is only visible for users with admin privileges.
- Messages are updated in real-time, with new messages appearing at the bottom of the chat box.
- Users can manually scroll to the latest messages with the "Scroll to New" button.
- Dynamic UI Components:
- The UI adjusts to show relevant buttons and inputs based on user states (e.g., logged in, admin privileges).
- Mobile-Responsive Design:
- Optimized for mobile use.
- Custom Styling:
- Custom colors, fonts, and playful designs, including Comic Sans for a casual feel.
- Message Timestamps:
- Each message includes a timestamp.
- Message Deletion:
- Admins can delete messages, which disappear for all users in real-time.
- The chat room and its functionalities are hosted on the Internet Computer blockchain, ensuring decentralization, security, and persistence.
- Created by Richard Hery
Visit RichardHery.com for more projects and updates.
To run the project locally from scratch, follow these steps:
-
Clone the repository:
git clone https://github.com/dickhery/3Mail-Chat-Room cd 3Mail-Chat-Room
-
Install dependencies:
npm install
-
Start the local Internet Computer replica:
dfx start --background --clean
-
Generate necessary canister IDs:
dfx generate
-
Build the project:
dfx build
-
Update canister IDs:
- In the
canister_ids.json
file, replace the placeholder canister IDs with your own. - Hardcode the admin PID in the
main.mo
file underallowedAdmins
to give admin access.
- In the
-
Deploy the canisters locally:
dfx deploy
If you don't already have the dfx
tool installed, you need to install it. Run the following command to install dfx
:
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
After installation, confirm that dfx
is set up by checking the version:
dfx --version
Make sure you have the required dependencies, such as Node.js and npm, installed. If not, you can install them:
-
Ensure you have enough cycles:
- Manage cycles through the NNS dApp and ensure that you have enough cycles to deploy canisters on the Internet Computer.
-
Update
canister_ids.json
:- In the
canister_ids.json
file, replace the placeholder canister IDs with your own canister IDs. These canister IDs must be ones you own and control via your NNS console. - Hardcode the admin PID in the
main.mo
file by adding your Principal ID to theallowedAdmins
array for admin access.
- In the
-
Deploy the canisters to the mainnet using the following command:
dfx deploy --network ic
-
Access the deployed chat room:
- Once deployed, your chat room will be accessible via a URL like:
https://<your-canister-id>.ic0.app
- Once deployed, your chat room will be accessible via a URL like:
You can try this app live on the Internet Computer at:
3Mail Chat Room Live
- UI Enhancements: Further UI refinements for improved accessibility.
- Admin Features: Expanded tools for admins to manage chat content.
- Localization Support: Multi-language support is planned for future updates.
- Analytics: Add analytics to track chat room activity.
We welcome contributions to the project! Submit a pull request or open an issue to discuss your proposed changes.
This project is licensed under the MIT License. See the LICENSE file for more details.