All Projects → hasura → 3factor

hasura / 3factor

3factor app is an architecture pattern for modern fullstack apps. 3factor apps are fast to build and are highly scalable.

Projects that are alternatives of or similar to 3factor

Cqrs
cqrs framework in go
Stars: ✭ 179 (+37.69%)
Mutual labels:  event-handlers
capsid
💊 Declarative DOM programming library. Lightweight (1.79 kb).
Stars: ✭ 76 (-41.54%)
Mutual labels:  event-handlers
Aura.signal
SignalSlots / EventHandler Implementation
Stars: ✭ 32 (-75.38%)
Mutual labels:  event-handlers
Ng Click Outside
[Inactive] Angular directive for handling click events outside of an element.
Stars: ✭ 216 (+66.15%)
Mutual labels:  event-handlers
observe-component
A library for accessing React component events as reactive observables
Stars: ✭ 36 (-72.31%)
Mutual labels:  event-handlers
blaze-magic-events
A new way of binding event handlers to html elements for Meteor's Blaze.
Stars: ✭ 26 (-80%)
Mutual labels:  event-handlers
Functional Promises
Write code like a story w/ a powerful Fluent (function chaining) API
Stars: ✭ 141 (+8.46%)
Mutual labels:  event-handlers
Xer.cqrs
A lightweight and easy-to-use CQRS + DDD library
Stars: ✭ 96 (-26.15%)
Mutual labels:  event-handlers
Android-Shortify
An Android library used for making an Android application more faster with less amount of code. Shortify for Android provides basic functionalities of view and resource binding, view customization, JSON parsing, AJAX, various readymade dialogs and much more.
Stars: ✭ 21 (-83.85%)
Mutual labels:  event-handlers
Mitt
🥊 Tiny 200 byte functional event emitter / pubsub.
Stars: ✭ 6,945 (+5242.31%)
Mutual labels:  event-handlers
ng2-events
Supercharge your Angular2+ event handling
Stars: ✭ 17 (-86.92%)
Mutual labels:  event-handlers
cqrs
A foundational package for Command Query Responsibility Segregation (CQRS) compatible with Laravel.
Stars: ✭ 37 (-71.54%)
Mutual labels:  event-handlers
Linkstate
Bind events to state. Works with Preact and React.
Stars: ✭ 290 (+123.08%)
Mutual labels:  event-handlers
Go Trigger
A Global event triggerer for golang. Defines functions as event with id string. Trigger the event anywhere from your project.
Stars: ✭ 212 (+63.08%)
Mutual labels:  event-handlers
Ws Wrapper
Lightweight WebSocket lib with socket.io-like event handling, requests, and channels
Stars: ✭ 58 (-55.38%)
Mutual labels:  event-handlers
Messagebus
A MessageBus (CommandBus, EventBus and QueryBus) implementation in PHP7
Stars: ✭ 178 (+36.92%)
Mutual labels:  event-handlers
burns
Manage your application's events without writing spaghetti code
Stars: ✭ 86 (-33.85%)
Mutual labels:  event-handlers
Fluentmediator
🔀 FluentMediator is an unobtrusive library that allows developers to build custom pipelines for Commands, Queries and Events.
Stars: ✭ 128 (-1.54%)
Mutual labels:  event-handlers
Observable
minimalist event system for Python
Stars: ✭ 66 (-49.23%)
Mutual labels:  event-handlers
Wintoast
WinToast is a lightly library written in C++ which brings a complete integration of the modern toast notifications of Windows 8 & Windows 10. Toast notifications allows your app to inform the users about relevant information and timely events that they should see and take action upon inside your app, such as a new instant message, a new friend request, breaking news, or a calendar event.
Stars: ✭ 307 (+136.15%)
Mutual labels:  event-handlers

3factor app

3factor app is an architecture pattern for modern full-stack apps. 3factor enables building apps that are robust and scalable from the get go by using modern API architectures along with the power of Cloud. Jump to reference implementation.

We propose an architecture pattern which is composed of 3 factors:

  1. Realtime GraphQL
  2. Reliable eventing
  3. Async serverless

Consider a food ordering application built in traditional way vs 3factor way:

3 factor architecture

We can see here the essense of the architecture i.e. all business logic is invoked via events. The app manipulates state via a GraphQL API and is also subscribed (realtime) to any new state. We will describe the 3factors in more detail below.

Factor #1: Realtime GraphQL

Apart from providing an amazing frontend developer experience, GraphQL is a crucial component in 3factor architecture as it allows flexible API access and realtime capabilities. The GraphQL API should have the following properties:

  • Low-latency: An end-user should see instant feedback of an action (i.e. state manipulation) and not have to wait long on an API (<100ms ideal, upto 1 second at worst).
  • Support subscriptions: Consume information "realtime" from the backend via GraphQL Subscriptions. Avoid the use of continuous polling (for scalability).

Read more...

Factor #2: Reliable eventing

In 3factor, business logic is initiated via events. This removes complex state management in your API layer and defers it to bespoke business logic functions. Events can also be persisted so that entire history of state is available for observability. Further, the event system must have the following 2 properties:

  • Atomic: Mutations to the application state should atomically create event(s).
  • Reliable: Events should be delivered (to any consumer) with atleast-once guarantee.

Read more...

Factor #3: Async serverless

Write business logic as event handling functions. Each function only cares about one event and is hence small & cohesive. The easiest way to deploy such functions is in serverless compute. Serverless minimizes backend ops and gives "infinite" scalability while being cost-efficient. The serverless functions should follow few best-practices:

  • Idempotent: The code should be prepared for duplicate delivery of events.
  • Out-of-order: Events may not be guaranteed to be received in any realtime order. The code should not depend on any expected sequence of events.

Read more...


In short, a 3factor app requires you to remove state management from your API layer. It encourages fine-grained state changes and event generation (in data store) and corresponding event delivery (via event queues) to invoke business logic. The business logic can further change the state which is then delivered to subscribed clients via realtime GraphQL.

The 3factor app architecture is an implementation of the CQRS pattern in many ways. The frontend gives the "commands" and then "queries" (subscribes) for the new state while events invoke the business logic behind the scenes.

Comparison to 12factor.net

The 3factor name is inspired from 12factor.net. 12factor.net, created 7 years ago by the folks at Heroku, is a guide/best-practices for creating microservices based applications for modern cloud. Although the name is similar, 3factor.app is actually an application design pattern.

Reference implementation

A complete step-by-step reference implementation for a 3factor app is available at: github.com/hasura/3factor-example

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].