Full-Stack Chat Application Project using ReactJS and NodeJS.
For detailed information about the API endpoints and usage, please refer to the API Documentation.
Currently, there are three environments available: dev
, test
, and local
.
To use a database, you must specify one of the available environments in your script. Here's how to do it:
-
For testing:
npm run dev -- --environment=test
-
For development:
npm run dev -- --environment=dev
-
For the local environment:
npm run dev -- --environment=local
Make sure to apply the same approach for other scripts like npm test
or npm start
.
Library | Version |
---|---|
bcryptjs | 2.4.3 |
body-parser | 1.20.2 |
cloudinary | 2.2.0 |
commander | 12.0.0 |
cors | 2.8.5 |
dotenv | 16.4.5 |
express | 4.19.2 |
joi | 17.12.3 |
jsonwebtoken | 9.0.2 |
mongoose | 8.3.1 |
multer | 1.4.3 |
nodemailer | 6.9.13 |
socket.io | 4.7.5 |
streamifier | 0.1.1 |
Library | Version |
---|---|
jest | 29.7.0 |
nodemon | 3.1.0 |
supertest | 6.3.4 |
The .env
contains all environment variables needed to run the project, a .example.env
file is present with the fields needed, create a .env
file based on the example and fill the fields with your credentials, don't share these credentials publicly
There are three different profiles available.
- The dev environment.
- the test environment.
- the local environment.
This repo contains the whole backend for ChatSphere, the frontend is in this repo, it is also refrenced above.
Test modules using the jest library for all APIs are available in the tests
directory, to run the test use
npm run test -- --enviroment=test tests/{fileName}.test.js
# Example
npm run test -- --enviroment=test tests/groups.test.js
A docker compose file docker-compose.yaml
is present this configures MongoDB in a docker conatiner with port mapping and volume mapping to save the data, change username and password to your preference.
Add the connection string to your .env
file in the MONGODB_CONNECTION_URL_LOCAL
field.
It should be like this
mongodb://<username>:<password>@localhost:27017/ChatSphere
Remove the <>
around the username and password