Skip to content

wintercodeNKJJ/RealTimeChat-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

logo

πŸ“‹ Table of Contents

This is a cutting-edge solution designed to bring real-time communication capabilities to your applications. Built with the aim of facilitating instant, seamless interactions, it’s an ideal choice for applications that require live chat functionality. πŸ—¨οΈπŸ’¬

  • In other to covey fully the potential uses of this api I have prepared a demo app making use of this api's fuctionalities. bellow is the overviews of the app and some of this features in action.

    Functionalities

    This API provides a comprehensive set of features including

    • Instant messaging πŸ’¬,

    • Group chats πŸ‘₯,

    • message history πŸ“œ,

      logo

    • Authentication

      An authentication system is provide using jwt (Jason Web Token) to authenticat users and grant access to the resources. this is done by setting a cookie in the users browser upon registration or login and the token key can also be found in the response to the login or registration. after the registration, the users ar granted a certen level of freedom on the ressources accesed.

      logo

      logo

    • Intant messaging

      With the use of web sockets the server listens and emits the newMessage event alongside the messageData concerned always keepinp up to date all users in each chatroom/chatgroup respectivly

      logo

    • Chat rooms

      Here, the combination of http endpoins and sockets allows us to create chat rooms which are stored and can always be retrived even ofter logingout. which sends us to the next feature

      logo

    • chat history

      The chat history of every chatgroup can always be fetched as it is aveilable for you to use. with the possibelity of viewing them on the nice admin pannel provided by directus. USERNAME and PASSWORD REQUIRED

      logo

    • notifications

      lastly, every action trigers an evet that you can use as you will, the following are the events currently emited and listened by the serve

      • online users getOnlineUsers
      • send a message newMessage
      • joining a chat room joinRoom
      • leaving a chat room leaveRoom
      • new chat group newRoom

    It’s designed with scalability in mind, capable of handling a high volume of concurrent connections, making it suitable for both small and large-scale applications.

    Documentation

    We provide detailed documentation πŸ“š to guide you through the integration process. Whether you’re a seasoned developer or just getting started, our documentation is designed to provide you with the information you need to successfully integrate our API into your application.

    We’re excited for you to start using the Realtime Chat API and look forward to seeing the incredible applications you will build with it. πŸš€

    Nguezet Kenfack Jordan Junior - Website Send email to Nguezet Kenfack Jordan Junior

To install this project, you will need to have on your machine :

Node NPM Docker

We recommend to use node version 18.15.0 as it is the vesion used for the development of the API.

!NOTE
Using any other package manager like pnpm, bun or yarn may still be okay, but the compatibility with this package managers has not been verified.

After installing nodejs you will need to install docker and run the following commands

  • move to the project folder directory
# move to the project ditectory
cd ./RealTimeChat Project
  • Create the docker image of the project
# create docker image
docker compose up -d --build
  • Run the project with following command
# Run docker container
docker compose up --attach chatapi

if you want to run the react project in the chat-app-demo run the following commands

  • install the required packages locally
# Run docker container
npm run build
  • move to the chat-app-demo file
# move to the chat-app-demo ditectory
cd ./chat-app-demo file
  • run the react.js app
# Run the react app
npm run dev

you should now bw able to see the chat app server starting on your docker virtual mechine and on your terminal. follow the various links to get to know more about the api.

  • This api is bundeled witha a set of default values for its environment an you need to make sure these variables are well set if you need to deploy this app on a live server. but befor that take a look at the demo by following the link provided by your running server

    Development mode

    Name Description Required Default value Limitations
    SERVER_HOST Host on which the API will be available ❌ 127.0.0.1 If set, can't be empty string
    SERVER_PORT Port on which the API will be available ❌ 4000 If set, must be a number between 0 and 65535
    DIRECTUS_HOST Directus host URL ❌ directus If set, must match the directus container name
    DIRECTUS_PORT Directus host PORT ❌ 8055 If set, must match the directus container port
    DIRECTUS_ADMIN_EMAIL CORS allowed origin ❌ [email protected] If set, can't be empty string and must match the directus container admin email
    DIRECTUS_ADMIN_PASWWORD CORS allowed origin ❌ d1r3ctu5 If set, can't be empty string and must match the directus container admin email
  • This section describes how to install Docker Engine on Windows, macOS, and Linux also known as Docker CE. Depending on the operationg system you have installed on your computer, the installation process differs

    1. Install docker on Linux OS
    1. Install docker on Windows OS
    2. Install docker on Mac OS

    Note that Docker Desktop will not run if you do not agree to the terms. You can choose to accept the terms at a later date by opening Docker Desktop.

    1. First, download the Windows installer from the Node.js website. You will have the choice between the LTS (Long Term Support) or Current version.

    2. Once you have selected a version meets your needs, run the installer. Follow the prompts to select an install path and ensure the npm package manager feature is included along with the Node.js runtime. This should be the default configuration.

    3. Restart your computer after the installation is complete.

    If you installed under the default configuration, Node.js should now be added to your PATH. Run command prompt or powershell and input the following to test it out:

    node -v

    The console should respond with a version string.

    # for example
    $ node -v
    v18.15.0

    Repeat the process for npm:

    npm -v

    # for example
    $ npm -v
    9.5.0

    If both commands work, your installation was a success, and you can start using Node.js!

Be ware that befor any action you should signup and login. most of the routes are protected from on authenticated users. visite the api endpoinds documentation.

install on your machine and view the Demo.

  • User 1

  • create an accout, example

    • full name: John Doe
    • user name: johndoe
    • email: [email protected]
    • password: John2@!.
    • gender: male
  • User 2

  • create an accout, example

    • full name: Bobe Doe
    • user name: bobedoe
    • email: [email protected]
    • password: John2@!.
    • gender: female
  • Create a chat room

  • Send messages

All aveilables test are passing and my be add subsequently

  • πŸ” Code linting & formatting

    ESLint

    In order to keep the code clean, consistent and free of bad TS practices, more than 300 ESLint rules are activated!

    Complete list of all enabled rules is available in the .eslintrc.json file.

  • ▢️ Commands

    Before linting, you must follow the installation steps.

    Then, run one of the following commands :

    # Lint
    npm run lint

    lint and fix errors.

    # Lint and fix
    npm run lint:fix

πŸ–Ό Create docker image with docker compose

docker compose up -d --build

There is no contributor yet. This is a technical interview project

This is the first version of the API Real Time Chat API. It is still under development.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published