<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>fulcro on Just Enough Software</title>
    <link>https://justenough.software/tags/fulcro/</link>
    <description>Recent content in fulcro on Just Enough Software</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 27 Jul 2023 10:10:00 -0500</lastBuildDate><atom:link href="https://justenough.software/tags/fulcro/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Serving up Fulcro</title>
      <link>https://justenough.software/posts/serving-up-fulcro/</link>
      <pubDate>Thu, 27 Jul 2023 10:10:00 -0500</pubDate>
      
      <guid>https://justenough.software/posts/serving-up-fulcro/</guid>
      <description>Now that we understand the general requirements for hosting FE assets and backend functionality with Pages, let&amp;rsquo;s figure out how to get that working with Fulcro.
Pages has a long list of supported frameworks, but, perhaps unsurprisingly, none of them are a CLJS framework. Luckily, remembering from the Pages overview post, we can either build the assets ourselves and commit them to our repo, or, possibly, we can specify a custom build command that will build the assets for us as part of the Pages infrastructure.</description>
      <content>&lt;p&gt;Now that we understand the general requirements for hosting FE assets and backend functionality
with Pages, let&amp;rsquo;s figure out how to get that working with Fulcro.&lt;/p&gt;
&lt;p&gt;Pages has a long list of &lt;a href=&#34;https://developers.cloudflare.com/pages/framework-guides/&#34;&gt;supported frameworks&lt;/a&gt;, but, perhaps unsurprisingly, none of them are a
CLJS framework. Luckily, remembering from &lt;a href=&#34;https://justenough.software/posts/pages-functions-overview/&#34;&gt;the Pages overview post&lt;/a&gt;, we can either build the assets
ourselves and commit them to our repo, or, possibly, we can specify a custom build command that
will build the assets for us as part of the Pages infrastructure.&lt;/p&gt;
&lt;p&gt;In this post, we&amp;rsquo;ll do the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Get a barebones Fulcro app that we can build and view locally&lt;/li&gt;
&lt;li&gt;Sort out how we can build this via the Pages CI/CD infrastructure.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;barebones-fulcro-app&#34;&gt;Barebones Fulcro App&lt;/h2&gt;
&lt;p&gt;Originally, this section was going to be about creating a barebones app with the Fulcro
Template, but after going down that route for a bit I realized that the frontend code relies on
having the backend code running, which isn&amp;rsquo;t what I need or want at the moment.&lt;/p&gt;
&lt;p&gt;So instead of that, we&amp;rsquo;re going to follow the &lt;a href=&#34;https://book.fulcrologic.com/#_create_your_project&#34;&gt;Fulcro book&lt;/a&gt; to get the bare minimum frontend code
working.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve created the &lt;a href=&#34;https://github.com/futuro/autoflare&#34;&gt;autoflare&lt;/a&gt; repo to house the code for this project.&lt;/p&gt;
&lt;p&gt;To get this barebones Pages app to work, we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;an &lt;code&gt;index.html&lt;/code&gt; file in whatever our &lt;code&gt;build directory&lt;/code&gt; is&lt;/li&gt;
&lt;li&gt;said index file to have the necessary Fulcro things &amp;ndash; a div to attach to, and a script tag
pointing at the generated js file&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;generating-the-frontend-assets&#34;&gt;Generating the frontend assets&lt;/h3&gt;
&lt;p&gt;With &lt;a href=&#34;https://github.com/futuro/autoflare/commit/e7382fa3acfe5236615b133ae8c6d6ab82824c8b&#34;&gt;this commit&lt;/a&gt; we&amp;rsquo;ve got a barebones Fulcro app that we can see locally via &lt;code&gt;npx shadow-cljs server&lt;/code&gt; and for which we can generate a JS file via &lt;code&gt;npx shadow-cljs compile :main&lt;/code&gt; or, to pass
it through the Closure Compiler&amp;rsquo;s optimizations, &lt;code&gt;npx shadow-cljs release :main&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After experimentation with the Cloudflare Pages build environment, I discovered that it has
neither a JDK nor the Clojure binary, the first of which is necessary no matter what, and the
second we can skip &amp;ndash; if we want to &amp;ndash; by defining our dependencies in just the
&lt;code&gt;shadow-cljs.edn&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not exactly sure how that&amp;rsquo;ll play out with my dev environment, but the docs seem to
indicate that it should be fine. The dev process was:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, move dependency management &lt;a href=&#34;https://github.com/futuro/autoflare/commit/ff21b01&#34;&gt;into the shadow-cljs.edn file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Next, try installing the jdk with apt, first &lt;a href=&#34;https://github.com/futuro/autoflare/commit/60ccfea&#34;&gt;without sudo&lt;/a&gt; and then &lt;a href=&#34;https://github.com/futuro/autoflare/commit/ced28ad&#34;&gt;with sudo&lt;/a&gt;, though neither
of those worked out&lt;/li&gt;
&lt;li&gt;Finally, I discovered that the JDK can work just from an archive file, so I &lt;a href=&#34;https://github.com/futuro/autoflare/commit/31756f8&#34;&gt;downloaded it&lt;/a&gt;
and (after fixing &lt;a href=&#34;https://github.com/futuro/autoflare/commit/5c2eb68&#34;&gt;a typo&lt;/a&gt;), got a successful build!&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;summary-and-next-steps&#34;&gt;Summary and next steps&lt;/h2&gt;
&lt;p&gt;So the build environment comes with the necessary versions of NPM/Yarn, we add a JDK via an
archive file, and then Shadow CLJS does the rest. If we ever need or want to use deps.edn in our
build process, we can likely download a binary for Clojure in much the same way we dl&amp;rsquo;ed the
JDK.&lt;/p&gt;
&lt;p&gt;Next up is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learning about how Functions work&lt;/li&gt;
&lt;li&gt;Figuring out how to incorporate that into the build process&lt;/li&gt;
&lt;li&gt;Figuring out how that fits into the dev experience&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See you next time!&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>AutoFlare Overview</title>
      <link>https://justenough.software/posts/serverless-automerge/</link>
      <pubDate>Thu, 20 Jul 2023 13:38:00 -0500</pubDate>
      
      <guid>https://justenough.software/posts/serverless-automerge/</guid>
      <description>I&amp;rsquo;ve got a project idea, which I&amp;rsquo;ve just now decided to call AutoFlare, that I&amp;rsquo;ve been rolling around in my head, primarily as a way to learn more about three technologies:
Cloudflare&amp;rsquo;s cloud offerings Fulcro automerge CRDT I&amp;rsquo;ve got a lot of experience with AWS and GCP, and there are plenty of things I like about those platforms, but I&amp;rsquo;d like to branch out, and some of the blog posts I&amp;rsquo;ve seen from Cloudflare around network egress costs and things has got me curious.</description>
      <content>&lt;p&gt;I&amp;rsquo;ve got a project idea, which I&amp;rsquo;ve just now decided to call &lt;code&gt;AutoFlare&lt;/code&gt;, that I&amp;rsquo;ve been rolling
around in my head, primarily as a way to learn more about three technologies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.cloudflare.com/developer-platform/products/&#34;&gt;Cloudflare&amp;rsquo;s cloud offerings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://fulcro.fulcrologic.com/&#34;&gt;Fulcro&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://automerge.org/&#34;&gt;automerge CRDT&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;rsquo;ve got a lot of experience with AWS and GCP, and there are plenty of things I like about those
platforms, but I&amp;rsquo;d like to branch out, and some of the blog posts I&amp;rsquo;ve seen from Cloudflare
around network egress costs and things has got me curious. I&amp;rsquo;d like to learn more about their
various offerings, and play around with building a mildly complex application with just what
they&amp;rsquo;ve got. (This blog is hosted by Cloudflare, as a static set of assets, which I&amp;rsquo;ve really
enjoyed the simplicity of.)&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve got &lt;em&gt;some&lt;/em&gt; experience with Fulcro, and, of all of the web frameworks I&amp;rsquo;ve used, it seems to
be the most cohesively designed, where I don&amp;rsquo;t have to spend a bunch of time choosing and
tweaking routing libraries, or storage solutions, etc. I&amp;rsquo;d like to really stretch my
understanding of Fulcro with an app more complex than just the Fulcro book, thus why it&amp;rsquo;s part of
this experiment.&lt;/p&gt;
&lt;p&gt;As for Automerge CRDT, I&amp;rsquo;ve wanted to explore and learn this library since I first learned about
it. I&amp;rsquo;m really motivated by the idea of building local-first apps, and this library seems like
it&amp;rsquo;s solved a really hard problem related to building a local-first app. Also, I&amp;rsquo;ve got a vague
sense that this might be useful in &lt;del&gt;luring&lt;/del&gt; teaching JS devs about the joys of CLJS development.&lt;/p&gt;
&lt;p&gt;This series of posts will be different forms and formats of exploring these technologies and
building this small project. Posting order will be largely dependent on my whims, and what
strikes me as the most interesting thing to look at in the moment.&lt;/p&gt;
&lt;p&gt;See you in the next post!&lt;/p&gt;
</content>
    </item>
    
  </channel>
</rss>
