Skip to content

LeChat is an instant messaging app that allows you to quickly share text messages, emojis, photos, or files with other LeChat users

License

Notifications You must be signed in to change notification settings

febriadj/messaging-app

Repository files navigation

LeChat

LeChat is a web-based instant messaging app that allows you to quickly send and receive text messages, emojis, photos, or files with other LeChat users. LeChat uses its own socket server and works independently, professionally built using MongoDB, Express, React, Node, and Socket IO. Suitable for those of you who are interested in learning the workflow of messaging apps.

Table of Contents

Getting Started

Step 1: Fork and clone this repository.

git clone https://github.com/{username}/lechat.git

Step 2: Rename .env.example file to .env and complete the required environment variables.

Step 3: Install dependencies.

npm install

Step 4: Run the app in development mode.

npm run dev

Preview

cover cover

Requirements

  • Node.js: latest
  • NPM: latest
  • MongoDB: ^6.0.4
  • Cloudinary account: third-party for media cloud

Features

  • User authentication
  • Sharing text messages, emojis, photos, or files
  • Online/offline, last seen time, blue tick, and typing indicators
  • Photo capture
  • Browser notification
  • Peer-to-peer and group chat
  • User profile
  • Contact
  • Account settings
  • Dark mode
  • Change account password
  • Delete account
  • ...

Environment Variables

Environment variables provide information about the environment in which the process is running. We use Node environment variables to handle sensitive data like API keys, or configuration details that might change between runs.

NODE_ENV = development

Connect to MongoDB

By default, LeChat will use your local MongoDB server and the lechat database will be created automatically when the app is run in development mode. In production mode, you should use a cloud database like MongoDB Atlas.

MONGO_URI = mongodb+srv:https://{username}:{password}@node.deu00vc.mongodb.net/{dbname}?retryWrites=true&w=majority

Cloudinary

We rely on Cloudinary service to store all media uploaded by users, follow the instructions below to getting started with Cloudinary:

  • Create Cloudinary Account for free and you will get Product Environment Credentials like Cloud Name, API Key, and API Secret.
  • Open the Media Library then create avatars and chat folders.
CLOUDINARY_API_KEY =
CLOUDINARY_API_SECRET =
CLOUDINARY_CLOUD_NAME =

Nodemailer

We use Nodemailer to send OTP code via email, use your email address and App Password to run Nodemailer, follow the instructions below to generate your App Password:

  • Go to your Google Account > Security > 2-Step Verification
  • At the bottom, choose Select app and choose Other (custom name) > give this App Password a name, e.g. "Nodemailer" > Generate
  • Follow the instructions to enter the App Password. The App Password is the 16-character code in the yellow bar on your device
  • Done
EMAIL_USER = [email protected]
EMAIL_PASS =

Fake SMTP Server

There are many fake SMTP server services to test your email but I recommend using Mailtrap, this variable will only be executed in development mode.

TEST_EMAIL_USER =
TEST_EMAIL_PASS =
TEST_EMAIL_HOST = smtp.mailtrap.io
TEST_EMAIL_PORT = 2525

License

Distributed under the GPL-3.0 License.