GithubHelp home page GithubHelp logo

chat-app's Introduction

Demo

https://ntgn81.github.io/chat-app/

To start local dev server

  1. git clone
  2. npm install
  3. npm start

Notes

This app currently have 2 components, with 2 redux stores, to trully immitate 2 different users logging in.

Tools/framework used

  • React for the UI components
  • Redux for state management
  • Sass for writing css
  • Mock WebSocket for communication between users
    • Replaceable with real WebSocket by switching out single file - mock-web-socket.js
  • Mock http for communication with api for chat room creations
    • Replaceable with calls to real API end point by switching out mock-http.js
  • Webpack 4 for bundling/running dev server
  • CSS Flexbox for the layout
  • Jest/Enzyme for unit tests
  • Prettier/ESLint for automatic code formatting
  • Husky for precommit checks

Redux state structure

{
  "rooms": {
    "byId": {
      "laura-rob": {
        "id": "laura-rob",
        "type": "private",
        "users": [
          "u1",
          "u2"
        ],
        "typingUserIds": [
          "u2"
        ],
        "messageIds": [
          "msg1",
          "msg2"
        ]
      }
    },
    "current": "laura-rob"
  },
  "messages": {
    "byId": {
      "msg1": {
        "id": "msg1",
        "userId": "u1",
        "roomId": "laura-rob",
        "content": "Hello, Rob",
        "created": "2018-04-02T17:57:58.205Z"
      },
      "msg2": {
        "id": "msg2",
        "userId": "u2",
        "roomId": "laura-rob",
        "content": "Hello Laura",
        "created": "2018-04-02T17:58:01.644Z"
      }
    }
  },
  "socket": {
    "readyState": 1
  },
  "users": {
    "byId": {
      "u1": {
        "id": "u1",
        "name": "Laura"
      },
      "u2": {
        "id": "u2",
        "name": "Rob"
      }
    },
    "current": "u1"
  }
}

Things to improve on

  • 100% code coverage
  • Prettier UI
  • Real WebSocket server - if Node.js, using uWebSockets
  • Real http server - Express/Koa...

chat-app's People

Watchers

James Cloos avatar Nam Nguyen 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.