pithyless / fulcro-rad-demo

A demo for Fulcro RAD using either SQL or Datomic databases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fulcro RAD Demo

This is a demo repository for Fulcro RAD. It includes a shared source directory of files that would be common to any project, and then separate source directories that have specific files that would be needed to work with specific back-end technologies (currently SQL and Datomic).

Important
Login is tony@example.com with password letmein.

Status

The SQL version has some known bugs. If you want to play with RAD, use the Datomic database adapter for now.

Warning
The API is not stable. While in Alpha there will be breaking changes. I will try to minimize these, but this library is still in the design phases, so don’t use it for "real stuff" unless you can tolerate that instability on top of the alpha status.

Running From Source

The very active development I’m doing makes changes to 5 projects at once (Fulcro, Fulcro RAD, Fulcro RAD Datomic, Fulcro RAD SQL, and this demo). I do not guarantee I will keep everything in sync as far as versions in the deps file go. I personally set the following in my top-level ~/.clojure/deps.edn:

{:aliases {:f3-dev    {:override-deps {com.fulcrologic/fulcro {:local/root "/Users/tonykay/fulcrologic/fulcro"
                                                               :exclusions [com.taoensso/sente]}}}
           :rad-dev   {:override-deps {com.fulcrologic/fulcro-rad         {:local/root "/Users/username/fulcrologic/fulcro-rad"}
                                       com.fulcrologic/fulcro-rad-sql     {:local/root "/Users/username/fulcrologic/fulcro-rad-sql"}
                                       com.fulcrologic/fulcro-rad-datomic {:local/root "/Users/username/fulcrologic/fulcro-rad-datomic"
                                                                           :exclusions [com.datomic/datomic-free]}}}}}

so that in IntelliJ (or at the command line) I can work from local sources for all of them. I try to remember to push SNAPSHOTS daily, but if I forget and you see some missing symbol error or things are broken, that is almost certainly why.

Running shadow and clj would look like this from the command line:

# in one terminal
$ shadow-cljs -A:f3-dev:rad-dev watch main
# in another terminal
$ clj -A:dev:f3-dev:rad-dev:datomic

In IntelliJ, you’d simply make sure to run a CLJ REPL with current classpath, and use the alias checkboxes and + button in the Clojure Deps tab to set it up.

Building the SPA

You must compile the CLJS source to run the client. If you want to be able to edit it, just start a shadow-cljs watch:

$ yarn
$ shadow-cljs watch main

if you don’t have yarn, use npm install instead.

Running an SQL-based Server

The example code should work with most SQL databases (and defaults to using an in-memory H2 db). The data source is configured in the defaults.edn config file in the sql source directory. See the HikariCP connection pool documentation.

The SQL example has a custom development namespace in the src/sql source folder, along with components needed to run that server.

You can start the server-side version for SQL using the deps aliases that set up the proper classpath:

$ clj -A:dev:sql
user=> (clojure.core/require 'development)
user=> (development/go)

Running a Datomic-based Server

The example code for Datomic components is in the src/datomic folder, along with a custom development.clj. It defaults to using an in-memory datomic-free database.

You can run it with the :datomic deps alias:

$ clj -A:dev:datomic
user=> (clojure.core/require 'development)
user=> (development/go)

Restarting

The development/restart will stop the server, reload source, and start the server.

About

A demo for Fulcro RAD using either SQL or Datomic databases.


Languages

Language:Clojure 99.5%Language:HTML 0.4%Language:Makefile 0.1%