Skip to main content

The structure and dependencies of the chat application!

Directory Structure#

Here is the complete structure of the application (Classic):

  • Detailed structure diagram
β”œβ”€β”€ backendsβ”‚Β Β  └── messages-and-pictures # backend for messages & picturesβ”‚Β Β   Β Β  └── imagesβ”‚Β Β   Β Β  └── srcβ”‚Β Β   Β Β  β”‚Β Β  β”œβ”€β”€ controllerβ”‚Β Β   Β Β  β”‚   β”‚Β Β  └── file.controller.jsβ”‚Β Β   Β Β  β”‚ Β Β β”œβ”€β”€ middlewareβ”‚Β Β   Β Β  β”‚   β”‚   └── upload.jsβ”‚Β Β   Β Β  β”‚Β Β  └── routesβ”‚Β Β   Β Β  β”‚Β Β      └── index.jsβ”‚Β Β   Β Β  β”œβ”€β”€ .envβ”‚Β Β   Β Β  β”œβ”€β”€ .gitignoreβ”‚Β Β   Β Β  β”œβ”€β”€ package.jsonβ”‚Β Β   Β Β  β”œβ”€β”€ README.mdβ”‚Β Β   Β Β  └── server.jsβ”‚β”œβ”€β”€ node_modulesβ”‚Β Β β”œβ”€β”€ publicβ”‚Β Β  β”œβ”€β”€ locales # folder for translation (i18next-http-backend)β”‚Β Β  β”‚ Β Β β”œβ”€β”€ enβ”‚Β Β  β”‚   β”‚   └── translation.jsonβ”‚Β Β  β”‚   └── frβ”‚Β Β  β”‚       └── translation.jsonβ”‚Β Β  β”‚β”‚Β Β  β”œβ”€β”€ favicon.icoβ”‚Β Β  β”œβ”€β”€ index.htmlβ”‚Β Β  β”œβ”€β”€ logo192.pngβ”‚Β Β  β”œβ”€β”€ logo512.pngβ”‚Β Β  β”œβ”€β”€ manifest.jsonβ”‚Β Β  └── robots.txtβ”œβ”€β”€ srcβ”‚Β Β  β”œβ”€β”€ chatComponents # All folders, files, custom hooks, states managment & components for chat appβ”‚Β Β  β”‚Β Β  β”œβ”€β”€ assetsβ”‚Β Β  β”‚Β Β  β”‚ Β  β”œβ”€β”€ sounds # All sounds for notification on chat appβ”‚Β Β  β”‚Β Β  β”‚   β”‚Β Β  └── Β # All sounds are hereβ”‚Β Β  β”‚Β Β  β”‚   └──# All pictures are hereβ”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚ Β Β β”œβ”€β”€ components # Components for chatβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ bottomDrawerβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ bottomDrawer.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── BottomDrawer.js  # Drawer that appears when you click on the home page buttonβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ chatRoomβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ ChatRoomβ”‚Β Β  β”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ ChatRoom.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ ChatRoom.js # ChatRoom componentβ”‚Β Β  β”‚Β Β  β”‚   β”‚   β”‚Β Β  └── EmptyChatMessage.js # Empty message when the messages list is emptyβ”‚Β Β  β”‚Β Β  β”‚   β”‚   β”‚β”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── HomeChatβ”‚Β Β  β”‚Β Β  β”‚   β”‚     Β  β”œβ”€β”€ HomeChat.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚    Β Β  └── HomeChat.js # This component is not used, if you don't want the current login method or customize the chat login page it is prepared for that!β”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ joinβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ Join.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── Join.js # This component is not used in the free version, it's by default component! For the pwa version this is login pageβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ loaderβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ loader.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── Loader.js #Loader componentβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ parametersβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ parameters.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── Parameters.js # Setting panel componentβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ resetModalβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ ResetModal.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── ResetModal.js # modal when you click to reset preferences in setting panelβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ speech-recognitionβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ speechToText.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── SpeechToText.js # Speech to text component integrated to the bottom chat toolsβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ suppressConversationModalβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ suppressConversationModal.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── SuppressConversationModal.js # modal when you click to delete all conversations in setting panelβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ weatherComponentβ”‚Β Β  β”‚   β”‚   β”‚Β Β  β”œβ”€β”€ weather.cssβ”‚Β Β  β”‚Β Β  β”‚   β”‚ Β  └── weatherComponent.js # optional weather componentβ”‚Β Β  β”‚Β Β  β”‚   β”‚β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ ButtonChat.js # Button on the home page to access the chatβ”‚Β Β  β”‚Β Β  β”‚ Β  └── ImageUploadComponent.js # component for uploading pictureβ”‚Β Β  β”‚Β Β  β”‚β”‚Β Β  β”‚ Β Β β”œβ”€β”€constantsβ”‚Β Β  β”‚Β Β  β”‚ Β  └── constant.js # all constants for the ChatBot intelligencyβ”‚Β Β  β”‚Β Β  β”‚β”‚Β Β  β”‚ Β Β β”œβ”€β”€customAlert # reusable custom Alert componentβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ alert.cssβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ Alert.jsβ”‚Β Β  β”‚Β Β  β”‚ Β  └── clickedAlertAtom.jsβ”‚Β Β  β”‚Β Β  β”‚β”‚Β Β  β”‚ Β Β β”œβ”€β”€ hooksβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ useChat.js # custom hook for chat functionalitiesβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ useChatBot.js # custom hook for chatbot functionalitiesβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ useFetch.js # reusable custom hook for fetch data ( if you dont want use axios, this custom hook is here for that)β”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ useGetUserInfos.js # custom hook for taking user infosβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ useMobile.js # reusable custom hook for  detecting if is mobile or notβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ useParams.js # custom hook for setting panel functionalitiesβ”‚Β Β  β”‚   β”‚Β Β  └── useSpeechToText.js # custom hook for transcription from speech to txt in chat messageβ”‚Β Β  β”‚Β Β  β”‚β”‚Β Β  β”‚ Β Β β”œβ”€β”€ servicesβ”‚Β Β  β”‚   β”‚Β Β  β”œβ”€β”€ fetchWeather.js # this component fetch openweather api for weather functionalitiesβ”‚Β Β  β”‚Β Β  β”‚ Β  └── FileUploadService.js # this file make link from font to backendβ”‚Β Β  β”‚Β Β  β”‚β”‚Β Β  β”‚   └── stateManagerβ”‚Β Β  β”‚    Β Β  β”œβ”€β”€ atoms # here are all atoms for states managment for all chat appβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ clickedGuestAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ clickedOffChatAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ clickedParamsAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ clickedSoundGuitarAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ clickedSoundSoftwareAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ clickedUserAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ dangerZoneAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ exampleClicked.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ fileFromPictureAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ exampleUsAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ imageInfoAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ infoPictureFromListAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ isLanguageAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ isListeningAtom.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ isSoundNotifications.jsβ”‚Β Β  β”‚       β”‚Β Β  β”œβ”€β”€ messageForBotAtom.jsβ”‚Β Β  β”‚Β Β      β”‚ Β  └── messagesAtom.jsβ”‚Β Β  β”‚Β Β      β”‚β”‚Β Β  β”‚Β Β    Β  └── selectors # here are on example file for knowing how to use Recoil selectors easy and fastβ”‚Β Β  β”‚Β Β        Β  └── exampleSelector.jsβ”‚Β Β  β”‚β”‚Β Β  β”œβ”€β”€ http-common.js # # this is axios methode for uploading picture to backendβ”‚Β Β  β”œβ”€β”€ App.css # classical file on Reactβ”‚Β Β  β”œβ”€β”€ App.js # classical file on React tooβ”‚Β Β  β”œβ”€β”€ i18n.js # init file for i18nextβ”‚Β Β  β”œβ”€β”€ index.js # common file on all Reactβ”‚Β Β  └── logo.svgΒ # RUM logo base from cra tool logoβ”‚Β Β β”œβ”€β”€ .env.local # environment variables for the frontend functionalityβ”œβ”€β”€ .gitignore # common in all projectβ”œβ”€β”€ .nvmrc # file for syncronized your node version to the best version for better performance and compatibilityβ”œβ”€β”€ package.jsonβ”œβ”€β”€ README.md└── yarn.lock

