Table of Contents
Chat apllication where you can
- as user:
- chat with others in chat rooms,
- create your own chat rooms with your own permissions for users / roles
- addidionaly as administrator:
- create/delete ranges,
- edit other users profiles,
- add ranges to other users,
- ban and unban users from chat
- React
- MongoDB
- SocketIO
- Node
-
MongoDB(
v6.0.4^
)- Community Server installed and running on your local machine - `https://www.mongodb.com/try/download/community
- or use online clusters
-
NodeJS - tested on
v20.2.0
-
npm
npm install npm@latest -g
- Clone the repo
git clone https://github.com/Darosss/ChatApplication.git
- Navigate to server folder and install NPM packages
cd app
npm install
- Navigate to frontend folder and install NPM packages
cd frontend
npm install
The app requires several environment variables to be set in the .env file. You can use the .env.example (should be in root directory) file as a template:
BACKEND_PORT=5000(whatever port u can use)
FRONTEND_URL=<fe. http://localhost:3000>
DATABASE_URL=<fe. mongodb url>
COOKIE_SECRET=<cookie secret>
JWT_SECRET_KEY=<jwt secret>
VITE_BACKEND_URL=<fe. http://localhost:5000/api/v1 >
VITE_SOCKET_ENDPOINT=<fe. http://localhost:5000 >
VITE_BACKEND_URL
- must contain <backend url with port>/api/v1
something like this. It's only route designed
Both COOKIE_SECRET
and JWT_SECRET_KEY
are random 32 bytes string. I've used: crypto.randomBytes(32).toString('hex')
-
backend:
- For test backend first we need to recreate testEnv file in
app/src/tests/settings
(in this folder should be testEnv.example which can be used for example)
process.env.BACKEND_PORT = 5001; process.env.DATABASE_URL = ""; //fe. mongodb://127.0.0.1:27017/testdb, could be online cluster too process.env.COOKIE_SECRET = ""; //fe. 32 bytes hex string: //require("crypto").randomBytes(32).toString('hex') process.env.JWT_SECRET_KEY = ""; //fe. 32 bytes hex string: //require("crypto").randomBytes(32).toString('hex') process.env.NODE_ENV = "test";
- Then just run from app folder
npm test
- For test backend first we need to recreate testEnv file in
-
frontend: 1.simply navigate to frontend folder and run:
npm test
- Add chat rooms
- Add login / register system
- Add ban / unban system
- Add ranges system
- Improve for mobiles
- [] Add shop with privileges
Distributed under the MIT License. See LICENSE.md
for more information.
Darosss - darosss12@proton.me
Project Link: https://github.com/Darosss/ChatApplication