A chat app messenger with expressjs and reactjs
Contact with developer »
Report Bug
·
Request Feature
Table of Contents
This chat app is like Telegram, whatsapp and other messengers, you can send text,photo, file and other things and this part is backend project.
You can see frontend project Click here.
Here's why:
- You can learn about how to create a chat app with nodejs and reactjs
- You can use of this chat app in your Business or you can use some part chat app
- This chat app is full open source and you can find and send bug from this chat app for me
This chat app created by many technology and used of sql and nosql for store data users and conversations
You can run this chat app in localhost or your server.
For use of chat app, you should download npm and nodemon or pm2
- npm
npm install npm@latest -g
- nodemon
npm install -g nodemon
So to run the chat app properly, please go step by step.
- Clone the repo
git clone https://github.com/aminmalekzadeh/chat-app-backend.git
- Install NPM packages
npm install
- copy and past
.env.example
and then change name to.env
cp .env.example .env
- open
.env
file and enter the your information about server and database
APP_NAME= required, You must enter the app name
APP_PORT= required, You must enter the app port
APP_URL=required, You must enter the app url with http://
APP_SECRET=required, You must enter the app secret
PEER_PORT=required, You must enter the app peer port
SOCK_PORT=required, You must enter the socket port
NEAR_BY_DISTANCE_MAX=20000
#database
DB_NAME=
DB_HOST=
DB_USER=
DB_PASSWORD=
#ETC
JWT_SECRET=required, You must enter the jwt secret
#MONGO_DB
MONGO_PORT=27017
MONGO_HOST=localhost
MONGO_USER=
MONGO_PASSWORD=
MONGO_DATABASE=massenger
#REDIS DATABASE
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
- Then you should enter mysql information
app/db/sequelize/config/config.json
{
"development": {
"username": "USER_NAME_MYSQL",
"password": "PASSWORD_MYSQL",
"database": "DATABASE_NAME_VERSION_DEV",
"host": "127.0.0.1",
"dialect": "mysql"
},
"test": {
"username": "USER_NAME_MYSQL",
"password": "PASSWORD_MYSQL",
"database": "DATABASE_NAME_VERSION_TEST",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "USER_NAME_MYSQL",
"password": "PASSWORD_MYSQL",
"database": "DATABASE_NAME_VERSION_PRODUCTION",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
- you should migrate sequelize in directory
app/db/sequelize
with sequelize-cli
cd app/db/sequelize
then
npx sequelize-cli db:migrate
- You have to make 5 collections with the following names.
1. blockedusers
2. conversations
3. messages
4. report
5. participants
- Now you can start backend project.
nodemon server.js
Amin Malekzadeh - Linkedin - aminmalekzadeh004@gmail.com
Project Link: https://github.com/aminmalekzadeh/chat-app-backend
During the development of this route I have used the following resources!