<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Jails-org - Medium]]></title>
        <description><![CDATA[A place to share Jails phylosophy - Medium]]></description>
        <link>https://medium.com/jails-org?source=rss----7863084c5e0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Jails-org - Medium</title>
            <link>https://medium.com/jails-org?source=rss----7863084c5e0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:51:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/jails-org" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Jails Inspector: An Idea I Postponed for 8 Years — Until AI Made It Possible]]></title>
            <link>https://medium.com/jails-org/jails-inspector-an-idea-i-postponed-for-8-years-until-ai-made-it-possible-0209a6aaa733?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/0209a6aaa733</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[lightning-web-component]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chrome-dev-tools]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Tue, 30 Jun 2026 22:10:27 GMT</pubDate>
            <atom:updated>2026-06-30T22:10:28.628Z</atom:updated>
            <content:encoded><![CDATA[<p>There are ideas that stay with you for years.</p><p>Not because they’re bad ideas, but because you know exactly how much work they will take before you can even answer the most important question:</p><blockquote><strong><em>“Does this actually have value?”</em></strong></blockquote><p>For me, one of those ideas was the <strong>Jails Inspector</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*AuA493bSiyKagR2y_lUz3g.png" /><figcaption>A print screen of Jails Inspector in Alpha version</figcaption></figure><p>For nearly eight years I imagined having something similar to the browser DevTools available for <a href="https://jails-js.org/">Jails</a>, a visual way to inspect an application’s component tree, understand how components relate to each other, inspect state, and make debugging significantly easier.</p><p>The problem wasn’t the idea.</p><p>It was everything that came before proving the idea.</p><h3>The Cost of Validation</h3><p>As developers, we often romanticize building.</p><p>But experienced developers know that the most expensive part of a project isn’t necessarily writing code.</p><p>It’s investing dozens or hundreds of hours into something that might not even be useful.</p><p>Every time I thought about building the Inspector, my mind immediately expanded the scope:</p><ul><li>creating the Chrome extension</li><li>communication between the page and the extension</li><li>collecting component metadata</li><li>rendering an interactive graph</li><li>selecting components</li><li>synchronizing state</li><li>handling edge cases</li><li>polishing the UI</li></ul><p>By the time I mentally finished planning it…</p><p>…I had already convinced myself it wasn’t worth starting.</p><p>Not because it wasn’t valuable.</p><p>Because validating that value was simply too expensive.</p><h3>AI Changed the Economics of Side Projects</h3><p>This wasn’t a case of AI making me “10x more productive.”</p><p>It changed something much more fundamental.</p><p>It reduced the cost of experimentation.</p><p>Instead of asking:</p><blockquote><em>“Is this worth spending several weekends building?”</em></blockquote><p>I could ask:</p><blockquote><em>“Can I validate this idea this afternoon?”</em></blockquote><p>That’s a completely different equation.</p><h3>Three Hours Later…</h3><p>I opened my editor.</p><p>Started describing what I wanted.</p><p>Component tree.</p><p>Interactive nodes.</p><p>Component metadata.</p><p>State visualization.</p><p>Selection.</p><p>Communication with the extension.</p><p>Instead of writing implementation after implementation, I spent my time reviewing, refining, testing, and asking for improvements.</p><p>Around <strong>three hours later</strong>, I had something that actually worked.</p><p>Not a mockup.</p><p>Not static screens.</p><p>A real Chrome extension.</p><p>A real MVP.</p><p>And, most importantly…</p><p>I finally had an answer to the question I had postponed for years.</p><p><strong>Yes. This idea has value.</strong></p><h3>The Surprising Part</h3><p>What surprised me wasn’t how quickly the MVP was built.</p><p>It was how easy it became to continue improving it.</p><p>Normally, after an MVP comes the tedious part:</p><ul><li>fixing bugs</li><li>adjusting layouts</li><li>polishing interactions</li><li>refactoring</li><li>adding small features</li></ul><p>With AI, each improvement became a conversation instead of a development session.</p><p>I wasn’t fighting boilerplate.</p><p>I wasn’t context-switching constantly.</p><p>I wasn’t spending hours searching Stack Overflow for small implementation details.</p><p>I was simply evolving the product.</p><p>In fact, almost every improvement so far has happened <strong>without me writing code directly</strong>.</p><p>I describe the behavior.</p><p>Review the result.</p><p>Adjust what I want.</p><p>Repeat.</p><h3>The Result</h3><p>Today the Inspector allows developers to visualize their application’s component hierarchy as an interactive graph.</p><p>The selected component immediately exposes useful information like:</p><ul><li>component hierarchy</li><li>parent/child relationships</li><li>component data</li><li>applied CSS classes</li><li>internal state</li></ul><p>It turns something that previously required mental mapping into something you can simply look at.</p><p>The screenshot below is still an early version, but even this MVP has already changed how I debug <a href="https://jails-js.org/">Jails</a> applications.</p><h3>AI Didn’t Replace the Idea</h3><p>This is the part I find most interesting.</p><p>The idea wasn’t generated by AI.</p><p>The architecture wasn’t discovered by AI.</p><p>The product vision wasn’t invented by AI.</p><p>The problem had been sitting in my notebook for nearly eight years.</p><p>What AI removed was the enormous execution barrier between:</p><blockquote><em>“I think this would be useful.”</em></blockquote><p>and</p><blockquote><em>“Now I know it is.”</em></blockquote><p>That’s a profound difference.</p><h3>How Many Ideas Are Waiting?</h3><p>I suspect many developers have their own version of this story.</p><p>An extension.</p><p>A library.</p><p>A debugging tool.</p><p>A side project.</p><p>Something they’ve wanted to build for years but couldn’t justify the investment before validating it.</p><p>AI changes that calculation.</p><p>Not because every generated line of code is perfect.</p><p>But because it dramatically reduces the cost of answering one simple question:</p><blockquote><strong><em>“Is this worth building?”</em></strong></blockquote><p>Sometimes, that’s all an idea needs to finally come to life.</p><p>If there’s one thing this project taught me, it’s that AI isn’t just accelerating software development.</p><p>It’s allowing ideas that would have remained forever in the “maybe someday” folder to finally become real.</p><h3>A Sneak Peek of What’s Coming</h3><p>Although the Inspector is already proving useful, it’s still in <strong>alpha</strong>.</p><p>I’m using it daily while developing <a href="https://jails-js.org/">Jails</a> itself, and every debugging session ends up revealing another feature I wish I had years ago.</p><p>My goal is to make it publicly available over the next few weeks.</p><p>The current component tree visualization is only the beginning. Some of the features I’m actively working on include:</p><ul><li><strong>State update tracking</strong> — making it easy to see exactly which components were affected by a state change.</li><li><strong>State mutation tracing</strong> — showing where state updates originated, making it much easier to understand the flow of data through an application.</li><li><strong>Frame rate monitoring</strong> — helping identify rendering slowdowns and performance bottlenecks while interacting with the application.</li></ul><p>None of these ideas came from trying to compete with existing DevTools.</p><p>They came from years of building applications and repeatedly asking myself the same questions during debugging:</p><ul><li><em>Why did this component update?</em></li><li><em>What triggered this state change?</em></li><li><em>Which components were actually affected?</em></li><li><em>Is this interaction causing rendering performance issues?</em></li></ul><p>These are the kinds of answers I’ve always wanted while developing with <a href="https://jails-js.org/">Jails</a>, but never had available.</p><p>Now, for the first time, they’re becoming real.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTQn9SNz-I4w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTQn9SNz-I4w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTQn9SNz-I4w%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d9c6319930edf9a2482fce3c651fae3/href">https://medium.com/media/5d9c6319930edf9a2482fce3c651fae3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0209a6aaa733" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/jails-inspector-an-idea-i-postponed-for-8-years-until-ai-made-it-possible-0209a6aaa733">Jails Inspector: An Idea I Postponed for 8 Years — Until AI Made It Possible</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Island Architecture — Astro + Jails]]></title>
            <link>https://medium.com/jails-org/island-architecture-astro-jails-8e1a2405249d?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/8e1a2405249d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[jails-js]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[astrojs]]></category>
            <category><![CDATA[islands-architecture]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sun, 31 Aug 2025 05:37:44 GMT</pubDate>
            <atom:updated>2025-12-07T18:19:47.790Z</atom:updated>
            <content:encoded><![CDATA[<h3>Island Architecture — Astro + Jails</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4F-6A9hLVcZkzsTkfnAHgA.png" /><figcaption>from: <a href="https://www.patterns.dev/vanilla/islands-architecture/">https://www.patterns.dev/vanilla/islands-architecture/</a></figcaption></figure><p>Just like the world, technology also moves in cycles. Fifteen years ago, I was working on front-end projects where applications and pages were rendered entirely on the server using template systems tailored to each platform: ERB in Ruby, PHP with its built-in templating, Razor in .NET, JSP in Java, and so on.</p><p>Over time, this approach was largely “replaced” by the rise of Single Page Applications (SPAs). But today, driven by the need for better SEO, performance, and user experience, we’re witnessing yet another shift in how we render web applications. And interestingly enough, this shift reintroduces concepts that feel both familiar and new — such as <strong>Island Architecture</strong>.</p><h3>About Island Architecture</h3><blockquote><em>tl;dr: The islands architecture encourages small, focused chunks of interactivity within server-rendered web pages. The output of islands is progressively enhanced HTML, with more specificity around how the enhancement occurs. Rather than a single application being in control of full-page rendering, there are multiple entry points. The script for these “islands” of interactivity can be delivered and hydrated independently, allowing the rest of the page to be just static HTML. </em><a href="https://www.patterns.dev/vanilla/islands-architecture/">https://www.patterns.dev/vanilla/islands-architecture/</a></blockquote><p>Whenever I had the chance, whether in the companies I worked for or in my own side projects, I tried to adopt this strategy. I knew it brought powerful principles of <strong>separation of concerns, performance, and simplicity</strong>.</p><p>The challenge, however, was always the same: in order to make it work, I had to build and maintain a sort of “project within the project.” It was a custom boilerplate that glued together multiple tools to generate static pages. And while some solutions existed for content-focused sites, there was nothing truly programmatic and flexible enough to also support building full applications — not just static content pages.</p><p>Fast forward to today, and that gap has been filled. We now have a <strong>robust, well-designed, and thoroughly documented solution</strong>. We have the underestimated, yet powerful, <a href="https://astro.build/"><strong>Astro</strong></a>.</p><h3>Astro — The web framework for content-driven websites</h3><p>Astro is a solution designed for building <strong>server-side web applications</strong>, particularly for <strong>statically generated sites (SSGs)</strong>. It’s built to deliver <strong>minimal or zero JavaScript to the client</strong> while still providing seamless integration with other client-side tools and libraries. Astro offers directives that allow you to initialize these libraries <strong>on load or only when the user interacts</strong> with them.</p><p>For example, you can integrate Astro with <strong>React</strong> and use React exclusively on the client-side, freeing yourself from the headaches that come with frameworks like Next.js and the complexities of isomorphic rendering.</p><h3>The Trade-offs of React</h3><p>For me, React as a library comes with a series of challenges — not just structural, but also in terms of <strong>design choices</strong> that often make it more difficult than helpful.</p><p>One key design decision in React is the <strong>tight coupling between logic and view</strong>. While this approach is convenient in many situations, it introduces a number of trade-offs. One significant trade-off is <strong>bundle size</strong>.</p><p>When your HTML is embedded directly within your JavaScript, the more structurally complex your component becomes, the larger your JavaScript bundle grows as well. This can quickly impact performance and loading times, especially on large-scale applications.</p><pre>export default function Bio() {<br>  return (<br>    &lt;div class=&quot;intro&quot;&gt;<br>      &lt;h1&gt;Welcome to my website!&lt;/h1&gt;<br>    &lt;/div&gt;<br>    &lt;p class=&quot;summary&quot;&gt;<br>      You can find my thoughts here.<br>      &lt;br&gt;&lt;br&gt;<br>      &lt;b&gt;And &lt;i&gt;pictures&lt;/b&gt;&lt;/i&gt; of scientists!<br>    &lt;/p&gt;<br>  );<br>}</pre><p>The idea behind Astro is to <strong>maximize performance</strong> by delivering as little JavaScript as possible. When you integrate Astro with React, you can serve a <strong>statically generated application</strong>, but some loading is still unavoidable depending on your component’s weight and the requests it makes. This loading is necessary because React requires <strong>full initialization and hydration</strong> before it can render the component on the screen.</p><p>Add to that the weight of the React library itself — <strong>at least ~45 KB</strong> in your final bundle. Don’t forget that the ecosystem around it is also heavy, since you rarely build a component entirely from scratch. Leveraging community-built solutions can save time and bring valuable functionality to your UI.</p><p>Not only that, you might fall into several questions like: Should I use react-hook-forms? Tanstack Query? Should I use useMemo? useCallback? and so on…</p><p>These considerations highlight the trade-offs of using React in scenarios where performance and minimal client-side JavaScript are critical.</p><h3>Astro + Jails — The Perfect Integration</h3><p>If Astro is designed to deliver <strong>pure HTML with minimal or zero JavaScript</strong>, then <strong>Jails</strong> is a library built to work <strong>directly with that already-rendered HTML</strong>, adding interactivity through directives that the browser <strong>ignores during the initial page load</strong>.</p><p>This combination allows developers to take full advantage of Astro’s performance-oriented architecture while still bringing <strong>dynamic behavior</strong> to the UI when needed — without the overhead of a full client-side framework.</p><p><strong>component-a/index.astro</strong></p><pre>--- <br>---<br><br>&lt;script&gt;<br>  import { register, start } from &#39;jails-js&#39;<br>  import * as componentA from &#39;./index&#39;<br>  register(&#39;component-a&#39;, componentA)<br>  start()<br>&lt;/script&gt;<br><br>&lt;component-a&gt;<br>  &lt;form class=&quot;card text-white bg-primary mb-3&quot;&gt;<br>    &lt;div class=&quot;card-header&quot;&gt;Component A - Counter (&lt;span html-inner=&quot;counter&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;<br>    &lt;div class=&quot;card-body&quot; html-static&gt;<br>      &lt;label for=&quot;status&quot; class=&quot;form-label&quot;&gt;Type your text:&lt;/label&gt;<br>      &lt;input type=&quot;text&quot; class=&quot;form-control&quot; placeholder=&quot;Enter your text here&quot; /&gt;<br>    &lt;/div&gt;<br>  &lt;/form&gt;<br>&lt;/component-a&gt;</pre><p>The code above will be fully rendered <strong>server-side</strong> in your application, which means a large portion of your content is already available to the user while your JavaScript is still loading.</p><p>This approach ensures faster initial rendering and better perceived performance compared to client-only rendering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*hSuVNVn3fPZ5f1xGwhhFDQ.png" /></figure><p><strong>component-a/index.ts</strong></p><pre>import { type Component } from &#39;jails-js&#39;<br><br>export default function componentA({ main, on, publish }: Component) {<br> <br> main(() =&gt; {<br>  on(&#39;input&#39;, &#39;input[type=&quot;text&quot;]&#39;, onkeypress)<br> })<br><br> const onkeypress = (e) =&gt; {<br>  publish(&#39;status:add&#39;, e.target.value)<br> }<br>}</pre><p>This is the code for your <strong>Jails component</strong>, which adds behavior directly to your HTML elements. In this example, I’m using two helpers to boost productivity while building application components:</p><ol><li><strong>Event delegation helper</strong> — so I only need to specify which event to listen for and the CSS selector of the element I want to target.</li><li><strong>Publish/Subscribe helper</strong> — triggers a global event that any part of the application can listen to, passing along the current value of the input.</li></ol><p>Because there are no references or HTML trees to manage, the final bundle only contains your <strong>logic code plus 6.29 KB</strong> for the gzipped Jails library.</p><p>Moreover, you can be <strong>100% certain</strong> that this component code runs <strong>exclusively on the client-side</strong>, avoiding the overhead of isomorphic solutions.</p><h3>Final Thoughts</h3><p>With these two tools, you get an experience very similar to how we used to develop years ago — combining the <strong>best of simplicity and predictability</strong> with <strong>modern componentization techniques</strong> and the tooling Astro provides when packaging your build for production.</p><p>This integration is <strong>natural</strong> and doesn’t require any “magical” internal connections between Astro and other JavaScript frameworks or libraries. With Jails, you simply install the library via npm and import its component registration and initialization functions.</p><p>Astro takes care of <strong>avoiding multiple calls to the same JavaScript</strong>, even if the same component is rendered multiple times on a page, and handles <strong>compression, compilation, optimizations and all other build-time processes</strong>.</p><p>For example, my personal site, which integrates with Medium via RSS, was built using Astro + Jails: <a href="https://eduardoottaviani.com.br/?utm_source=chatgpt.com">https://eduardoottaviani.com.br/</a></p><p>If you’re curious and inspect the <strong>Network tab</strong> in your browser, you’ll notice that the heaviest JavaScript in the application is only <strong>~9.5 KB</strong>. The only heavier script is Google Tag Manager, with its whopping <strong>135 KB</strong>.</p><blockquote>Perhaps Google uses <strong>Angular</strong> in their GTM library, which might explain its unusually large size.</blockquote><h3>A More Complete Example: Astro + Jails</h3><p>Below is a more comprehensive example demonstrating <strong>Astro + Jails</strong> with multiple components interacting with each other.</p><ul><li>When you type in the text input, <strong>Component A</strong> triggers a <strong>publish event</strong>, which is listened to by <strong>Component B</strong>, receiving the entered text.</li><li>Additionally, <strong>Component C</strong> listens for button clicks, updates its <strong>local counter state</strong>, and also <strong>publishes this change globally</strong>.</li><li>The parent component, which wraps all child components, listens to this global event, updates its own <strong>counter state</strong>, and updates the HTML of its children that rely on this variable within their markup.</li></ul><p>This showcases how Jails enables <strong>lightweight, client-side interactivity</strong> while keeping components <strong>decoupled</strong> and fully leveraging Astro’s static rendering.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fisland-architecture%3Fembed%3D1%26file%3Dapp-main.ts&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fisland-architecture%3Fembed%3D1%26file%3Dapp-main.ts&amp;image=https%3A%2F%2Fsocial-img.staticblitz.com%2Fprojects%2Fisland-architecture%2F67a3608642a100f50ae492f1e44255e2&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc9a9a6928ed3d9dd0f27a902b7bfe98/href">https://medium.com/media/bc9a9a6928ed3d9dd0f27a902b7bfe98/href</a></iframe><p>Thank you for your attention!<br> See you next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e1a2405249d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/island-architecture-astro-jails-8e1a2405249d">Island Architecture — Astro + Jails</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NextJs and Server-Side Web Components — Using Jails]]></title>
            <link>https://medium.com/jails-org/nextjs-and-server-side-web-components-using-jails-5a95fb09a87f?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/5a95fb09a87f</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[jails-js]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 22:50:45 GMT</pubDate>
            <atom:updated>2025-08-23T23:06:25.332Z</atom:updated>
            <content:encoded><![CDATA[<h3>NextJs and Server-Side Web Components — Using Jails</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BwKk4AQ2MbcEv0UmN_lVkw.jpeg" /></figure><p><strong>How to Share Functionality Across Different Projects Using Various Frameworks?</strong></p><p>The classic and obvious answer: <strong>Web Components 🎉</strong></p><p>But here’s the catch — this solution, though appealing,<strong> is incomplete</strong>. The big question that’s often overlooked is: <strong>how do you render Web Components on the server</strong>?</p><h3><strong>Why on the server?</strong></h3><p>Because there’s been a recent shift in how we think about rendering web applications. The goal now is to deliver as little JavaScript as possible to the user — shifting more processing to the server — to boost performance and user experience.</p><p>This creates a dilemma when trying to reuse features with Web Components across projects that use different tech stacks. After all, Web Components are built from a mix of APIs that run exclusively on the browser.</p><p>But here’s the thing — <a href="https://eduardo-ottaviani.medium.com/web-components-a-practical-perspective-using-custom-elements-7523a6462387"><strong>as I detailed in a previous post</strong></a>:</p><blockquote>Web Components are a set of APIs providing useful tools, especially for developers building solutions, frameworks, or libraries.</blockquote><p>Sharing features in a consistent, simple, and productive way isn’t really what <strong>Web Components</strong> are designed for. Instead, they’re a toolset — great for development but not the <strong>ultimate solution for shared functionality</strong>.</p><p>So, to handle server-side rendering (SSR) or static site generation (SSG) with frameworks like Next.js, we need a more robust approach. And in this post, I’ll introduce a solution using <strong>Jails</strong>.</p><h3>The Strategy</h3><p>Next.js is an isomorphic app — that means the same code can run on both the client and server.</p><p><strong>Jails</strong> is a library designed to run only in the browser. But thanks to separation of concerns and dependency injection, it can adapt well to our specific case of an isomorphic app.</p><p>A Jails component looks like this:</p><pre>export default function myComponent({ main }) {<br>  //All client functionalities  <br><br>  main(() =&gt; {<br>    // application entry point <br>  })<br>}<br><br>export const model = {<br>  initialState: {}<br>}</pre><p>It’s essentially a JavaScript module exporting functions like main (for client-side logic) and model (state). The library uses these exports to handle client interactions.</p><p>We can create a React wrapper component, let’s call it <strong>DS</strong>, to integrate Jails components. Here’s an example:</p><pre>&#39;use client&#39;<br>import { useEffect, forwardRef } from &#39;react&#39;<br>import { register, start } from &#39;jails-js&#39;<br><br>type DSProps = {<br> use: any<br> tag?: string<br> children?: React.ReactNode<br> dependencies?: Record&lt;string, any&gt;<br>}<br><br>export const DS = forwardRef((<br>  {<br>   use: module,<br>   tag = &#39;&#39;,<br>   children = null,<br>   dependencies = {},<br>   ...props<br>  }: DSProps,<br>  ref<br> ) =&gt; {<br><br>  const Tag = module.tag || tag<br><br>  const html = module.markup<br>   ? module.markup({ children, ...props })<br>   : null<br><br>  useEffect(() =&gt; {<br>   if (!customElements.get(Tag)) {<br>    register(Tag, module, dependencies)<br>    start(document.querySelector(Tag))<br>   }<br>  }, [Tag, module, dependencies])<br><br>  if (html) {<br>   return &lt;Tag ref={ref} dangerouslySetInnerHTML={{ __html: html }} /&gt;<br>  }<br><br>  return &lt;Tag ref={ref}&gt;{children}&lt;/Tag&gt;<br> }<br>)<br><br></pre><p>This wrapper expects a Jails module, which is a JS component, and a tag name (like ds-input).</p><p>It also accepts children, but note they’re only compatible with plain text—not React elements.</p><p>The <strong>forwardRef</strong> is key—it allows attaching methods or retrieving info directly from the HTML element, listening to events, or modifying attributes, making integration smoother.</p><p>You’d use this component like:</p><pre>import * as dsInput from &#39;@ds/components/input&#39;<br>// ...<br>export default function HelloWorld() {<br>  return (<br>    &lt;DS use={dsInput} ... /&gt;<br>  )<br>}</pre><p><strong>And here’s the kicker:</strong> this component renders on the server.</p><p>How?<br>Because if the JS module exports a markup function, the wrapper executes it to get an HTML string, which is injected into the DOM using dangerouslySetInnerHTML.</p><p>Next.js’s server component renders this HTML, and Jails handles the logic separately, updating only specific parts through directives, separating HTML generation from behavior. The useEffect on the client hydrates the custom elements after the server renders.</p><h3>A Real-World Example — Custom Input</h3><p>Here’s an example of a Jails component for a &lt;ds-input /&gt; element:</p><pre>import { type Component } from &#39;jails-js&#39;<br>import { html, attributes } from &#39;jails-js/html&#39;<br><br>export const tag = &#39;ds-input&#39;<br><br>export default function input({ main, on }: Component) {<br><br> main(() =&gt; {<br><br>  on(&#39;focus&#39;, &#39;input&#39;, toggleClass(true))<br>  on(&#39;blur&#39;, &#39;input&#39;, toggleClass(false))<br> })<br><br> const toggleClass = (toggle: Boolean ) =&gt; (event: Event) =&gt; {<br>  state.set({ focus: toggle })<br> }<br>}<br><br>export const model = {<br> focus: false,<br>}<br><br>export const markup = ({<br> label = &#39;&#39;,<br> name = &#39;&#39;,<br> ...props<br>}) =&gt; {<br> return html`<br>  &lt;div class=&quot;form-group&quot; html-class=&quot;focus? &#39;input-focus&#39;: &#39;&#39;&quot;&gt;<br>   &lt;label&gt;${label}&lt;/label&gt;<br>   &lt;input class=&quot;input-control&quot; name=&quot;${name}&quot; ${attributes(props)}&gt;<br>  &lt;/div&gt;<br> `<br>}</pre><p>Breaking down each part, we first introduce two new capabilities that make sense specifically for our project — they’re not part of the core Jails API. These are markup and tag, and they’re used by our custom <strong>DS</strong> integration component.</p><p><strong>markup</strong> is an agnostic function that takes a properties object and returns an HTML string using those properties.</p><p>As an interesting aside, Jails imports helpers like html and attributes—which are also agnostic and can be used in any Node.js application. The attributes helper converts an object into a string in the format key=&quot;value&quot;, which is super handy for passing attributes just like in React, for example: {...props}.</p><p>To use this component, you’d do something like:</p><pre>import * as dsInput from &#39;@ds/components/input&#39;<br>// ...<br>export default function HelloWorld() {<br>  return (<br>    &lt;DS use={dsInput} name=&quot;username&quot; id=&quot;username&quot; ... /&gt;<br>  )<br>}</pre><p>This component isn’t restricted to React — it works in any framework, static site generator, or even server-side rendering backends like PHP, Java, or Go.</p><h3>Going Beyond the Basics</h3><p>I was pretty surprised when I tested this idea — everything worked smoothly. So I decided to go further, thinking about common cross-framework reuse cases like form components, validation, and side panels.</p><p>These scenarios tend to be tricky because frameworks like Next.js and React use a virtual DOM. External validation or updates outside the framework can cause markup mismatches between external libraries and the current DOM version, leading to potential issues.</p><p>Even so, I managed to build a pretty interesting example: delegating field validation and side-panel management to Web Components (Jails). I even integrated both Jails and React renderings on the same screen, blending the two seamlessly.</p><p>A key feature of this integration is Jails’ ability to create “holes” in the HTML using the html-static directive. These holes prevent Jails from updating those parts of the DOM when the component’s local state changes. This allows React and Jails to coexist without their virtual DOMs interfering, which is pretty cool.</p><h3>The Application</h3><p>The app I’m sharing is on StackBlitz so you can see it in full. It’s a server-generated form with validation behaviors handled entirely by Jails Web Components and side panels.</p><p>The React component requests a list from an API on the client side and renders it within Jails Web Components. It then passes this list to a Jails ds-select component, which renders the items on the client.</p><p>Once all data is filled out and validated, the form can be submitted. The React page component listens for a custom event from the Jails Web Component and communicates with side panels to display the data.</p><p>One side panel shows the form’s filled data as rendered by Jails Web Components, while the other displays it via React rendering — pretty neat, right?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fnextjs-jails-integration%3Fembed%3D1%26file%3Dcomponents%252Fform%252Findex.tsx&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fnextjs-jails-integration%3Fembed%3D1%26file%3Dcomponents%252Fform%252Findex.tsx&amp;image=https%3A%2F%2Fsocial-img.staticblitz.com%2Fprojects%2Fnextjs-jails-integration%2Fe0338644b3afa016d14e13d03edef3c0&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/55fadf67d21a2807bc9b61502a59f4ff/href">https://medium.com/media/55fadf67d21a2807bc9b61502a59f4ff/href</a></iframe><h3>Final Thoughts</h3><p>I chose a common yet challenging use case — form validation — to test my hypothesis that Jails components can be server-rendered. Handling validation in forms is notoriously complex due to the mixture of components from different frameworks.</p><p>I still need to explore more use cases to fully validate this combined React and Jails rendering — since, in some scenarios, the behavior could get unpredictable.</p><p>However, in scenarios where it’s unnecessary to embed dynamic data via React inside Web Components, I’m quite confident it works really well.</p><p>That’s it for now! I’m genuinely excited about how this project is progressing — without significantly increasing code complexity. Often, you can use it as-is across various setups, thanks to its flexible and decoupled architecture.</p><p>Until next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a95fb09a87f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/nextjs-and-server-side-web-components-using-jails-5a95fb09a87f">NextJs and Server-Side Web Components — Using Jails</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neither Web Components Nor Frameworks: Introducing Jails]]></title>
            <link>https://medium.com/jails-org/neither-web-components-nor-frameworks-introducing-jails-2c7ffcdd60f6?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/2c7ffcdd60f6</guid>
            <category><![CDATA[front-end-frameworks]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[web-components]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sat, 26 Jul 2025 13:53:29 GMT</pubDate>
            <atom:updated>2025-08-12T00:12:40.484Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most frustrating things in today’s tech landscape is how often we find ourselves forced to choose between extremes when trying to do things differently.</p><p>We’re always living on the edge…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VduWuH91bSynPBNbcoAMQg.png" /><figcaption>Handmade x Bloated Features</figcaption></figure><h3>Frontend Complexity Fatigue</h3><p>No matter how much you enjoy a specific framework, it’s becoming painfully clear that building something simple on the web is increasingly difficult. Across blogs and dev articles, one theme keeps coming up: modern frontend development feels unnecessarily complex. Worse still, many apps are aging poorly and becoming harder to maintain.</p><h3>What’s Wrong With Today’s Frameworks?</h3><p>First off, only about three frameworks dominate the ecosystem. And all of them have grown more and more complex over time — trying to cover every edge case of web development. Ironically, they often end up solving the very problems they created in the first place.</p><p>They were built on the premise that <em>more JavaScript in the client is better</em>. They gradually stopped focusing on solving specific problems and instead tried to solve <strong>every</strong> problem, sometimes across <strong>multiple platforms</strong>. Not just the browser anymore — now they want to own your server too. You’re no longer just adopting a framework. You’re buying into an entire ecosystem, top to bottom.</p><p>The frontend community isn’t always helpful either. To justify the complexity, framework enthusiasts often attack other tools or languages — sometimes unfairly — in a kind of survival-of-the-fittest mentality.<br>Have you ever heard someone bash PHP or Ruby without really understanding them?</p><h3>Web Components — The Answer?</h3><p>For those who developed web applications before the age of frameworks, <strong>Web Components</strong> feel like an obvious solution. They bring a strong dose of nostalgia — back when the web felt simpler, lighter, and more maintainable. The idea of returning to simplicity is extremely tempting.</p><p>But here’s the catch: Web Components represent <strong>the opposite extreme</strong> in the frontend spectrum.</p><p>In my view, Web Components are a <strong>set of low-level APIs</strong> designed to <strong>enable</strong> encapsulation, distribution, and integration of behavior — not to replace application-level architecture. They’re tools provided by the browser to help <strong>build</strong> frameworks and libraries — not to <strong>become</strong> one.</p><p>Equating Web Components with frameworks just doesn’t make sense to me. The capabilities they provide don’t even scratch the surface of the real-world challenges developers face when building even moderately complex applications in vanilla JavaScript.</p><p>And I say this with confidence — because I’ve spent most of my life building applications without frameworks.</p><h3>The Real Challenges of Vanilla Development</h3><p>No matter how creative your product designer is, the reality of frontend development remains the same across most applications — <strong>predictable and repetitive</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*QR44_yrM87THlFE_yo8V-w.png" /><figcaption>From Senses/actuators — <a href="https://cycle.js.org/dialogue.html">https://cycle.js.org/dialogue.html</a></figcaption></figure><ol><li>The app reacts to user input (clicks, typing, gestures).</li><li>It reads data from the UI, processes it, and triggers external actions (API calls).</li><li>It receives responses, stores data locally or globally, and notifies parts of the system that the data is ready.</li><li>It updates the UI with the new state.</li></ol><p>Everything else?<br>Toggles, animations, slides, loaders — <strong>just UI fluff</strong>.</p><h3>So What Makes Vanilla So Challenging?</h3><p>If you decide to build something in plain JavaScript — or even with Web Components — you’ll quickly run into a familiar set of problems:</p><h4>Smart Event Handling</h4><p>You need an intelligent system to handle user events. Once the DOM changes, new elements might appear — and those new elements also need event listeners. Suddenly, you’re managing event lifecycles manually. This leads you to <strong>reinvent event delegation</strong>. You’ll build your own version of a pattern you thought you wouldn’t need.</p><h4>Functional Grouping &amp; Reusability</h4><p>You’ll want to group related behavior and UI together in a way that’s <strong>reusable</strong>, consistent, and easy to reason about. That’s when you’ll start thinking in <strong>components</strong> — and begin designing your own abstraction layer to handle state, behavior, and DOM access together.</p><h4>State Change Propagation</h4><p>When your app receives data from an external source, that change might need to be reflected in multiple places. That means you’ll need some way to <strong>broadcast changes</strong> across components. You’ll probably build your own version of an <strong>Observer pattern</strong> or a <strong>Pub/Sub system</strong> — along with some naming conventions to manage your growing list of events.</p><h4>View Updating &amp; DOM Syncing</h4><p>Simply using innerHTML to update the view won’t cut it. Even with the help of template literals to avoid manually updating each DOM node, you’ll soon notice your app becomes <strong>sluggish</strong>. You lose focus on input fields. Internal state gets wiped. Links behave inconsistently. Your UI starts to feel broken and fragile.</p><h3>Déjà Vu All Over Again</h3><p>You’ll notice that these same problems show up across projects. So naturally, you start reusing the solutions you built — abstracting them, refining them, organizing them.</p><p>Before you know it…</p><blockquote><strong><em>Congratulations, you’ve built your own JavaScript framework.</em></strong></blockquote><p>And none of those essential solutions came from <strong>Web Components</strong>. They came from <em>you</em> — your effort, your creativity, and your technical intuition.</p><h3>Keep Evolving, But Stay Sane</h3><p>You keep improving. You keep updating.<br>You add the features that actually make sense.<br>You drop the ones that only add noise.</p><p>You’re guided by your own vision — by what <em>feels right</em>. You borrow the good ideas from existing frameworks — the ones that stood the test of time. At the same time, you invent your own patterns — leaner, simpler ways to solve real-world problems without the usual bloat.</p><p>You’re not chasing hype.<br>You’re just building — honestly, intentionally, sustainably.</p><p>And then…</p><p>You do this for <strong>about 10 years</strong>.<br>Iterating. Refactoring. Rethinking everything.<br>Not because you wanted to build a library… but because you needed one that didn’t exist yet.</p><p>And suddenly —</p><blockquote><strong><em>You realize you’ve built something different. Something that might be worth sharing.</em></strong></blockquote><p>Not a bloated framework.<br>Not a reinvention of the web.<br>Just a lightweight, modern, and deeply practical tool — born from actual experience.</p><h3>Enter Jails</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20HvEccWkU7B-DiCDoYmnA.png" /></figure><p><a href="https://jails-js.org/">Jails</a> is my answer to the false choice we’ve been forced to make for years in frontend development:</p><ul><li>Either you build everything manually — and risk not only solving your app’s problems but also fighting the ones you created with your own DIY architecture.</li><li>Or you choose a full-blown framework — and get buried in layers of abstractions, indirections, and conventions just to solve something that should’ve been simple.</li></ul><p><strong>Why does it have to be one or the other?</strong></p><p>Why can’t we have a tool that’s powerful enough to help — but lightweight enough to stay out of the way?</p><p>That’s exactly what Jails aims to be:<br>A pragmatic middle ground.<br>A minimal layer that helps you organize, scale, and reuse code — without hijacking your project or dictating how you should think.</p><h3>How Jails Stands Apart From Traditional Frameworks</h3><p><a href="https://jails-js.org/">Jails</a> is designed specifically to solve the challenges of <strong>client-side web development</strong> — without imposing unnecessary complexity or locking you into a full-stack ecosystem.</p><h4>Backend Agnostic by Design</h4><p><a href="https://jails-js.org/">Jails</a> works seamlessly with any backend — not just Node.js. Whether your server is powered by <strong>Ruby, PHP, Go, Java, Python, .NET</strong>, or anything else, Jails plays well with it.</p><p>It avoids the pitfalls of isomorphic (or “universal”) JavaScript — no guessing games about whether a line of code runs on the server or in the browser.<br><strong>No hydration mismatches. No SSR headaches. Just clean separation of concerns.</strong></p><h4>Built for Progressive Enhancement</h4><p><a href="https://jails-js.org/">Jails</a> adapts to your rendering strategy:</p><ul><li>It works great with <strong>static HTML</strong> or <strong>server-side rendered content</strong>, enhancing it dynamically on the client.</li><li>Or, it can be used to build fully <strong>dynamic client-side interfaces</strong> — it’s your choice.</li></ul><p>Whether you’re rendering HTML on the server or creating it on the fly, Jails integrates naturally and keeps things fast and accessible.</p><h4>Minimal by Nature, Vanilla at Heart</h4><p>Jails stays close to the <strong>vanilla development model</strong>, adding just a small layer of features that help:</p><ul><li><strong>Lower the learning curve</strong></li><li><strong>Reduce boilerplate</strong></li><li><strong>Solve common problems directly and clearly</strong></li></ul><p>It’s not about reinventing the web — it’s about making the <strong>real</strong> web easier to use.</p><h4>Embraces the JavaScript Ecosystem — Doesn’t Replace It</h4><p><a href="https://jails-js.org/">Jails</a> doesn’t create its own ecosystem.<br>No custom router. No proprietary state system. No framework lock-in.</p><p>Instead, it lets you <strong>integrate with any JavaScript library</strong> you already use and love. Whether it’s for routing, state management, or UI components — Jails fits in without taking over.</p><h3>How Jails Solves the Pain of Vanilla Development</h3><h4>Functional Grouping &amp; True Reusability</h4><p>Jails brings structure to your code — without imposing a rigid architecture.</p><p>It offers a clean, organized way to <strong>group logic and behavior</strong> around HTML elements, making your components <strong>self-contained and reusable</strong>.</p><p>It’s like having a tiny toolkit built specifically to make vanilla development actually enjoyable — and scalable.</p><pre>&lt;app-example&gt;&lt;/app-example&gt;</pre><pre><br>import { type Component } from &#39;jails-js&#39;<br><br>export default function appExample ({ main, elm } : Component) {<br><br>  //Variables on top<br>  const somevariable = 42<br>  <br>  // Constructor phase in the middle<br>  main(() =&gt; {<br>    log(&#39;Hello World, this is me!&#39;)<br>  })<br>  <br>  // Functionalities and details on bottom<br>  const log = (message: string) =&gt; {<br>    console.log(message, elm)<br>    console.log(&#39;My lucky number is&#39;, somevariable)<br>  }<br>}</pre><pre>import { register, start } from &#39;jails-js&#39;<br>import * as appExample from &#39;./components/app-example&#39;<br>register(&#39;app-example&#39;, appExample)</pre><h4>Smart Event Handling / View Updating &amp; DOM Syncing</h4><p><a href="https://jails-js.org/">Jails</a> provides built-in helpers that handle two of the hardest problems in vanilla JavaScript development — <strong>event delegation</strong> and <strong>DOM syncing</strong> — in a way that’s both powerful and intuitive.</p><pre><br>&lt;app-text-typing class=&quot;text-center&quot;&gt;<br>  &lt;h1&gt;Text Typing&lt;/h1&gt;<br>  &lt;input type=&quot;text&quot; class=&quot;form-control&quot; html-static /&gt;<br>  &lt;div html-for=&quot;field in list&quot;&gt;<br>    &lt;input type=&quot;text&quot; html-name=&quot;field.name&quot; class=&quot;form-control&quot; html-static /&gt;<br>  &lt;/div&gt;<br>  &lt;p&gt;<br>   Hello this is what I&#39;m typing: &lt;span html-inner=&quot;myTextVar&quot;&gt;Nothing yet...&lt;/span&gt;<br>  &lt;/p&gt;<br>  &lt;button&gt;Add Another Input Field&lt;/button&gt;<br>&lt;/app-text-typing&gt;<br></pre><pre>import { type Component } from &#39;jails-js&#39;<br><br>export default function appTextTyping({ main, on, state }: Component) {<br><br> main((_) =&gt; {<br>  on(&#39;input&#39;, &#39;input[type=&quot;text&quot;]&#39;, onInput)<br>  on(&#39;click&#39;, &#39;button&#39;, addAnotherField)<br> })<br><br> const onInput = (e) =&gt; {<br>  state.set({ myTextVar: e.target.value })<br> }<br><br> const addAnotherField = (e) =&gt; {<br>  state.set((s) =&gt; s.list.push({ name: &#39;field-&#39; + Math.random() }))<br> }<br>}<br><br>export const model = {<br> myTextVar: &#39;&#39;,<br> list: [],<br>}</pre><pre>import { register, start } from &#39;jails-js&#39;<br>import * as appTextTyping   from &#39;./components/app-text-typing&#39;<br>register(&#39;app-text-typing&#39;, appTextTyping)</pre><h4>State Change Propagation</h4><p>One way to communicate between descendant components is through custom DOM events using the emit helper — or by broadcasting messages to all components in the system that are listening for a specific event.</p><p><strong>Component A:</strong></p><pre>import { type Component } from &#39;jails-js&#39;<br><br>export default function ComponentA ({ main, publish } : Component) {<br><br>  main(async () =&gt; {<br>     const users = await fetchUsers()<br>     publish(&#39;users:ready&#39;, users) // Broadcast that users are ready!<br>  })<br><br>  const fetchUsers = () =&gt; {<br>    return fetch(&#39;https://jsonplaceholder.typicode.com/users&#39;)<br>      .then(response =&gt; response.json())<br>  }<br>}</pre><p><strong>Component B:</strong></p><pre>import { type Component } from &#39;jails-js&#39;<br><br>export default function ComponentB ({ main, state, subscribe } : Component) {<br><br>  main(() =&gt; {<br>    subscribe(&#39;users:ready&#39;, listUsers)<br>  })<br><br>  const listUsers = (users) =&gt; {<br>    state.set({ users })<br>  }<br>}<br><br>export const model = {<br>  users: []<br>}</pre><pre>&lt;component-b&gt;<br>  &lt;h2&gt;Users&lt;/h2&gt;<br>  &lt;ul html-for=&quot;user in users&quot;&gt;<br>    &lt;li&gt;<br>      &lt;p html-inner=&quot;user.name&quot;&gt;&lt;/p&gt;<br>    &lt;/li&gt;<br>  &lt;/ul&gt;<br>&lt;/component-b&gt;</pre><h3>Still Not Convinced?</h3><p>Alright then — try rebuilding the features mentioned above using only native Web Components.<br>How much extra code will you have to write?<br>How many low-level problems will you need to solve yourself?</p><p>Sure, you <em>can</em> ditch frameworks and use Web Components in production.<br>But the real question is:</p><blockquote><strong><em>Should you?</em></strong></blockquote><h3>Conclusion</h3><p>When it comes to Jails, I’ve only scratched the surface.<br>Not because it’s packed with a million features — but because it solves a wide range of real-world problems in <strong>surprisingly simple and elegant ways</strong>, making it hard to showcase everything in a single post.</p><p>Every library or framework exists to solve problems.<br>What sets them apart is <strong>their philosophy</strong> — how they approach those problems, which trade-offs they embrace, and what they consider worth solving in the first place.</p><p>My philosophy is different.<br>Jails stays <strong>very close to vanilla development</strong>, but adds just the right amount of power to solve everyday challenges in the <strong>smartest, most optimized, and most sophisticated</strong> way possible — without losing clarity or control.</p><p>If you’ve made it this far and something here resonated with you, I’d love to invite you to explore Jails a bit more. I think you’ll be pleasantly surprised.</p><p>🔍 Here’s a <strong>collection of examples</strong>:<br> <a href="https://stackblitz.com/@Javiani/collections/jails-organization">https://stackblitz.com/@Javiani/collections/jails-organization</a></p><p>And a <strong>demo of a classic — yet non-trivial — problem: a full Todo MVC app</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fjails-todomvc%3Fembed%3D1%26file%3Dtodo-app.ts&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fjails-todomvc%3Fembed%3D1%26file%3Dtodo-app.ts&amp;image=https%3A%2F%2Fsocial-img.staticblitz.com%2Fprojects%2Fjails-todomvc%2Fe079edcdc420f0b55c97fbaa8a14f9a9&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/117e2c6c8fc5aa068cb463ad4cc6a720/href">https://medium.com/media/117e2c6c8fc5aa068cb463ad4cc6a720/href</a></iframe><p><strong>See you next time — and until then, happy coding!</strong> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c7ffcdd60f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/neither-web-components-nor-frameworks-introducing-jails-2c7ffcdd60f6">Neither Web Components Nor Frameworks: Introducing Jails</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jails 6 — Codename: Poseidon]]></title>
            <link>https://medium.com/jails-org/jails-6-codename-poseidon-0c1036f88f17?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/0c1036f88f17</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[jails-js]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sun, 09 Feb 2025 15:48:12 GMT</pubDate>
            <atom:updated>2025-02-09T15:50:42.885Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jails 6 — Codename: Poseidon</h3><blockquote>Excited to announce the launch of the new Jails version! 🎉</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ibhVy45omZY4ij_WEDArA.jpeg" /><figcaption>Poseidon — God of the sea — A.I Generated</figcaption></figure><blockquote>I’ve always been fascinated by Greek mythology, so for each major version of Jails, I’ve used a Greek mythological figure as the codename. It helps me remember each version better than just using numbers.</blockquote><p>From the very beginning, <strong>Jails</strong> has been all about simplicity — that’s been my top priority since the earliest versions. The goal was to streamline everything I used to do in <em>Vanilla JavaScript</em> while embracing modern concepts, technologies, and best practices. But more than that, Jails is about building applications with less code, making development faster and more efficient.</p><h3>The Community’s Hard Choices</h3><p>Developers often face a common dilemma when choosing the best approach to start projects or build applications — they tend to live on the extremes.</p><p>On one side, we have bloated frameworks that introduce multiple layers of abstraction, tightly coupling the system to a specific solution. On the other hand, emerging libraries take a different approach by extending HTML rather than adding abstraction layers. While this is an interesting idea, it mixes a declarative markup language with logic, leading to tools like Alpine and htmx. These either make the code messy or shift UX complexity to the backend team — who may not be interested in dealing with UI concerns on the server side.</p><p>Then there’s the topic of Web Components, which emerges as a potential solution. However, developers must still choose between using vanilla Web Components or adopting a library — some of which are even more complex than traditional frameworks.</p><p>In the end, we remain stuck with hard choices, always at the extremes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*7i2nO2qD1qW0XSMqzh-Z3g.png" /></figure><h3>The Happy Medium library</h3><p>What about the middle ground? Why isn’t anyone looking for an alternative that empowers us to be productive without forcing us to commit to the complexity of a heavy framework?</p><p>This is the space Jails aims to fill. Jails is about empowering Vanilla JavaScript development, allowing you to focus on learning the platform itself rather than the framework. It’s all about simplicity and being straightforward.</p><p>Version 6 continues with the same motivation as its predecessors: to introduce minimal breaking changes, remove abstractions that haven’t proven their worth over time, and add features that enhance simplicity and productivity.</p><h3>The Version 6 Mentality</h3><p>Jails is more than just a project — it’s a product. This means I need to dedicate more energy not only to making the core ideas of Jails accessible to everyone, but also to ensuring its visibility. That’s a challenge, especially for developers, as we’re great at programming and building things but often struggle with marketing.</p><p>Marketing is about selling your product and convincing people that they should at least take a closer look at what you’re offering.</p><p>One effective way to do this is by capitalizing on a trend. It’s a great way to attract attention, and it’s highly effective. The trend I want to focus on is Web Components. But this isn’t just a marketing move — it’s also a natural progression for Jails. In the previous versions, Jails was already moving in that direction by leveraging the Custom Elements API lifecycle and experimenting with features that enabled fully featured, shareable components across projects.</p><p>While the earlier versions of Jails were focused on simplifying how we add behavior to web applications, Version 6 shifts its focus towards improving how we share behavior across different applications — drawing inspiration from the principles of distributed systems.</p><h3>Jails.std — The Jails Standard Library</h3><p>I draw inspiration from various fields of computer science to help improve the Jails Project. One of the key sources of inspiration has been the concept of the standard library in programming languages.</p><blockquote>The <strong>standard library</strong> of a programming language is a collection of built-in functions, modules, and tools that come with the language by default. It provides essential functionalities like file handling, data structures, math operations, and more, so programmers don’t have to reinvent the wheel.</blockquote><p>I know that almost every framework or library these days includes a standard set of features, but often it’s implicit, and it’s all tied to the framework itself. This can lock you into the ecosystem, which benefits the framework or library maintainers — but that’s not what I want for Jails.</p><p>So, with Version 6, I created the <strong>Jails.std</strong> npm package: <a href="https://github.com/jails-org/Std">https://github.com/jails-org/Std</a>.</p><p>This package isn’t about Jails — it’s focused on solving common frontend problems. Sometimes we need simple functionalities like:</p><ul><li>Triggering an event when an element becomes visible on the page</li><li>Debouncing and throttling function calls</li><li>Lazy-loading images</li><li>A router that syncs with the browser location (pushState or hash)</li><li>Retrieving query string parameters from the URL</li><li>Storing objects and complex structures in session or localStorage without having to manually use JSON.parse() and JSON.stringify()</li></ul><p>And more…</p><p>I realized these problems are often more important to solve than the specific issues within a library or framework. Even better, they don’t need to be tightly coupled with a particular framework. So, if you find the <strong>Jails.std</strong> package useful, feel free to use it — it’s mostly framework-agnostic.</p><p>If you think something is missing, let me know, and I’ll keep it updated, or feel free to open a PR yourself!</p><p>It’s in beta right now, but it’s official. My next steps are to write unit tests and make it easier for contributors to collaborate. I’ve designed it to be simple, so I hope it becomes a great project for beginners looking to get involved in open source.</p><h3>Finito</h3><p>I’m really proud of this version — it’s becoming more robust without being bloated. Each new release is lighter and simpler than the last.</p><p>I’ve also made time to improve the documentation. I admit I was a bit careless with that aspect, which is so crucial for newcomers, and I apologize for that.</p><p>Feel free to check it out: <a href="https://jails-js.org/">https://jails-js.org/</a></p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c1036f88f17" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/jails-6-codename-poseidon-0c1036f88f17">Jails 6 — Codename: Poseidon</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jails — Micro-Frontends Repository]]></title>
            <link>https://medium.com/jails-org/jails-micro-frontends-repository-8e79cfe4b058?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/8e79cfe4b058</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[micro-frontends]]></category>
            <category><![CDATA[jails-js]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sun, 14 Apr 2024 15:34:48 GMT</pubDate>
            <atom:updated>2024-04-14T15:36:44.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jails — Micro-Frontends Repository</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*n31GHi2D3kl1B5PK-kEJXg.png" /><figcaption><a href="https://stackblitz.com/edit/jails-mfe?file=index.ts">https://stackblitz.com/edit/jails-mfe?file=index.ts</a></figcaption></figure><p>Hi There! I want to share here a side project that I just created to make it as easy as possible to build and share Micro Frontends.</p><p>The topic of how to develop MFEs is a bit controversial; each project creates them in its own way. But I wanted to see how far <strong>Jails</strong> could go in this specific topic, in the simplest way I could think of.</p><h3>The Bundler 📦</h3><p>To help me out, I pulled out a project from the drawer that I hadn’t touched in a while, which is <a href="https://parceljs.org/">Parcel</a>. It’s definitely worth checking out if you haven’t already. Super useful and fast for creating web solutions with little or zero configuration, using the latest in terms of bundling and language features.</p><p>It integrates with a wide variety of template systems, etc. I used one of these template systems, which is <a href="https://pugjs.org/api/getting-started.html">Pug</a>, to make the HTML of my MFEs dynamic. It also helped me save some lines of HTML.</p><h3>The Design</h3><p>The idea was to create a simple “host” repository where I would host these static MFEs and make them available for any other application to consume.</p><p>The “Client” application would simply point to the CSS, HTML, and JS of the MFE to assemble it in the application wherever desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4kPEhs_MbdGSswz9Qn59rQ.png" /></figure><h3>The Application</h3><p>I chose to use <strong>Jails</strong> as the engine because it allows me to create complex components with very little JavaScript, and it’s compatible with any library, such as <a href="https://swiperjs.com/">Swiper</a> and <a href="https://help.rive.app/runtimes/overview/web-js">Rive</a>, which I used as an example in the <a href="https://stackblitz.com/edit/jails-mfe?file=index.ts"><strong>Hello World</strong>.</a></p><p>This way, any application that loads the main.js file (which is only ~5kb gzipped) could benefit from the <strong>Jails</strong> engine to make any MFE work. With the main.js loaded, you just need to specify which MFE from the repository you want to render and where.</p><pre>&lt;div id=&quot;hello-world&quot;&gt;&lt;/div&gt;<br><br>&lt;script src=&quot;https://mfe-jails.netlify.app/main.js&quot;&gt;&lt;/script&gt;<br><br>&lt;script&gt;<br>  window.MFE.add(&#39;mfe-hello-world&#39;, &#39;#hello-world&#39;).start()<br>&lt;/script&gt;</pre><h3>Finito</h3><p>That’s it, I just wanted to share this idea with you all. Maybe someone doesn’t know some of the tools I mentioned, all of them are very good, and I highly recommend taking a look.</p><p>It will be very useful for some projects where I have very similar functionalities that I need to reuse, perhaps it will be useful for someone else too.</p><p>I intend to upload some public MFEs to this repository as well, I’m not sure yet which ones. =)</p><p>The repository is public, feel free to clone it, upload it to your own infrastructure, and use it for your projects by writing your own components if it makes sense. There you will also find the source code of the example.</p><p><a href="https://github.com/jails-org/MFE">GitHub - jails-org/MFE: A repository for Micro Front-end Applications</a></p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e79cfe4b058" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/jails-micro-frontends-repository-8e79cfe4b058">Jails — Micro-Frontends Repository</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dependency Injection, Inversion of Control & Jails 5]]></title>
            <link>https://medium.com/jails-org/dependency-injection-inversion-of-control-jails-5-0c106dd8808c?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/0c106dd8808c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vanilla-javascript]]></category>
            <category><![CDATA[jails-js]]></category>
            <category><![CDATA[form-validation]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 21:20:05 GMT</pubDate>
            <atom:updated>2024-03-10T17:55:32.443Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*2V3AoapFn8Pj_g81eVUyig.png" /><figcaption>Image from <a href="https://www.linkedin.com/pulse/understanding-dependency-injection-alex-merced">https://www.linkedin.com/pulse/understanding-dependency-injection-alex-merced</a></figcaption></figure><blockquote>In <a href="https://en.wikipedia.org/wiki/Software_engineering">software engineering</a>, <strong>dependency injection</strong> is a programming technique in which an <a href="https://en.wikipedia.org/wiki/Object_(computer_science)">object</a> or <a href="https://en.wikipedia.org/wiki/Subroutine">function</a> receives other objects or functions that it requires, as opposed to creating them internally. ( Wikipedia )</blockquote><p>Alright, here’s the deal: Dependency Injection is like the secret sauce for untangling your system. It’s a straightforward method to loosen up the connections between components. With this approach, you’re basically flipping the switch on who’s calling the shots in a component or module. And trust me, it can totally revolutionize how you structure your code.</p><h3>Inversion of Control</h3><p>You know, Inversion of Control (IoC) is baked right into the core of JavaScript. It’s like second nature for us JavaScript devs, and honestly, it’s a breeze to pull off in this language, especially with callback functions.</p><p>IoC lets us split up generic behavior from the nitty-gritty specifics, which gives us some awesome reusability perks too.</p><h4>Example — Find a user by id and remove it from the list.</h4><p><strong>Without Dependency Injection and Inversion of Control</strong></p><pre>const findUserAndRemove = (id, list) =&gt; {<br>  let newlist = []<br>  list.forEach( user =&gt; {<br>    if( user.id !== id )<br>      newlist.push( user )<br>  })<br>  return newlist<br>}</pre><p>There&#39;s nothing completely wrong with the code above, it&#39;s easy to understand and it does its job. However, we might encounter scenarios where we want to locate a user based on another property, or where we desire to do more than simply remove the user from a list; we may wish to modify or enhance the user with additional properties, for instance. In such cases, not only will the name of our function lose its relevance, but it will also expand with increasingly complex behaviors, potentially rendering it difficult to manage.</p><p>There are two different behaviors on that code, the first is the iteration over a list, the second one is by identifying a case where we are looking for and do something with it. The findUserAndRemove function <strong>has 100% of control of what is going on on that task</strong>.</p><p><strong>So how can we decouple those two behaviors and make it more reusable?</strong></p><p>The solution is already inherent in the language. The filter array method is an implementation that achieves Inversion of Control by incorporating a callback function. Therefore, the filter function&#39;s purpose is to iterate over each element of the list and return a new list containing only elements that satisfy a given condition.</p><p>In the initial code snippet, the findUserAndRemove function possesses complete control over the user selection process. However, the filter method reverses this control dynamic, empowering you to determine the criteria for selecting the user:</p><p><strong>With Dependency Injection and Inversion of Control</strong></p><pre>const newlist = list.filter( user =&gt; user.id !== id )</pre><p>With a single line we did exactly the same as we did before and filter can be reused for many other cenarios.</p><p>If we want to find a particular user without changing the size of items of a particular list, we can use the map method for it:</p><pre>const newlist = list.map( user =&gt; {<br>  if( user.id == id )<br>    user.role = &#39;admin&#39;<br>  return user <br>})</pre><h3>DI &amp; IC in Frameworks</h3><p>Those concepts are so deeply ingrained in the language that they shouldn’t become more complex when transitioning into Frameworks. Indeed, React lacks a dedicated Dependency Injection (DI) mechanism; it is inherently built into the framework due to the functional nature of its components. Consequently, all that’s required is to anticipate a callback function within your generic component, and there you have it.</p><p>In contrast, Angular doesn’t offer such simplicity. To inject dependencies, you must invest time in understanding its mechanisms, and familiarize yourself with concepts like <strong>Services, Decorators, Injectable, Providers</strong>, if you haven’t already done so.</p><p>With that said, it’s clearer, at least to me, that the more a framework or library aligns with the language’s native features and functionality, the easier it becomes to accomplish tasks.</p><h3>DI &amp; IC in Jails</h3><p>Jails is all about simplicity, so naturally, those things should be straightforward in Jails, right? Yeah… and they are:</p><pre>// at home.js<br>import jails from &#39;jails-js&#39;<br>import router from &#39;jails.pandora/router&#39;<br>import store from &#39;jails.pandora/store&#39;<br><br>import * as myComponent from &#39;./components/my-component&#39;<br><br>jails.register(&#39;my-component&#39;, myComponent, { router, store, ... })<br>...other components registering</pre><p><strong>Component usage</strong></p><pre>export default function myComponent ({ main, dependencies }) {<br>   <br>  const { router, store } = dependencies <br>   <br>  main( _ =&gt; {<br>    router.get(&#39;/&#39;, log)<br>  })<br>   <br>  const log = () =&gt; console.log(&#39;Hello World!&#39;)<br>}</pre><p>The injection occurs during the component registration phase, and the purpose of Dependency Injection (DI) and Inversion of Control (IC) in Jails aligns precisely with what we discussed earlier in this article. It’s all about decoupling generic behavior from specific logic. Moreover, it involves sharing capabilities and instances between components, as illustrated in the example above.</p><h3>A Real World Use Case</h3><p>Form Validation poses an ongoing challenge in the Front End realm. Eventually, every framework and library will offer a general abstraction to handle this task, and Jails is no exception.</p><p>Recently, I developed a validation component using Jails and shared it in a repository. While I don’t anticipate creating numerous abstractions with Jails, as the philosophy of this application library prioritizes full interoperability with the Vanilla JavaScript ecosystem, there’s an exception for Form Validation.</p><p>The challenge in crafting such an abstraction lies in ensuring its generic nature, enabling anyone worldwide to utilize it irrespective of regional specificities. To achieve this, we must discern between what aspects should be generic and what should remain specific.</p><p>The generic aspect entails attaching event handlers to validate functions, updating the view with error feedback when necessary, and removing errors upon validation. This segment manages events and applies classes to DOM elements for programmers to utilize in handling UI errors.</p><p>Conversely, since validations can vary based on regions, business rules, etc., all validations should be externally provided to the component, adhering to a defined contract to ensure correct behavior of the generic abstraction. Additionally, dynamic configurations must be accessible to specify the validations a field requires.</p><h3>Introducing — Form Validation Component</h3><p>So, to invert the control of the Form Validation component and ensure its generic usability across various scenarios, the <em>Form Validation Component </em>leverages the Jails <strong>Dependency Injection</strong> system to inject specific validation rules. Additionally, it retrieves configuration data from HTMLFormElement.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fjails-form-validation%3Fembed%3D1%26file%3Dapp%252Frules.ts&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fjails-form-validation%3Fembed%3D1%26file%3Dapp%252Frules.ts&amp;image=https%3A%2F%2Fsocial-img.staticblitz.com%2Fprojects%2Fjails-form-validation%2Fe516b7b374af400ef3bf8eb5f847608f&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/fde0387a6eba1b3c6f7a0883b3bff1d8/href">https://medium.com/media/fde0387a6eba1b3c6f7a0883b3bff1d8/href</a></iframe><p>So that&#39;s it… That’s all I got for you guys.</p><p>Checkout the <a href="https://stackblitz.com/edit/jails-form-validation?file=app%2Frules.ts">Demo</a> hosted on StackBlitz so you can learn more about that.</p><p>See you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c106dd8808c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/dependency-injection-inversion-of-control-jails-5-0c106dd8808c">Dependency Injection, Inversion of Control &amp; Jails 5</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Jails and the art of building a Framework]]></title>
            <link>https://medium.com/jails-org/introducing-jails-and-the-art-of-build-a-framework-dcfca9a4a2f4?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/dcfca9a4a2f4</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 01:39:10 GMT</pubDate>
            <atom:updated>2016-12-18T19:03:29.193Z</atom:updated>
            <content:encoded><![CDATA[<p>There is a lot of fields which a programmer can choose to work and to specialize, once you find what motivates you, is pretty hard not follow your instinct. I was always the framework guy. I realized that creating frameworks is an art.</p><h3>Why to write one?</h3><p>I can only speak for myself, in my case is always that feeling that you’re repeating yourself, is a feeling that your code is not elegant enough, etc…Before you even start to write one, of course you have to make some research to be sure you’re not starting with the initial issue which is to not repeat, so is there a solution already?</p><p>Life does not have 1 answer for all the problems, programs are not different and you will probably find answers for your problems that doesn’t fit as you want or as you need, but it helps you in some cases. There’s another reason why you need to write a new one: Because you <strong>like</strong>. Because that’s what makes you feel alive, that’s your thing.</p><h3>Learning and thinking by yourself</h3><p>One of the best thing to write a framework is the learning part. We have a lot of different ways to learn something new, and writing a framework gives you a huge list of things to learn, some of them are not related to programming techniques or something technical, you will find yourself questioning things you have never thought about, it’s also a philosophy’s exercise.</p><p>Some people ask me why did I started such project when there’s options like <strong>Reactjs, Angularjs, Backbone, Ember</strong>… Well, I used them on some projects, but as I said before, they are not the answer for all the problems, so you will eventually find a case where you will not be free of repeating yourself, or it’s not modular enough or is not elegant as you’d like. Maybe you should write something that fits like a glove on your project.. You need to write when you are finally understanding about your project and why did you make so many mistakes…</p><p>Every project is singular. Also, I belive that to be a React developer, Angular developer or any other framework developer is awesome, you learn a lot with such different paradigms. But maybe sometimes you need to start to think by yourself.</p><h3>About preaching…</h3><p>People has different thoughts, there is a kind of developer which gets excited with a new technology or a new framework and it’s enough to make him happy. So he will now spend the time to understand that tool and make your applications even better. That’s really awesome. But there are other kind of developers that takes it very serious, I call them preachers…</p><p>The preachers are those programmers which not only selects the best solution, he also becomes the team player, he choose the library/framework and he is absolutely right that everyone should use that. Any other solution does not make any sense to use and they are worthless.</p><p>I realize when the subject is programming that, <strong>nothing is definitive</strong>. That sentence gets even more evident when we look at patterns, architectures and frameworks which were THE BEST solutions at that time but now is completely dead.</p><h3>Don&#39;t write it, because…</h3><p>When you write something on your own you will be tested. Not everyone has the same vision as you have about your idea, and they will argue. Some arguments are classic:</p><blockquote>That framework A is consolidated. No reason to start a new one.</blockquote><p>Well… it’s true… But not 100% true. You need to see other hidden parts. If you have a bug on your application using some consolidated framework, you will probably find the answer for some gotcha on stackoverflow.</p><p>But it turns out that your framework as any other will not solve all the problems and you have to write something that automates the relationship of the many parts of your application. Well.. that’s not in stackoverflow.. if your architecture is messed up, there’s no straightforward answer for you.</p><p>I’ve seen some mistaken architectures using Backbone, which is consolidated and it is one of the best frameworks we have. But the problem is not the framework. Also, <strong>A framework does not start already consolidated</strong>. It has to start somehow.</p><h3>You think you can do better?</h3><p>No. It’s not about to be better or worse, but give another solution, another perspective. It’s about to think in other direction. It’s about to try to be creative. And be creative doesn’t mean to be 100% original, some parts it is wiser to use some very known techniques but applied in a different way.</p><h3>Jails — Micro-Framework</h3><figure><a href="http://jails-org.github.io/Jails/documentation/"><img alt="" src="https://cdn-images-1.medium.com/max/812/1*qDE-gGRmspHPjYnhZ2iekA.png" /></a></figure><p>This is the best part for me, the part that makes me very happy… This is my project, my work… It’s the result of learning through many years of failures. It’s the result of thinking at all I’ve done in the past. It is my understanding about elegance.</p><p>It is also a result of learning from other frameworks too. It is <strong>Event-Driven</strong>, <strong>Modular</strong> and follows the <strong>Atomic Design</strong> philosophy. And one of my biggest concern is to keep it simple and with a very low learning curve.</p><p>I want to invite you to know more about <a href="http://jails-org.github.io/Jails/documentation/"><strong>Jails</strong></a> project. Even that you’re not convinced that it worth the time, maybe it can inspire you to think on something different and to think something on your own.</p><p><a href="https://github.com/jails-org/Jails">https://github.com/jails-org/Jails</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcfca9a4a2f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/introducing-jails-and-the-art-of-build-a-framework-dcfca9a4a2f4">Introducing Jails and the art of building a Framework</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTMX — New Hype, new problems — Jails for the Rescue.]]></title>
            <link>https://medium.com/jails-org/htmx-new-hype-new-problems-jails-for-the-rescue-e2abe4cc769d?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/e2abe4cc769d</guid>
            <category><![CDATA[best-javascript-framework]]></category>
            <category><![CDATA[htmx]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[jails-js]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 01:37:18 GMT</pubDate>
            <atom:updated>2024-12-27T21:15:05.185Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTMX — New Hype, new problems — Jails for the Rescue.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9sr-2JReCjPyJmw0" /><figcaption>Photo by <a href="https://unsplash.com/@craft_ear?utm_source=medium&amp;utm_medium=referral">Jan Tinneberg</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The moment we’ve all been waiting for has arrived. Htmx is gaining momentum amidst the front-end frenzy. While it may not be my preferred solution, given the unnecessary complexity introduced by modern front-end frameworks in the majority of web applications, it serves as a catalyst, prompting the community to reconsider its approach.</p><p>Htmx is not the sole player in reshaping perspectives; other agnostic tools and metaframeworks, such as Astro and Tailwind, are also contributing to this paradigm shift. What I find intriguing is how Htmx, in its own way, exposes the superfluous intricacies that have become commonplace in today’s web applications. However, for specific reasons, it doesn’t align with what I was seeking.</p><h3>The complexity is still there, it just moved to the back-end</h3><p>Hey, just a heads-up: diving into HTMX means you’re still in for rendering pages, handling components, and getting down with validations and business logic. But here’s the twist — those aren’t just your usual front-end squad problems anymore. Now, it’s a back-end party, and they’re the ones managing the mix.</p><p>From day one in my front-end journey, I picked up on the fact that mixing things up usually leads to some serious headaches. Trust me, it doesn’t age like fine wine. I’d steer clear of tossing all these concerns into one pot — it’s a recipe for future regrets.</p><p>Here’s the deal: rolling with this approach means you’re signing up for a Fullstack Team gig. The cool part? You get to pick your poison when it comes to the back-end language.</p><p>The whole “Fullstack” buzz is a bit of a head-scratcher, and personally, I’m not its biggest fan. Finding someone rocking both disciplines like a rockstar is like spotting a unicorn — it’s rare, especially considering the ever-expanding sea of info and skills needed nowadays.</p><p>Now, if you’re all in on the “fullstack” vibe, be ready for a potential pitfall. Instead of unlocking the full potential of your developers’ expertise, you might end up settling for an average skill level across the board.</p><p>Here’s my hunch: sooner or later, your fullstack dream team will naturally split into two squads. One comfy with HTML and UI jazz, and the other rocking it in infrastructure, reliability, integrations, security — the whole shebang.</p><p>And voila! You’re back to the good ol’ Front-end and Back-end Teams. For a startup, sure, it might be a decent kick-off strategy, but for a well-established company? Not so much. You risk missing the chance to outshine your rivals and might even drag down your team’s performance with a less-than-optimal setup.</p><h3>Again, being in the extreme…</h3><p>I’m convinced that many of the challenges we face in today’s modern web apps stem from our love for extremes. It’s like we can’t decide whether everything should reside in JavaScript — HTML (JSX), CSS (CSS-in-JS), images, SVGs — or if we should push all JavaScript into HTML, embracing tools like Alpine.js and the latest sensation, Htmx.</p><p>Anyone with a solid 5 years in the realm of JavaScript web applications knows this extreme approach doesn’t hold up in the real world. Take Alpine, for example; debugging and scaling become real headaches when your code is directly embedded in HTML files.</p><p>Then there’s Htmx, where you end up needing an additional library or framework if you want to handle things that don’t warrant a server request. Some teams opt for the middle ground, going with vanilla JavaScript alongside the Htmx library. While I’m personally inclined towards vanilla JavaScript over heavy frameworks like React and Angular, I’m aware that treading this path leads us down the same road we traveled back in the day when we realized we needed some kind of engine, framework, or library to enhance how we abstract and organize our apps.</p><p>Here we are again, caught in the same cycle of extremes.</p><h3>So… what then?</h3><p>The sweet spot lies in finding a <strong>middle ground</strong>.</p><p>I’ve been deep into a JavaScript library for quite a while now — <a href="https://jails-js.org/">Jails</a>. The name drew inspiration from Rails because, for me, Rails is a framework that seamlessly aligns with the language and back-end context. I wanted to create a similar vibe but for the front-end.</p><p>It’s been nearly nine years since I kicked off this journey, constantly fine-tuning and simplifying. Currently rocking its fifth version, it’s all decked out with modern HTML5 and DOM API features.</p><h3>So what is Jails in a nutshell?</h3><p>A Web Component library that is focused on mounting in specific areas ( DOM elements ) in your web page, bringing a simple and short list of html directive language and keeping your Javascript logic separated from your html, it means very lite bundle files.</p><ul><li>It&#39;s made for <a href="https://www.patterns.dev/vanilla/islands-architecture"><strong>Island Architecture Apps</strong></a><strong> &amp; </strong><a href="https://medium.com/@rajithacharith/introduction-to-micro-frontends-283aa1e126c5"><strong>Micro-Frontends</strong></a><strong>.</strong></li><li>It&#39;s <strong>Functional Oriented, </strong><em>but in the Javascript way.</em></li><li>It&#39;s <strong>Event Driven.</strong></li><li>It&#39;s ready for <a href="https://htmx.org/essays/hypermedia-driven-applications/">Hypermedia-Driven Applications</a>.</li><li>It&#39;s only ~<strong>6kb gzipped</strong>.</li></ul><h3>Hypermedia Driven Applications ? How so?</h3><p>Htmx boasts an extensive range of HTML attributes and pre-built event behaviors, making it a powerful tool. However, there might be scenarios where a specific behavior you’re after isn’t readily available, or you might need to take a workaround route to achieve your goal.</p><p>What would I do using Jails? Well, let’s say you want to update a list of users after a form submission:</p><pre><br>&lt;x-form&gt;<br>    &lt;form action=&quot;/service/hypermedia/user&quot; data-target=&quot;#user-list&quot;&gt;<br>        &lt;button&gt;Send&lt;/button&gt;<br>    &lt;/form&gt;<br>&lt;/x-form&gt;<br><br>&lt;div id=&quot;user-list&quot;&gt;&lt;/div&gt;</pre><p>The component could be something like this:<em> ( A simple version of it )</em></p><pre>export default function xForm ({ main, on, elm, innerHTML }) {<br>    <br>    const form = elm.querySelector(&#39;form&#39;)<br>    const target = document.querySelector(form.dataset.target)<br><br>    main(_ =&gt; {<br>        on(&#39;submit&#39;, &#39;form&#39;, onsubmit)<br>    })<br><br>    const onsubmit = (e) =&gt; {<br>        <br>        const form = e.target<br>        const url = form.action<br>        const formData = new FormData(form) //Needs a little work here before send<br>        <br>        fetch( url,{ body: formData, method: &quot;post&quot; })<br>            .then( response =&gt; response.text() )<br>            .then( html =&gt; innerHTML(target, html) )<br><br>        e.preventDefault()<br>    }<br>}</pre><p>The initialization would be:</p><pre>import jails from &#39;jails-js&#39;<br>import * as xForm from &#39;components/x-form&#39;<br><br>jails.register(&#39;x-form&#39;, xForm, {})</pre><p>A <strong>Jails</strong> component is just a High Order Function that gets some built-in functions in order to make your life easier then if you had to do it in plain javascript.</p><p>The above example shows the benefit of using event delegation, accessing scoped dom element, and using a dom diffing version of innerHTML in a html element.</p><p>You could write such component, document it and share with the other teams in your company, so it would not be a generalized solution but a customized module to your business.</p><p>So because it&#39;s a programatic library, you can create your own system for observability, errors handling, cross component communication using built-in pub / sub event bus.</p><p>I would be very happy to show more about the library, but let&#39;s keep it for another post. Take a look at the Jails <a href="https://github.com/jails-org/Jails">repo</a>, and <a href="https://stackblitz.com/@Javiani/collections/jails-organization">examples</a> if you got interested…</p><p>That&#39;s all I got for you now… Thank you for reading.</p><p>Until the next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2abe4cc769d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/htmx-new-hype-new-problems-jails-for-the-rescue-e2abe4cc769d">HTMX — New Hype, new problems — Jails for the Rescue.</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jails 5 — The latest version and the Front-end state.]]></title>
            <link>https://medium.com/jails-org/jails-5-the-latest-version-and-the-front-end-state-c2bbbbd26e9c?source=rss----7863084c5e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/c2bbbbd26e9c</guid>
            <category><![CDATA[island-architecture]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[astro-build]]></category>
            <category><![CDATA[astrojs]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <dc:creator><![CDATA[Eduardo Ottaviani Aragão]]></dc:creator>
            <pubDate>Mon, 03 Oct 2022 19:45:32 GMT</pubDate>
            <atom:updated>2023-02-26T23:59:40.494Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jails 5 — The latest version and the Front-end state</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dNdqAmd-Jd-qxH_3UhDsAQ.jpeg" /><figcaption>Jails 5 — Codename <em>Athena — Goddess of Wisdom — Illustration from </em><a href="https://br.pinterest.com/pin/59813501289170224"><em>3dtotal.com</em></a></figcaption></figure><p>That&#39;s it, another version of this project that started in 2014. Looking at the begining of this project many things changed but the main purpose still exactly the same.</p><p>It was built to be a one layer above jQuery concerns, it was all about how to think about logic and component relationship and create a common code structure without breaking the web, making it as close as possible to the Web Development standards keeping the things we already learned, it was not meant to be revolutionary, it was all about to be a progressive enhancement.</p><h3>Lessons learned from other versions</h3><ol><li>Nobody will write simple code just using Jails, there&#39;s a need to find a time to help on education with this library. I thought that because it&#39;s simpler, the applications would be simpler aswell, but it turns out to be not true in practice.</li><li>JS community still has room to grow, I thought everything I ever needed would be available in some sort of javascript open source library. It seems that it&#39;s not that true, only morphdomused in this project was mature enought and keeping updated. There are several good projects out there that are being abandoned or lacks motivation to keep it up.</li><li>Rendering is the most complicated thing to be 100% complete. There&#39;s a lot of edge corners and it&#39;s quite challenging to be aware of them and I believe this is the most important part of Component libraries and frameworks.</li></ol><h3>What changed in this last version?</h3><h4>Template system</h4><p>Technically a lot of stuff. But the main issue that was haunting me was the fact that a child component wasn&#39;t able to see variables created in template system context, it was impossible to pass down a variable from a iteration for child components. That was fixed but changing the way I was working with morphdom plus I had to replace the good soda template system for a new one more flexible.</p><h4>Core System</h4><p>I always do a rewrite from scratch in major versions, that because as programmers we do evolve our way to abstract things and we are always getting better at it. So there&#39;s a lot of improvement in logic which might not be a huge difference for final users but it does help me to keep it more reasonable so it&#39;s easier to add more features in a more elegant way, also less bugs that happens due to a bad code construction.</p><p>In this process of rewritting I just realized that I was managing lifecycle manually and it seems that Custom Element api is already there in the majority of the browsers, so I was iluminated by this idea:</p><blockquote>What if I use the Custom Element define api ? It already has a native lifecycle for a html element and it would be more close to the web standards in a way that Jails component now would be a custom element instead of a regular html element with some data-component on it…</blockquote><p>That worked like a charm… I was removing code from the source, keeping it more simple, more reasonable and more elegant. Plus it can be used as a web component. Great!</p><h3>The current state of Web Development</h3><p>Jails was always about keeping your js code separated from your html, it&#39;s was all about separation of concerns, It was all about keeping things simple.</p><p>But some of the best ideas and learnings was that kept us away from dangerous development was being replaced in the name of <em>revolutionary </em>ideas from modern Frameworks. Perhaps a lot of things was lost in this process:</p><ol><li><strong><em>Performance and SEO</em></strong> was degrated from past years brought by SPA idea, and now is a thing that most of new ideas are trying to bring back those concerns. <br><strong><em>Those issues were never in Jails concerns because I aways bet on separation of concerns and that means Javascript for behavior, other languages for rendering.</em></strong></li><li><strong><em>Complexity</em></strong>. Most of the time you&#39;ll see more code and more frameworks dialects to solve the exactly the same problems we used to have 10/12 years ago but more complex: Redux, Redux Saga, useMemo, useCallback, and the list goes on… Maybe we&#39;re going to far…</li></ol><h3>Jails is still in the right way…</h3><p>There are <em>new ideas </em>emerging nowadays. There are not 100% new, but they bring some new technics from modern apps in order to let the good old ideas more <strong>digestible</strong>.</p><p><strong>Those ideas are bringing back the best practices we learned in the past:</strong></p><ol><li>Multipages instead of Single Page Application for Fast pages and SEO complient.</li><li>To choose static pages generation whenever its possible so you can antecipate errors in build time, save money with hosting.</li><li>Jamstack. Keeping the business logic centered in Api&#39;s so you can separate your front-end repository and keep it decoupled from back-end development, so you can write front-end with any framework you want.</li><li>Monorepo. There&#39;s now a trend that tells you that sometimes it&#39;s better to keep everything in just one place for simplicity sake, and now there are some tools in order to help you with that, also yarn and npm already give you a native way to manage your dependencies in a single project.</li><li>Island Architecture. The idea that javascript behavior is added in a restricted area of your page instead of mounting it on entire app. That Island Architecture strategy may help you to decrease your bundle size and your application complexity.</li></ol><p>All those things was already in Jails philosophy, I was working with this library in several production apps and some of the modern headaches I never had to face.</p><blockquote>It seems that Jails is, just like a good book, something that shows its true value along the years.</blockquote><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2bbbbd26e9c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jails-org/jails-5-the-latest-version-and-the-front-end-state-c2bbbbd26e9c">Jails 5 — The latest version and the Front-end state.</a> was originally published in <a href="https://medium.com/jails-org">Jails-org</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>