A Project combining socket.io MongoDB Node and Express to make a simple encrypted web chat app.
Live Example: https://chat.zacwesleybrown.com
For development, you will only need Node.js. Optionally a node global package, Yarn which helps with installing into your environement. and if you want to run the system containerized you will need docker
-
Just go on official Node.js website and download the installer. Also, be sure to have
gitavailable in your PATH,npmmight need it (You can find git here). -
You can install nodejs and npm easily with apt install, just run the following commands.
$ sudo apt install nodejs $ sudo apt install npm -
You can use pacman or even better yay (Yet Another Yaourt).
$ sudo pacman -S nodejs $ sudo pacman -S npm$ yay nodejs $ yay npm -
You can find more information about the installation on the official Node.js website and the official NPM website.
If the installation was successful, you should be able to run the following command.
$ node --version
v17.3.0
$ npm --version
8.5.1
If you need to update npm, you can make it using npm! Cool right? After running the following command, just open again the command line and be happy.
$ npm install npm -g
-
Just go on Official Docker Docs website and Follow the instructions
-
You can install docker and docker-compose easily with apt install, just run the following commands.
$ sudo apt-get install docker $ sudo apt-get install docker-compose -
You can use pacman or even better yay (Yet Another Yaourt).
$ sudo pacman -s docker $ sudo pacman -s docker-compose$ yay docker $ yay docker-compose
After installing node, this project will need yarn too, so just run the following command.
$ npm install -g yarn
There is no settings however there is a .env file. an example.env is provided but heres an outline
SECRET="Random Secret Here"
DB_URI="mongodb://db:27017/encchat"
MODE="docker" or "local"
LOCAL_DB="mongodb://127.0.0.1:27017/encchat"
SECRET is the secret for the tokens etc. keep this secure and long and do not share it.
DB_URI is the url for the mongodb database in this case db refers to the docker container network db that is on the same network as the express server, this will be used if the MODE variable is set to "docker" or anything else othe than "local".
MODE is to determine between whether the server should be run in a docker container or locally and is mainly for the database connection.
LOCAL_DB is the url for the local mongodb instance this will be used if the MODE variable is set to "local".
feel free to make changes in index.js.
to run the system locally you can run:
$ git clone https://github.com/N3M0dropserver/EncryptedChatRoom
$ cd EncryptedChatRoom
and either:
$ npm install
$ yarn install
however for this you mut have mongo db running locally.
to install the system in docker just run:
$ docker compose build
Either:
$ yarn start
$ npm start
$ docker compose up
- Proper Diffie-Hellman key exchange between users.
- Chat can handle more than 2 users but not with encryption enabled so make it work with encryption.
- Better admin settings including kick and mute and ban and moderators etc.
- Better options panel when setting up the chat preferably when in the waiting room.
- Refactor some of the code for cleanliness and continued development.