Baseline: Delivering mind-blowing user experiences with isomorphic JavaScript

Augmenting complex desktop applications like our volunteer scheduling software with web-based administrative tools posed some serious challenges in terms of user experience. For the web app to feel on-par (or superior) to the heavy-lifting installed applications our customers knew and loved, changes had to to be reflected in real time - waiting on responses to AJAX calls to the backend just would not cut it. The only way to achieve the real-time interactions we wanted was to run the bulk of our complex domain-specific logic directly in the browser. But at the same time, the same domain-specific logic needed to be available in our node.js backend.

In response to this need, baseline was born - a nexus of codependent domain entities backed by an in-memory database that can run application-specific functions at blazing speeds. It is indeed the magic behind some incredibly responsive user interactions in a truly complex domain space, but the utility of this unique paradigm does not stop on the client side. On the backend, we use baseline as the domain layer of an onion style architecture that allows us to write expressive, performant, and testable application logic completely isolated from database queries other environmental dependencies.

How it works

When instantiating a baseline instance, it just needs to be populated with whatever subset of the complete database is required by the logic that will be run. Once the required data is in-memory, the baseline instance is ready to execute domain logic at lighting speed in any environment.

In the browser, a global baseline instance is instantiated on each page load, pre-populated with the data that is known to be required on that page. The global baseline instance can be accessed by UI components, giving the view layer real-time access to any application data and logic it needs. Imagine how responsive UIs are when they have unfettered programmatic access to virtually all domain-specific logic, instead of having to rely on individually crafted, slow AJAX requests for domain-specific needs.

On the server side, a baseline instance can be instantiated on-demand, to resolve whatever domain-specific questions may arise in each request using the same powerful domain entities.

The evolution continues

Baseline has proved to be incredibly valuable as we push the bounds of what is possible in the browser, and we continue to find new ways to leverage this unique paradigm. For example, taking advantage of having an in-memory database on the client side, we recently added the ability to batch CRUD operations together on the client side, sending them up to the server as a group that either succeeds or fails.

const result = await baseline.batch(() => {
    const volunteerId = baseline.volunteer.create();
    const jobs = await AskJobsDialog.do();
    baseline.volunteer.set( 'jobs', jobs );
} );

One of the advantages of baseline being an in-house framework is that it continues to evolve to suit our specific needs, as does modui, our proprietary front-end framework. All things being equal, of course we always prefer to use traditional off-the-shelf technology, but if there is enough value to be had in blazing our own trail, we are up for the adventure. We've found that trailblazing often allows us to serve our clients in truly unique ways. (And it's also, well, a lot of fun.)

Does this kind of adventure sound appealing to you? Are you looking for a place where you can do your best work, without the stress? If so, please put your name in the hat by applying for an open position.

Rotunda blog icon

The Rotunda Blog.
Get a behind-the-scenes scoop on what we're up to!

ARTICLE

Connect with breakout sessions

READ