The structure & dependencies of the PWA application!
Directory Structure#
Here is the complete structure of the application (PWA version):
- Detailed structure diagram
βββ backendsβΒ Β βββ messages-and-pictures # backend for messages & picturesβΒ Β βΒ Β βββ node_modulesβΒ Β βΒ Β βββ imagesβΒ Β βΒ Β βββ srcβΒ Β βΒ Β βΒ Β βββ controllerβΒ Β βΒ Β β βΒ Β βββ file.controller.jsβΒ Β βΒ Β β Β Β βββ middlewareβΒ Β βΒ Β β β βββ upload.jsβΒ Β βΒ Β βΒ Β βββ routesβΒ Β βΒ Β βΒ Β βββ index.jsβΒ Β βΒ Β βββ .envβΒ Β βΒ Β βββ .gitignoreβΒ Β βΒ Β βββ package.jsonβΒ Β βΒ Β βββ README.mdβΒ Β βΒ Β βββ server.jsβΒ Β βΒ Β βββ utils.jsβΒ Β ββΒ Β βββ video-chat # backend for video chat (not present in the free version)βΒ Β Β Β βββ node_modulesβΒ Β Β Β βββ .envβΒ Β Β Β βββ .gitignoreβΒ Β Β Β βββ package.jsonβΒ Β Β Β βββ README.mdβΒ Β Β Β βββ server.jsβΒ Β βββ node_modulesβΒ Β βββ publicβΒ Β βββ locales # folder for translation (i18next-http-backend)βΒ Β β Β Β βββ frβΒ Β β β Β Β βββ translation.jsonβΒ Β β Β Β βββ enβΒ Β β β Β Β βββ translation.jsonβΒ Β β Β Β βββ ptβΒ Β β Β Β βββ translation.jsonβΒ Β ββΒ Β βββ favicon.icoβΒ Β βββ index.htmlβΒ Β βββ logo192.pngβΒ Β βββ logo512.pngβΒ Β βββ manifest.jsonβΒ Β βββ robots.txtβββ srcβΒ Β βββ adminDashboard # All content of this folder are not present in the free versionβΒ Β βΒ Β βββ componentsβΒ Β β βΒ Β βββ Analytics.jsβΒ Β β βΒ Β βββ Dashboard.jsβΒ Β β βΒ Β βββ Favorites.jsβΒ Β β βΒ Β βββ HeaderAdmin.jsβΒ Β β βΒ Β βββ Messages.jsβΒ Β β βΒ Β βββ OtherList.jsβΒ Β β βΒ Β βββ Product.jsβΒ Β β βΒ Β βββ Setting.jsβΒ Β β βΒ Β βββ Sidebar.jsβΒ Β β βΒ Β βββ Stock.jsβΒ Β β βΒ Β βββ Team.jsβΒ Β βΒ Β β βββ TotalOrder.jsβΒ Β βΒ Β ββΒ Β βΒ Β βββ constantsβΒ Β βΒ Β β βββ DataProduct.jsβΒ Β βΒ Β βββ hooksβΒ Β βΒ Β β βββ useAdmin.jsβΒ Β βΒ Β βββ imagesβΒ Β β β Β Β βββ #All the images needed for the dashboard's adminβΒ Β β ββΒ Β βΒ Β βββ adminPanel.cssβΒ Β βΒ Β βββ AdminPanel.jsβΒ Β βΒ Β βββ adminPanel2.cssβΒ Β βΒ Β βββ AdminPanel2.jsβΒ Β βΒ Β βββ common-css.cssβΒ Β ββΒ Β βββ baseLayoutβΒ Β βΒ Β βββ sharedβΒ Β β βΒ Β βββ alertComponentβΒ Β β β βΒ Β βββ checkboxAlertβΒ Β β β β β βββ activateDeleteConvAtom.jsβΒ Β βΒ Β β β Β β βββ checkbox-alert.cssβΒ Β βΒ Β β β Β ββΒ Β β Β Β βΒ Β β βββcustomAlert # reusable custom Alert componentβΒ Β β β βΒ Β Β Β βββ alert.cssβΒ Β β β βΒ Β Β Β βββ Alert.jsβΒ Β β βΒ Β β Β Β Β βββ clickedAlertAtom.jsβΒ Β βΒ Β β ββΒ Β β βΒ Β βββ headerAppβΒ Β β β βΒ Β βββ headerApp.cssβΒ Β βΒ Β β β Β βββ HeaderApp.jsβΒ Β βΒ Β β ββΒ Β β βΒ Β βββ menuComponentsβΒ Β β β βΒ Β βββ bottomMenuβΒ Β β β β β βββ bottomMenu.cssβΒ Β βΒ Β β β Β β βββ BottomMenu.jsβΒ Β βΒ Β β β Β ββΒ Β βΒ Β β β Β βββ radialMenuβΒ Β β β β βββ imgβΒ Β β β β βββ radialMenu.cssβΒ Β βΒ Β β β Β βββ RadialMenu.jsβΒ Β βΒ Β β ββΒ Β β βΒ Β βββ offlineMessageβΒ Β β β Β Β βββ offlineMessage.cssβΒ Β βΒ Β β Β βββ OfflineMessage.jsβΒ Β βΒ Β ββΒ Β βΒ Β βββ BaseLayout.jsβΒ Β βΒ Β βββ baseLayoutApp.cssβΒ Β ββΒ Β βββ 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βΒ Β βΒ Β β β βΒ Β βββ componentsβΒ Β β β β β βΒ Β βββ BottomChatComponent.jsβΒ Β β β β β βΒ Β βββ EmptyChatMessage.js # Empty message when the messages list is emptyβΒ Β β β β β βΒ Β βββ HeaderChatComponent.jsβΒ Β βΒ Β β β Β β β βββ MessagesComponent.jsβΒ Β βΒ Β β β Β β ββΒ Β βΒ Β β β βΒ Β βββ ChatRoom.cssβΒ Β βΒ Β β β βΒ Β βββ ChatRoom.js # ChatRoom componentβΒ Β βΒ Β β β ββΒ Β βΒ Β β β Β βββ HomeChatβΒ Β βΒ Β β β Β βββ HomeChat.cssβΒ Β βΒ Β β β Β Β βββ HomeChat.jsβΒ Β βΒ Β β ββΒ Β β βΒ Β βββ 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βΒ Β βΒ Β β ββΒ Β β βΒ Β βββ videoChatComponent # functionality not present in the free versionβΒ Β β β βΒ Β βββ videoChatComponent.cssβΒ Β βΒ Β β β Β βββ VideoChatComponent.js # video chat componentβΒ Β βΒ Β β ββΒ Β β βΒ Β βββ 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βΒ Β βΒ Β ββΒ Β β Β Β βββ hooksβΒ Β β βΒ Β βββ useAxios.js # reusable custom hook for axios request (with params) (not present in the free version)βΒ Β β βΒ Β βββ 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βΒ Β βΒ Β β Β βββ useVideoChat.js # custom hook for video chat functionalities (not present in the free version)βΒ Β βΒ Β ββΒ Β β Β Β βββ 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βΒ Β β β βΒ Β βββ callEndedAtom.jsβΒ Β β β βΒ Β βββ clickedGuestAtom.jsβΒ Β β β βΒ Β βββ clickedOffChatAtom.jsβΒ Β β β βΒ Β βββ clickedParamsAtom.jsβΒ Β β β βΒ Β βββ clickedSoundGuitarAtom.jsβΒ Β β β βΒ Β βββ clickedSoundSoftwareAtom.jsβΒ Β β β βΒ Β βββ clickedUserAtom.jsβΒ Β β β βΒ Β βββ dangerZoneAtom.jsβΒ Β β β βΒ Β βββ exampleClicked.jsβΒ Β β β βΒ Β βββ exampleFrAtom.jsβΒ Β β β βΒ Β βββ exampleUsAtom.jsβΒ Β β β βΒ Β βββ fileFromPictureAtom.jsβΒ Β β β βΒ Β βββ imageInfoAtom.jsβΒ Β β β βΒ Β βββ infoPictureFromListAtom.jsβΒ Β β β βΒ Β βββ isAdminAtom.jsβΒ Β β β βΒ Β βββ isLanguageAtom.jsβΒ Β β β βΒ Β βββ isListeningAtom.jsβΒ Β β β βΒ Β βββ isOnlineAtom.jsβΒ Β β β βΒ Β βββ isSoundNotifications.jsβΒ Β β β βΒ Β βββ messageForBotAtom.jsβΒ Β β β βΒ Β βββ messagesAtom.jsβΒ Β β β βΒ Β βββ openVideoChatAtom.jsβΒ Β β β βΒ Β βββ passwordAtom.jsβΒ Β β β βΒ Β βββ pictComment.jsβΒ Β β β βΒ Β βββ plusSectionAtom.jsβΒ Β β β βΒ Β βββ receiveMediasMessageToUserAtom.jsβΒ Β β β βΒ Β βββ registeruserAtom.jsβΒ Β β β βΒ Β βββ roomIdAtom.jsβΒ Β β β βΒ Β βββ seeMediaAtom.jsβΒ Β β β βΒ Β βββ selectedDarkThemeAtom.jsβΒ Β β β βΒ Β βββ selectedLightThemeAtom.jsβΒ Β β β βΒ Β βββ selectedneumorphismThemeAtom.jsβΒ Β β β βΒ Β βββ selectedSoundAtom.jsβΒ Β β β βΒ Β βββ speechToTextAtom.jsβΒ Β β β βΒ Β βββ usernameAtom.jsβΒ Β β β βΒ Β βββ validateUsernameAtom.jsβΒ Β βΒ Β β β Β βββ weatherAtom.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βΒ Β ββΒ Β βββ componentsΒ Β βΒ Β βΒ Β βββ dropsβΒ Β β βΒ Β βββ drops.cssβΒ Β β βΒ Β βββ Drops.jsβΒ Β β ββΒ Β β βββ RecoilSimpleExample.jsβΒ Β ββΒ Β βββ hooksβΒ Β β βββ useDidMount.jsβΒ Β β βββ useDidUpdate.jsβΒ Β β βββ useEffectOnceWhen.jsβΒ Β β βββ useGeolocation.jsβ Β β βββ useInput.jsβΒ Β β βββ useIntersectionObserverRef.jsβΒ Β βΒ Β βββ useWebPush.js # reusable custon hook for Web Push notifications (not present in the free version)βΒ Β ββΒ Β βββ postInstallConfigβΒ Β β βββ withAdmin.jsβΒ Β β βββ withBottomMenu.jsβ Β β βββ withRadialMenu.jsβ Β β βββ withRecoilExample.jsβΒ Β β βββ withVideoChat.jsβΒ Β ββΒ Β βββ UtilsβΒ Β β βββ common.jsβΒ Β β βββ routes.jsβΒ Β β βββ withAdminRoute.jsβΒ Β ββΒ Β βββ App.css # classical file on ReactβΒ Β βββ App.js # classical file on React tooβΒ Β βββ global-css.cssβΒ Β βββ HomePage.jsβΒ Β βββ i18n.js # init file for i18nextβΒ Β βββ index.js # common file on all ReactβΒ Β βββ service-worker.js # Only in the PWA versionβΒ Β βββ serviceWorkerRegistration.js # Only in the PWA versionβΒ Β βββ 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βββ jsconfig.jsonβββ package.jsonβββ README.mdβββ yarn.lockThe 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#
"dependencies": { "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "axios": "^0.21.1", # promise-based HTTP Client "emoji-picker-react": "^3.4.8", # this dependency is for emoji component "i18next": "^20.3.3", # this dependency is for translation "i18next-browser-languagedetector": "^6.1.2", # this dependency is for auto-detect browser language "i18next-http-backend": "^1.2.6", # this dependency is for use locales folder with multiple files translation "peerjs": "^1.3.2", # used by video chat "react": "^17.0.2", "react-alert": "^7.0.3", # this dependency is for copy id alert for video chat invitations "react-alert-template-basic": "^1.0.2", # this dependency is for copy id alert for video chat invitations "react-confirm-alert": "^2.7.0", # this dependency is for the custom alert component "react-copy-to-clipboard": "^5.0.3", # this dependency is for automatic copy id when the user click "react-device-detect": "^1.17.0", # this dependency is for detect if is browser, Android or IOS "react-dom": "^17.0.2", "react-i18next": "^11.11.3", # this dependency is for translation "react-router": "^5.2.0", # Router "react-router-dom": "^5.2.0", # Router "react-scripts": "4.0.3", "react-speech-recognition": "^3.8.2", # module for transcript speech to text "recoil": "^0.3.1", # this dependency is for global state managment "simple-peer": "^9.11.0", # used by video chat "socket.io-client": "^4.1.3", # used by all chat features "uuid": "^8.3.2", # generate ramdom id (option not activated in the app - the code is commented) "visitor-info": "^0.3.1", # get some infos from users chat "web-vitals": "^1.0.1", "workbox-background-sync": "^6.1.5", # PWA google modules "workbox-broadcast-update": "^6.1.5", # PWA google modules "workbox-cacheable-response": "^6.1.5", # PWA google modules "workbox-core": "^6.1.5", # PWA google modules "workbox-expiration": "^6.1.5", # PWA google modules "workbox-google-analytics": "^6.1.5", # PWA google modules "workbox-navigation-preload": "^6.1.5", # PWA google modules "workbox-precaching": "^6.1.5", # PWA google modules "workbox-range-requests": "^6.1.5", # PWA google modules "workbox-routing": "^6.1.5", # PWA google modules "workbox-strategies": "^6.1.5", # PWA google modules "workbox-streams": "^6.1.5" # PWA google modules },