Skip to content

Catskhi/HiveMind.tmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

279 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hivemind bee

🐝 Hivemind.tmp

Hivemind.tmp is a secure real-time chat application built with Spring Boot for the backend and Next.Js for the frontend. It ensures user privacy through end-to-end encryption, where each message is secured using the recipient's public key, making it readable only by the intended recipient.

It started as a personal project to help me learn and explore the capabilities of Spring Boot, a framework I’m currently studying. Over time, I saw a lot of potential in the idea, and it will likely continue to receive updates and improvements in the future.

📚 Table of Contents

📸 Screenshots

🔐 Login Page

start.mp4

💬 Global Chat

screenshoot 1

✨ Features

  • 🧠 Real-time messaging using WebSockets
  • 🔐 End-to-end encryption for all messages
  • 👤 User authentication and authorization
  • 🌐 Global chat and private messaging (group chats coming soon)
  • 🔑 Easy private key backup
  • 🪪 Authentication using JWT

🧰 Tech Stack

Client:
Next JS TailwindCSS

Server:
Spring Hibernate Postgres

Deployment:
Docker

🔒 Hybrid Cryptography Explanation

HiveMind.tmp uses hybrid cryptography to securely encrypt all messages exchanged between users.

The application combines symmetric encryption, which is fast and efficient for encrypting the message content, with asymmetric encryption, which is used to securely share the symmetric keys between users.

🔄 Message Flow When a user sends a message:

  • A new symmetric key is generated (each message has its own key).

  • The message is encrypted using the symmetric key.

  • The symmetric key is encrypted using the recipient's public key.

  • Both the encrypted symmetric key and the encrypted message are sent to the backend.

When the recipient receives a message:

  • They use their private key to decrypt the symmetric key.

  • The decrypted symmetric key is then used to decrypt the actual message content.

The following image explains the flow:

screenshoot 1

🚀 Getting Started

Prerequisites

Clone this repository Make sure you have the following installed:

📦 Backend Setup

  1. Clone the repository
git clone https://github.com/Catskhi/HiveMind.tmp.git
  1. Configure environment variables

In the backend folder, set up the following variables on the .env file:

# Custom JWT secret
JWT_SECRET=""
# Database 
DB_URL=""
DB_USERNAME=""
DB_PASSWORD=""
# Allowed origins of the server CORS configuration
ALLOWED_ORIGINS=
# Your custom chat secret
CHAT_SECRET=

In the root folder, set up the following variables on the .env file:

POSTGRES_DB=
POSTGRES_USER=
POSTGRES_PASSWORD=
  1. Start the application with Docker:
docker-compose up

🌐 Frontend Setup

  1. In the frontend folder, install the dependencies:
npm install
  1. Set up the following environment variables:
# Example: http://localhost:8080
NEXT_PUBLIC_BACKEND_BASE_URL=
# Example: ws://localhost:8080/ws
NEXT_PUBLIC_BACKEND_BASE_WEBSOCKET_URL=
  1. Build and run the project:
npm run build && npm run start

📦 Usage/Examples

Once the application is running, you can:

  1. Create an account and back-up your private key:
  • Create an account using your credentials.
  • Copy your private key or save it as a file on the private key page.
  1. Send a Private Message:
  • Log in with your credentials.
  • Select a user from the global chat list.
  • Type your message and hit send. The recipient will see it instantly!

🤝 Contributing

I welcome contributions to HiveMind.tmp! To get started:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Make your changes and commit them (git commit -m "Add your message").
  4. Push to your fork (git push origin feature/your-feature-name).
  5. Open a Pull Request.

Please ensure your code follows the existing style and includes tests where applicable.

About

End-to-end encrypted chat application built with Spring Boot and Next.js, featuring real-time messaging, JWT authentication, and hybrid encryption.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors