antares-protocol

Antares is an architecture and protocol for real-time web apps.

Usage no npm install needed!

<script type="module">
  import antaresProtocol from 'https://cdn.skypack.dev/antares-protocol';
</script>

README

Antares">

Antares is a way to construct real-time web apps - web apps that have essentially banished the notion of stale data from their repertoire, and are configured to share and respond with data at the speed modern users expect.

🔊

ES 2015 npm version <22 kb Travis Appveyor for Windows Greenkeeper badge

Dev Dependencies npm type definitions styled with prettier try on runkit twitter link

What Exactly Is Antares?

Antares is an API for building the implementation of your custom-event protocol, on the client or server, by orchestrating the consequences for your chosen event types.

What Benefits Can I Get By Using It?

  • A Clean architecture of code with a high degree of decoupling and fault-tolerance.
  • A clean, cancelable model of async effects, not dependent on a component toolkit like React
  • Kickstart your apps' development by building abstractions that simulate input or output, allowing you to focus on the core functionality, of your app
  • Understand and use the Observable datatype - a type that is a superset of Promise, and which can stand in for processes that feed your app data, or processes that cause consequences to the outside world.
  • Drive your app during testing with 'simulated user interaction' to see more of its functionality without clicking around.
  • Use snapshot testing to verify your app's behavior, whether or not it uses React or even has a UI.

What kinds of apps can I build with it?

Antares, with RxJS, manages consequences, which any app has, so it's not limited to client or server, or even Web Apps.

There are many demo apps included in this project that show what you can build.

  • A console app that speaks names and writes to a file
  • A utility that turns all-at-the-end AJAX requests for arrays into streaming Observables (eg /users/)
  • A Web Server in demos/express/index.js
  • A Canvas-based requestAnimationFrame animation.
  • A Console app that detects a cheat-code of 5 clicks in a short interval.
  • A Web Audio app that streams and queues up music from attachments in your Inbox.
  • An IOT application interfacing with Raspberry Pi GPIO (Coming Soon)

OK, but where should I start?

The flagship demo which can be utilized as a course to learn how to fit an Antares Agent with an existing React/Redux/Express app, is located here: The Hotel California Antares Sample App.

It's becoming part of a workshop - if you're interested in learning more, or updating me on your progress, tweet it!

What's the TL;DR?

The 4 Principles:

  1. An agent processes Flux Standard Actions given it through either agent.process or agent.subscribe
  2. Actions are synchronously processed through functions given to agent.filter...
  3. ...and asynchronously processed through functions known as renderers, configured via agent.on.
  4. Renderer functions may produce consequences (i.e. effects, or side-effects) return Observables of new actions to be processed, specify a concurrency mode and be run with other options

Testing? Yes, please!

Antares is highly tested. And since testing async is hard, some integration level tests run a bunch of complex stuff (our demos), and simply assert on the console output. The slightest change in behavior can thus be visible in the output of the demo as a large change. This, with Jest Snapshot testing makes asserting on our output a piece of cake.

For unit tests, check out what the unit test suite looks like on a recent CI build. (Thanks to Dan Abromov for illustrating in his 2015 react-dnd/dnd-core project what a nicely formatted test suite output can be)

Antares has unit tests, and demos whose output is tested in CI on MacOS, Linux, and Windows. Because concurrency must be interacted with to truly be understood, many of the demos support you interacting with them in a console, or at least changing their parameters in config (demos/config.js)

See the output of a run of all demos on Travis CI, and if you run them locally, make sure you have sound turned on!

Here are some more ways you can run demos (use cross-env on windows)

> DEMO=muteFruit INTERACTIVE=1 node demos/index
> DEMO=muteFruit inner=100 outer=100 node demos/index
> cross-env DEMO=muteFruit inner=100 node demos/index

Show your love!

  • Display a badge on your project: I ♥️ Antares
  • Donate to the project to the project, or somewhere you think you can pay it forward, even if not here!

Gratitude, Props, Thanks To


Antares