How To Install Chat App
1. Backend launch
To start the backend you need to install docker and docker-compose
How to install docker and How to install docker-compose
The entire backend is launched with a single command. Run the command in the root directory
$ docker-compose -f docker-compose.development.yml up --buildAnd then you need to wait until all the images are downloaded and build After executing this command, will run redis, mongodb, socker server and api server
After launch, you will have available services http://localhost:5000/graphql (api) http://localhost:4000 (socket server)
For start with production configuration use command
$ docker-compose -f docker-compose.production.yml up --buildTo run only redis and mongodb use command
redis and mongodb use command$ docker-compose -f docker-compose.environment.yml up --buildGo to
messenger-api/src/config.tsand change development configuration.(replacemongoURIwithmongodb://localhost:27017/messengerandredis.hostwithlocalhost)Go to
messenger-socket/src/config.jsand change development configuration. (replaceredis.hostwithlocalhost)In
messenger-apidirectory run command:$ yarn install$ yarn start
In
messenger-socketdirectory run command:$ yarn install$ yarn start
2. Install dependences for apps
In messenger-apps directory run command
$ yarn install
$ yarn mobile:podNote:
├── packages
├── @shared
├── mobile
├── desktop
└── web@shared - Here is the code that is shared between platforms mobile - React Native App desktop - Electron web - React App
3. Start Apps
Start React Native App Metro
In messenger-apps directory run command
$ yarn start:metroStart iOS
$ yarn start:iosStart Android
Before starting the project, you need to register in FireBase console
Open Project overview in the firebase console and click on the Android icon or + button to Add Firebase to your Android app.
Make sure that the Android package name is the same as the value of
applicationIdin yourandroid/app/build.gradle.Register the app & download the config file by clicking "Download google-services.json" to this location
/android/app/google-services.json. See more
After you need to register the application in expo to be able to send push notifications.
See More. In messenger-apps/packages/mobile run command and paste your FireBase Server Key
$ expo credentials:managerAnd insert your experienceId in messenger-apps/packages/@shared/config.ts
export const PushExperienceId = '<your-experience-id>';Next open the project messenger-apps/packages/mobile/android in android studio and compile
Start Web
$ yarn start:webStart Desktop App
When you start desktop, make sure that you are running web
$ yarn start:web
$ yarn start:desktopNote: If you run API Server in development configuration you can login and register with any phone number and with any code from SMS, in this mode the twilio does not work
Building
Build web
$ yarn build:webAfter executing this command, you will create a directory messenger-apps/packages/web/build
You can also use docker. Inside
messenger-appsdirectory thereDockerfileandnginx.confDocker himself will build web and will run nginx
Build Desktop
After that, run the command
$ yarn build:desktopAfter executing this command, you will have desktop applications for mac, linux and windows.
Path to created applications: messenger-apps/packages/desktop/dist
See more: https://www.electronjs.org/
Build React Native Apps
And you can compile projects as usual
in android studio (messenger-apps/packages/mobile/android)
and Xcode (messenger-apps/packages/mobile/ios)
4. Configure AWS S3 for upload photo
Go to messenger-api/src/config.ts and put your AWS Account data
const AWS = {
bucket: '',
accessKey: '',
secretKey: '',
region: ''
};Paste this policy
{
"Version": "2012-10-17",
"Id": "Policy1478209136055",
"Statement": [
{
"Sid": "Stmt1478209120479",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::<your-bucket-name>/*"
}
]
}Replace <your-bucket-name>
5. Configure Twilio for send SMS Authentication
Go to messenger-api/src/config.ts and put your twilio data. See more
production: {
...
twilio: {
sid: '<sid>',
token: '<token>',
from: '<phone number>' // From which number will SMS be sent
},
...
},Note
You can add addresses of STUN / TURN servers for calls in
messenger-apps/packages/@shared/config.ts
export const RTCConfig = {
iceServers: [{ urls: 'stun:stun1.l.google.com:19302' }]
};This configuration will work for all applications.
Last updated
Was this helpful?