- π
What is this API ?
- π Demo
- π¨ Installation
- β Global setup
- π Node.js
- π³ Docker
- π₯ RabbitMQ
- π Directus
- π How to use
- π Authentication Process
- π― Tests
- β€οΈ Contributors
- Β©οΈ License
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.
This API provides a comprehensive set of features including
-
Instant messaging π¬,
-
Group chats π₯,
-
message history π,
-
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.
-
With the use of web sockets the server listens and emits the
newMessage
event alongside themessageData
concerned always keepinp up to date all users in each chatroom/chatgroup respectivly -
Here, the combination of
http endpoins
andsockets
allows us to create chat rooms which are stored and can always be retrived even ofter logingout. which sends us to the next feature -
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
andPASSWORD REQUIRED
-
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
- online users
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.
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 :
- More on the docker installation procedure
- More on the node installation procedure
- More on the mongodb installation procedure
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 likepnpm
,bun
oryarn
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
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
and65535
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
- Install docker on Linux OS
-
Download the correct package for your Linux distribution and install it with the corresponding package manager.
- Install docker on Windows OS
- 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.
-
-
First, download the Windows installer from the Node.js website. You will have the choice between the LTS (Long Term Support) or Current version.
-
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. -
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.
-
create an accout, example
- full name: John Doe
- user name: johndoe
- email: [email protected]
- password: John2@!.
- gender: male
-
create an accout, example
- full name: Bobe Doe
- user name: bobedoe
- email: [email protected]
- password: John2@!.
- gender: female
All aveilables test are passing and my be add subsequently
-
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.
-
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.