CANA Advisors

7371 Atlas Walk Way
Gainesville, Virginia 20155
Telephone (703) 317-7378
Facsimile (571) 248-2563

CANA Advisors A Veteran-Owned and Woman-Owned Company. © CANA LLC 2019. All Rights Reserved.

Using the SEAL Stack

Recently, we needed to develop a desktop application for one of our clients. As  web developers, our immediate thought was to use the SEAL Stack (http://sealstack.org). SEAL is a technology stack that uses SQLite, Electron, Angular, and Loopback.

 

Why use Electron?

Electron (https://electronjs.org) gives a developer the ability to build cross platform desktop apps with JavaScript, HTML, and CSS. It is a framework developed by GitHub.  It combines Node.js, which is a JavaScript runtime that allows you to run JavaScript on the desktop, with Chromium, the open-source technology behind Google’s Chrome browser.  This allows a developer to develop as if it is a web app, but from the user's perspective. It functions as a single application.  Electron is used in many popular applications including Slack, Microsoft Visual Studio Code, and tools from GitHub.


Why use Angular?
Angular is a front-end web framework developed by Google. (https://angular.io). It makes writing single-page apps easy. It uses declarative templates for data binding and handles routing.  It promotes component reuse across your application, making your code more stable.  Angular uses TypeScript, an extension of JavaScript that adds strong typing.


Running a Web Server
An interesting twist to the project, was that there was a high probability that the client would want it converted to a web app in the future. Aside from the benefit of being able to develop with familiar web technologies, Electron gave us the ability to easily transition to the web at a later date if needed. 

 

With this knowledge in mind, we decided from the very beginning to build the app like a standard single-page app and use Electron to run it. Because Electron runs on Node.js, it was easy to spin up a server within the app. In the future, if we need to transition the app to the web, it will simply require deploying the code to a web server (and a few additional tasks such as changing data connectors to connect to a database server, adding authentication, etc).


Why use LoopBack?
For the web framework, we chose LoopBack (https://loopback.io). LoopBack is a highly-extensible, open-source Node.js framework. It is built on Express, the most popular Node.js framework. It makes it easy to quickly create dynamic end-to-end REST APIs. It has an ORM and data connectors for all the standard databases making it very easy to retrieve and persist data.

 

Why use SQLite?
By default, the LoopBack boilerplate configuration uses memory for data storage.  Because we needed the data to persist between sessions, so we decided to use a database for data storage. In this case, we chose SQLite (https://sqlite.org).  Benefits of SQLite include not having to install a database server on the user’s computer.  SQLite is public domain and works across many different platforms.  The data is stored in a single .sqlite file that can be transferred from one computer to another if needed, which could help with syncing data between users in the future.  To avoid any issues running SQLite cross platform, we used a Node.js implementation of a SQL parser called sqljs. and wrote a custom connector for Loopback using sqljs (https://github.com/canallc/loopback-connector-sqljs).


System Architecture
Here’s a diagram illustrating how the four elements of the SEAL stack integrate together.

 

Wiring it Up
The easiest way to get started with the SEAL stack is to use the quick-start project (http://sealstack.org). The site is well documented. It also provides instructions for modifying an existing application to use the SEAL stack.

This article was a collaboration between CANA Advisors Principal Software Developer Dan Sterrett, and CANA Advisors Senior Software Developer Aaron Luprek.

 

For more programming articles, information on on SEALstack and other projects in development visit CANAadvisors.com

Please reload

Recent Posts

November 11, 2019

Please reload