How To Install Chat App

1. Backend launch

To start the backend you need to install docker and docker-compose How to install dockerarrow-up-right and How to install docker-composearrow-up-right

The entire backend is launched with a single command. Run the command in the root directory

And 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/graphqlarrow-up-right (api) http://localhost:4000arrow-up-right (socket server)

circle-info

By executing this command you start all services with development configuration

For start with production configuration use command

To run only redis and mongodb use command

circle-info

In this case, you need to perform some actions:

  1. Go to messenger-api/src/config.ts and change development configuration.(replace mongoURI with mongodb://localhost:27017/messenger and redis.host with localhost)

  2. Go to messenger-socket/src/config.js and change development configuration. (replace redis.host with localhost)

  3. In messenger-api directory run command:

    1. $ yarn install

    2. $ yarn start

  4. In messenger-socket directory run command:

    1. $ yarn install

    2. $ yarn start

circle-info

Before the deployment, make sure the data in the configuration files is correct, specify the correct hosts.

2. Install dependences for apps

In messenger-apps directory run command

Note:

circle-info

messenger-appsis monorepo, inside there is a directory that contains packages

@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

Start iOS

Start 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 applicationId in your android/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 morearrow-up-right

After you need to register the application in expo to be able to send push notifications. See Morearrow-up-right. In messenger-apps/packages/mobile run command and paste your FireBase Server Key

And insert your experienceId in messenger-apps/packages/@shared/config.ts

Next open the project messenger-apps/packages/mobile/android in android studio and compile

Start Web

Start Desktop App

When you start desktop, make sure that you are running web

Note: 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

circle-info

Before building, make sure that you have the correct hosts in the configuration file in the production section. Any building command uses a production section

Configuration file is located: messenger-apps/packages/@shared/config.ts

Build web

After executing this command, you will create a directory messenger-apps/packages/web/build

You can also use docker. Inside messenger-apps directory there Dockerfileand nginx.conf Docker himself will build web and will run nginx

Build Desktop

circle-info

Before you build, make sure you specify the correct host in messenger-apps/packages/desktop/src/main.js

After that, run the command

After 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/arrow-up-right

Build React Native Apps

circle-info

You need to register your applications in expo to be able to send push notifications See morearrow-up-right, Also insert yourexperienceIdin messenger-apps/packages/@shared/config.ts

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

How to create bucket arrow-up-right

Go to messenger-api/src/config.ts and put your AWS Account data

circle-info

You need add policy to your bucket. How to add Policyarrow-up-right

Paste this policy

Replace <your-bucket-name>

5. Configure Twilio for send SMS Authentication

Go to messenger-api/src/config.ts and put your twilio data. See morearrow-up-right

circle-info

SMS sending only works when API in production mode

Note

You can add addresses of STUN / TURN servers for calls in

messenger-apps/packages/@shared/config.ts

This configuration will work for all applications.

Last updated