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.
You’ll need the following prerequisites to work with this boilerplate:
-
Clone electron-lisp-boilerplate
-
Remove the .git subdirectory
-
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. -
Run the command
./buildapp.sh
The buildapp.sh
command
-
uses sbcl to build the
lispapp
program from sources in thelisp
subdirectory -
installs the needed Node modules in your project’s directory
-
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
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.