The tree structure may seem quite large but appearances are deceiving, for the most part it is small reusable components all made up in the same way, a folder that contains a .css file and a .js file and when functions are called in these components, they come from the custom hook. All the global state management is done through atoms, but I'll explain all that in more detail throughout this documentation.

Dependencies of this app#

Here are all the dependencies that are present in the app :

These dependencies represent the free version only!

"dependencies": {    "@testing-library/jest-dom": "^5.11.4", # cra default install    "@testing-library/react": "^11.1.0", # cra default install    "@testing-library/user-event": "^12.1.10", # cra default install    "axios": "^0.21.1",    "emoji-picker-react": "^3.4.8",    "i18next": "^20.3.3",    "i18next-browser-languagedetector": "^6.1.2",    "i18next-http-backend": "^1.2.6",    "query-string": "^6.13.7",    "react": "^17.0.1", # cra default install    "react-device-detect": "^1.17.0",    "react-dom": "^17.0.1", # cra default install    "react-i18next": "^11.11.3",    "react-router": "^5.2.0",    "react-router-dom": "^5.2.0",    "react-scripts": "4.0.1", # cra default install    "react-speech-recognition": "^3.8.2",    "recoil": "^0.3.1",    "socket.io-client": "^4.1.3",    "uuid": "^8.3.2",    "visitor-info": "^0.3.1",    "web-vitals": "^0.2.4" # cra default install