mikelevins / electron-lisp-boilerplate

A rudimentary boilerplate for building Electron apps with embedded Lisp helper processes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

electron-lisp-boilerplate

Overview

A very simple Electron boilerplate that sets up an app whose application logic is handled by a Lisp child process and whose UI is handled by Electron. Uses sbcl with quicklisp and Hunchentoot to build the Lisp helper process, and electron-packager to build delivered apps.

Prerequisites

You’ll need the following prerequisites to work with this boilerplate:

Usage

  1. Clone electron-lisp-boilerplate

  2. Remove the .git subdirectory

  3. Rename the project from electron-lisp-boilerplate to the name of your project
    There isn’t yet a quick and easy way to do this; you’ll have to search for all occurrences of "electron-lisp-boilerplate" in the project and replace them. I intend to address this deficiency in a future version.

  4. Run the command ./buildapp.sh

The buildapp.sh command

  1. uses sbcl to build the lispapp program from sources in the lisp subdirectory

  2. installs the needed Node modules in your project’s directory

  3. uses electron-packager to build the Electron app

The resulting app is saved into the subdirectory electron-lisp-boilerplate-<DELIVERY-TARGET>, where <DELIVERY-TARGET> is the OS name and the hardware type—​for example, darwin-x64.

When you launch the delivered app it creates a window and populates it a "Hello, World" message and a simple form you can use to verify that round-trip processing between the Electron and Lisp processes is working.

Once that’s working, you can start building your own app by replacing and extending the code in the lisp subdirectory.

You can remove the files generated by the build by running the command ./clean.sh

Making it your own app

The built app is an Electron application that spawns a Lisp process when it launches. It then sends an HTTP request to its child Lisp process, which returns an HTML document that contains the initial UI of the application. The Electron process presents the UI, and the Lisp child process handles requests generated by user interactions.

To build your application, write Lisp code in the lisp subdirectory, implementing HTTP handlers using Hunchentoot’s handler framework. To add UI elements, write Lisp code that embeds those elements in the pages served by Hunchentoot.

This version of the boilerplate uses htmx to build HTML widgets, and the native-elements CSS framework for styling.

About

A rudimentary boilerplate for building Electron apps with embedded Lisp helper processes


Languages

Language:Common Lisp 53.4%Language:JavaScript 24.6%Language:HTML 11.9%Language:Shell 10.0%