Main technical details of the application:
-
Frontend and Backend are separate, communication happens through sockets for chatting, and json for every other thing for efficiency.
-
Webpack used as a static module bundler to build the assets in a efficient and minified form (if production mode). Specifically webpack used because it is the industry standard these days. Assets here refer JS/JSX, Images, HTML, SCSS (Sass) & CSS
-
NodeJS(14.8.0), ExpressJS and Mongoose used in the backend. Backend code is in src/server
-
ReactJS + Redux used in the frontend. Frontend code is in src/assets
-
All static assets outputted to dist/ folder.
-
Single page application, i.e., only one html page will be required, will serve every thing. Its logic is handled with the help of react-router-dom which is why there is only one html page which webpack outputs as index.html.
-
Progressive Web Application - Can be downloaded, manifest and icons provided, limited offline functionality
-
Push notifications enabled with the help of web-push and Google Cloud Messaging API
-
Comments given in code wherever relevant
Install though npm install, then run npm run dev-server in one terminal and npm run dev-build-assets in another terminal.
-
npm install
-
npm run dev-server [Continuously watches for development changes and restarts server accordingly]
-
npm run prod-server [Start server only once]
-
npm run dev-build-assets [Continuously watches for changes and builds frontend assets normally]
-
npm run prod-build-assets [Builds minified versions of assets]
NOTE: Assets outputted at dist/ directory.
src/config/config.js consists of some basic constants.
Server side configuration. Routes, chat sockets and server configuration.
Database connection with mongoose (MongoDB).
- Hashing, user authentication, modelling of username and password(hash) is taken care of by passport-local and passport-local-mongoose.
- friends denote the chat friends of user.
- lastestTasksNotified refers to the last time the user was notified of task deadlines.
- Chat model is defined here.
- sender and receiver strings denote respective user usernames(which are emails).
- read refers to whether or not the receiver has read the message.
Consists of deadline, username(email of user) and description.
Handles login, logout, register, adding new friends and fetching friends list.
Handles /chat paths, in this case only one (html page serving), because rest of the chatting is handled via sockets.
Consists of deadline, username(email of user) and description.
Push notifies about upcoming deadline tasks to the user
Every asset(except index.html) to be added to the project must be included here. Webpack bundles everything from this entry point.
The only html file, consists of some basic html.
Website icon.
Service worker for PWA.
Helper for notifications.
Sass and css files.
Consists of sample app icons for Progressive Web Application.
Consists of redux actions for user, task, chat and common.
Consists of pure redux functions for the global store. Consists of user, chat, task and common reducers and a root reducer which combines all the reducers and exports them to javascript/components/react_container.jsx.
Consists of action type constants for redux.
Main UI for the application, consists of JSX files.
-
react_container.jsx Starting point, contains basic configuration for redux and react-router-dom and adds itself to react-container (React starting point, i.e., root) in index.html
-
app.jsx This is where the UI really starts. Consists of all the sections required.
-
chat_section/ Consists of chat_section.jsx (starting point of chat), chat_list.jsx (chat users list), chat_window.jsx (when chatting with a friend) and chat_message.jsx which are rendered inside chat_window.jsx.
-
common/ Consists of navbar, loading spinner and an empty file icons.jsx (icons to be added later).
-
error_section/ Consists of basic Not Found 404 and 500 internal server error element.
-
home_section/ Consists of basic home page.
-
task_section/ Consists of task_section.jsx which renders task rows and new task form.
-
user_auth_section/ Consists of login and registering forms and corresponding logic along with logout button which appears in navbar.