Code Monkey home page Code Monkey logo

redux-todo's Introduction

ReduxTODO

ReduxTODO is just another todo-app where states are managed by Redux. The app is composed of three modules, redux-todo-mongo, redux-todo-express and redux-todo-react. Client-side state of a todo list is managed by Redux and it is synced with MongoDB. Express server places between those two as a HTTP API server.


Specification

Client

Server

Deployment


Features

CRUD of Todos

ReduxTODO supports basic CRUD operations on todo list. All the todos and dones are managed by the state management tool, Redux.

create and delete
create and delete
move and edit
move and edit
mark as done and unmark
mark as done and unmark

Accessibility

ReduxTODO supports keyboard control. All the interactable components would be highlighted with a thick outline so that users can recognize which element is active.

keyboard support
keyboard support

Synchronizing with MongoDB

Todo list state is not only stored in Redux but also in MongoDB. When you open the client app, it will fetch the stored data from server. Every updates made on the client-side is applied to DB. To prevent too much HTTP requests being made, updating DB process is debounced with 3 seconds of delay.

fetch data from server
fetch data from server on start
every updates on Redux is applied to DB
every update on Redux is applied to DB

Polling

Sometimes a client may not have the latest state if multiple users update a todo list at the same time. A client conducts polling every 10 seconds to check if the client has a stale state by comparing timestamps of server and client. If server has newer timestamp, it means that the server has newer data than the client. A client will fetch the latest data from the server and apply it to the client.

polling
poll every 10 seconds to check if server gets updated

Preventing Collision

Even though we conduct polling every 10 seconds, it is still possible for some users to update DB based on a stale state if the update is made before polling. To prevent such collision, a client will compare timestamps also before sending an update to server. If the update is made upon stale state, it would be discarded and not be sent to the server.

prevent collision
abort an update if server has been updated since last polling

How to run

0. Prerequisite

Make sure you are not an enterprise user when using Docker Desktop. Because Docker Desktop is only free for personal users.


1. Clone the Repository

git clone https://github.com/bb-in-hoodie/redux-todo.git
cd redux-todo # move to the redux todo directory

Use git clone command to clone the remote repository to your local system.


2. Run Docker Compose

docker compose up

Just a single docker compose up command will build and run images, connect them with a network, set up a volume to store MongoDB data.


3. Open the React App

Once docker compose is up and running, you can access to the client from any web browser. The default url must be http://localhost.

port number can be omitted since the default port number for a client is set as 80


redux-todo's People

Contributors

bb-in-hoodie avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.