Inspiration 💡

Since we are working remotely, it's hard to find out if our coworkers are doing fine or not. In the old-school working style, we could see peoples' faces and we could say almost immediately if they're not fine. But now we need a digital way of checking our coworkers' moods.

What it does 🎭

It tries to guess if the colleague is doing fine by the way they type into the daily stand-up form. In more detail, it compares the typing pattern of the user with the "saved" typing patterns of them. Assuming that the user was doing fine at the beginning (when they typed the first few daily reports), the typing pattern will change if the user doesn't feed fine, and the platform shows it.

Note. As soon as TypingDNA Focus is released, we can integrate that into the current solution too, and get more metadata.

How I built it ⌨️🔨

The project consists of different parts:

  • TypingDNA RxJS-based Client: GitHub/NPM. A wrapper for TypingDNA API that has type specification (both for input and the response), parses the output (e.g. casting numbers into booleans), and returns an observable (so that you can set up retry policy et cetera).
  • Daily What's Up Backend: GitHub. The backend exposes two endpoints:
    • POST /api/v1/user/{userId}/msg: To save the daily reports.
    • GET /api/v1/user/{userId}: To get all the daily reports for a user, together with the scores of the message.
  • Heroku Deployment: The backend code is deployed on Heroku and is accessible through the URL daily-whats-up.herokuapp.com.

Both the NPM package and the backend are built with TypeScript. The backend runs with Node.js, Express, and TSOA. Inversify is used for dependency injection. In both codebases Jest is used for testing, ESLint+Prettier for linting and formatting, and GitHub actions for CI.

The backend is automatically deployed on Heroku upon pushing to the main branch.

How to test it 🎮

Use TypingDNA's pattern viewer and write something. Then send the text together with its pattern0 to our API:

$ curl -XPOST https://daily-whats-up.herokuapp.com/api/v1/user/<userId>/msg \
  -d '{ "message": "<message>", "typingPattern0": "<pattern>" }'

To get a list of all messages with their metadata:

$ curl -XGET https://daily-whats-up.herokuapp.com/api/v1/user/<userId>

Challenges I ran into ☣️

New TSOA had some breaking changes that I wasn't aware of. The Node.js client of TypingDNA doesn't work well with TypeScript and has a callback API (so I created another weapper on top of it). Configuring Inversify was also a bit tricky.

Accomplishments that I'm proud of 🏆

The RxJS-based client for TypingDNA: typingdnaclient-rxjs

What I learned 📚

A lot! The things I learned include:

  • Using ESLint. I'm currently using TSLint at work (which is recently deprecated). I liked the ecosystem of ESLint a lot better, especially its seamless integration with Prettier.
  • Using Jest for testing. Currently a user of Jasmine, I found Jest a lot smoother, especially for its built-in support for TS.
  • Using RxJS AJAX library. Currently using Request (which is also deprecated a year ago), I was looking for an RxJS-based HTTP client.
  • Using GitHub actions.
  • Using Heroku.
  • Using Postman.

What's next for Daily What's Up 📆

  • Add the remaining functions to TypingDNA RxJS client, together with their types.
  • Add more static checks.
  • Add test coverage and make it 100%.
  • Use TypingDNA Focus as well, when released.
  • Add persistent storage.
  • Add authentication and user management.

Built With

Share this project:

Updates