<?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[Stories by Mark Woollen on Medium]]></title>
        <description><![CDATA[Stories by Mark Woollen on Medium]]></description>
        <link>https://medium.com/@mwoollen?source=rss-1c4f1b51c3ac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*myWeXSYb1bB6cREH.jpg</url>
            <title>Stories by Mark Woollen on Medium</title>
            <link>https://medium.com/@mwoollen?source=rss-1c4f1b51c3ac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:01:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mwoollen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Jose Alvarado making big impact for Knicks off the bench in NBA finals against Spurs.]]></title>
            <link>https://medium.com/@mwoollen/the-knicks-best-player-is-sitting-on-the-bench-based-on-all-available-game-data-r1-atl-r2-9b7ab9b4950c?source=rss-1c4f1b51c3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b7ab9b4950c</guid>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[basketball]]></category>
            <category><![CDATA[jose-alvarado]]></category>
            <category><![CDATA[new-york-knicks]]></category>
            <dc:creator><![CDATA[Mark Woollen]]></dc:creator>
            <pubDate>Thu, 11 Jun 2026 11:33:14 GMT</pubDate>
            <atom:updated>2026-06-11T19:50:01.171Z</atom:updated>
            <content:encoded><![CDATA[<p>Jose Alvarado making big impact for Knicks off the bench in NBA finals against Spurs.</p><p>A data-driven breakdown of every Finals rotation player — and why Jose Alvarado’s 16 minutes might be costing New York a championship<br>The New York Knicks are one win away from their first NBA championship since 1973. They’ve swept through Atlanta, gutted out a brutal Eastern Conference bracket, and now lead the San Antonio Spurs three games to one in the Finals. By every surface-level measure, Mike Brown’s rotation is working.<br>Except the numbers say otherwise.<br>Dig into the net ratings, defensive efficiency splits, and on/off data from this entire playoff run, and a different picture emerges — one where the team’s most impactful player is logging 16 minutes a night, where the starting small forward is a liability in close games, and where the coaching staff’s rotation decisions are leaving real margin on the table heading into a must-win road game in San Antonio.<br>Here is every Knicks rotation player, assessed honestly — no narrative, no sentiment, just what the data shows.<br>Jalen Brunson | Guard | Starter<br>Verdict: Indispensable. The engine. But dangerously volume-dependent.<br>Nobody on this roster does what Brunson does. He gets to his spots in the half-court, manufactures offense from nothing, draws fouls at an elite rate, and has the kind of closing gear that most players never develop. His 39-point performance against Atlanta in Game 5 — posted at 73.5% true shooting — wasn’t a fluke. Neither was the 36-point, 7-assist night in Finals Game 4 that completed a 29-point comeback.<br>But the seams show when he’s asked to carry too much. In Finals Game 1, he put up 30 points on 31 field goal attempts, finishing at 45.8% true shooting — barely above replacement-level efficiency for the volume he consumed. His turnover burden compounds in those games, and the offense stagnates around him when his shot isn’t falling.<br>The through-line across every game: his net rating is positive. He’s never the reason the Knicks lose. But on nights when the supporting cast doesn’t show up, he becomes the entire offense — and that’s a fragile position to be in for a road elimination game.<br>OG Anunoby | Forward | Starter<br>Verdict: Explosive but streaky. Elite ceiling, real floor.<br>Anunoby has produced two of the most efficient individual performances of this entire postseason. In the Atlanta series closeout, he scored 29 points on 92.9% effective field goal percentage. In Finals Game 4, he hit 7 of 9 threes and finished at 93.5% true shooting. On those nights, he is genuinely unguardable.<br>The problem is the games in between.<br>His defensive rating fluctuates more than any other starter on the team — posting an elite 77.8 in one game and cracking 120 in several others. Despite massive individual scoring lines, he has been a net-neutral or slight negative in multiple games because opponents exploit other avenues while defenders chase him around screens. He is not a consistent two-way anchor. He is a weapon — spectacular when ignited, invisible when he isn’t.<br>For a team that needs him to be a complementary star and not a primary engine, that volatility is manageable. But don’t mistake the Game 4 line for a steady baseline. It isn’t.<br>Karl-Anthony Towns | Center | Starter<br>Verdict: The most valuable starter nobody is talking about.<br>While the Brunson and Anunoby performances dominate the highlights, Towns has quietly been the most consistently net-positive starter across the entire postseason. His offensive rating sits above 120 in the majority of his appearances. His rebounding is dominant — 14 boards against Atlanta, 12 in Finals Game 1, double-doubles throughout the bracket. He draws fouls at a rate that keeps the Knicks in bonus situations early in quarters, and his passing out of the post (10 assists in one Atlanta game) gives Brown a dimension no other starter provides.<br>The single legitimate knock is foul trouble. He has been limited to 26 minutes or fewer in multiple games because of it, and the Knicks&#39; paint presence deteriorates measurably every time he sits. His defensive rating craters the lineups that play without him.<br>This is a coaching problem as much as a player problem. Brown needs a deliberate foul budget for Towns heading into Game 5 — get him off the floor before foul four, regardless of the score or matchup. The risk of losing him early is greater than any offensive advantage his continued presence provides in the first half.<br>Josh Hart | Forward | Starter<br>Verdict: The glue. Undervalued by box scores. Irreplaceable by impact.<br>Hart almost never has a line that makes the highlight reel. He rarely scores more than 9 or 10 points. He shoots poorly from three. And yet his net rating is consistently positive, his rebounding numbers are extraordinary for a wing (15 boards in Finals Game 1, 14 in the Atlanta opener), and his 6-assist nights running the secondary break quietly hold lineups together when Brunson rests.<br>His non-scoring contributions — secondary assists, deflections, offensive rebounds that extend possessions, defensive positioning that frees up KAT — simply don’t show in a box score. The Knicks are a measurably different team when he’s off the floor. His 4 steals in Finals Game 1 alone changed the game’s trajectory.<br>The weakness is real: he goes cold from the field for extended stretches and his three-point shooting is unreliable enough that defenses can sag off him. But his floor as a contributor — even on his worst offensive nights — remains high enough that he belongs in this starting lineup. He’s the player the team falls apart without, and most casual fans have no idea.<br>Mikal Bridges | Guard | Starter<br>Verdict: The weakest link in the starting five. A liability in close games.<br>This is the most damning profile in the dataset, and it needs to be said plainly.<br>Bridges has been one of the most inconsistent players in this entire postseason. His range runs from genuinely elite — 24 points on 83.3% field goal percentage in the Atlanta series blowout, +40 net rating — to complete non-entity. In Atlanta Game 3, he contributed 0 points in 3 field goal attempts and was a -26. In Finals Game 4, he shot 33% from the field and finished as a net negative on a night the Knicks needed every rotation player to show up.<br>The structural problem is his inability to create offense off the dribble. When his shot isn’t falling, defenses can functionally ignore him, which collapses spacing for Brunson and Towns. He doesn’t pressure the rim, doesn’t draw fouls at a meaningful rate, and his defensive rating in contested games against quality wings has been inconsistent at best.<br>The Atlanta blowout game inflates his playoff perception significantly. Strip that out, and his profile across close, contested games against legitimate opponents is a net negative starter — one who requires his shot to be falling just to break even. Brown has been slow to pull him in these situations, and it has cost the Knicks multiple times. In Game 5, on the road, against a Spurs team desperate to extend the series, Bridges needs a short leash from the opening tip.<br>Jose Alvarado | Guard | Bench<br>Verdict: The most impactful player per minute on this roster. Criminally underused.<br>Set aside everything you think you know about bench hierarchy and playoff rotation logic. The data on Alvarado is unambiguous.<br>Five playoff appearances. Five positive net ratings. Zero negative games.<br>His defensive ratings while on the floor are the best recorded by any Knick across any meaningful stretch this postseason: 83.7 in Finals Game 1, 69.9 in the Atlanta closeout, 81.3 in Atlanta Game 4 — numbers that reflect an elite defensive pace, not small-sample noise. His 2 steals in limited minutes, his 13 steals percentage in one appearance, his consistent ability to pick pockets and disrupt offensive rhythm are not accidents. They are his skill set, operating at full capacity every time he steps on the floor.<br>Offensively, he shoots efficiently when given opportunities — career playoff true shooting percentage above 70%, including a 3-of-4 night from three in Finals Game 4. His 8 points and +11 net rating in 16 minutes that night matched Brunson for the best on the team, on a night the Knicks trailed by 29 points at one point.<br>The conventional argument against him — foul trouble and defensive liability in space — is simply not supported by this dataset. He has not had a single game where his defensive presence caused a collapse. What the data actually shows is that Mike Brown is consistently pulling a player who makes the team measurably better, in favor of players (Shamet, McBride) whose metrics don’t justify the minutes.<br>Alvarado should be playing 20 or more minutes in Game 5. The case for it isn’t preference or narrative. It’s arithmetic.<br>Jordan Clarkson | Guard | Bench<br>Verdict: Situational value only. Not built for crunch time.<br>Clarkson provides real value in a specific context: second-quarter lineups when the game is loose and he can operate in space off the bench. He generates momentum, gets to the mid-range, and keeps scoring units functional when Brunson rests.<br>But his defensive rating is a liability (115–121 in most appearances), his turnover rate climbs under defensive pressure, and his shot selection deteriorates in fourth-quarter situations. He is not a player you want on the floor in the final six minutes of a close Finals game on the road. Use him early, pull him before the game tightens, and his contribution is net positive. Misuse him in closing lineups and the numbers turn against you quickly.<br>Mitchell Robinson | Center | Bench<br>Verdict: Upside in bursts. A self-destruction risk in extended minutes.<br>When Robinson is disciplined, he adds genuine value. His rim conversion rate when he gets clean looks is elite. His offensive rebounding creates second-chance opportunities that nobody else on this roster generates. His shot-blocking presence against Victor Wembanyama — the most important individual matchup in this series — has real tactical value.<br>The problem is sustainability. His free throw shooting bottomed out at 25% in one game. A flagrant foul in Finals Game 4 swung momentum at a critical moment. Extended minutes tend to surface both problems simultaneously.<br>The prescription is specific: 12 to 14 minutes in targeted Wembanyama matchup situations, removed before he accumulates enough exposure to self-destruct. The talent is real. The reliability is not.<br>Landry Shamet | Guard | Bench<br>Verdict: Overextended. A roster construction problem playing rotation minutes.<br>There is no gentle way to say this: Shamet is a 10th or 11th man playing 15 to 21 minutes in an NBA Finals. Across every game in this dataset, his net ratings are negative or marginal, his defensive value is near zero, and his offensive creation is limited to catch-and-shoot situations that quality Finals defenses eliminate with minimal adjustment.<br>This is not a criticism of Shamet as a person or a player operating within his actual role. It is an observation that the Knicks&#39; roster depth at guard has forced Brown into a situation where someone like Shamet has to play meaningful minutes in close games. That margin belongs to Alvarado. The fact that it doesn’t is the most correctable inefficiency on this team.<br>Miles McBride | Guard | Bench<br>Verdict: High variance. Useful in specific matchups, not reliable as a staple.<br>McBride is a streaky contributor whose best nights — efficient threes, active hands on defense — make him look like a genuine rotation piece. His worst nights are black holes: 0-for-4 from the field, negative net ratings, defensive breakdowns in space. The variance is too wide to trust in a Finals environment where every possession carries elevated stakes.<br>His best role is 10 to 12 minutes against slower half-court teams where his athleticism creates advantages. Against San Antonio’s pace and perimeter athleticism, he has been more liability than asset in the games where it mattered most.<br>The Bottom Line<br>The Knicks are three wins from a title and the fundamentals of this roster are sound. Brunson is a legitimate Finals closer. Towns is quietly one of the best players in this series. Hart is the connective tissue that holds everything together. And Anunoby, when his shot is alive, is as difficult to guard as anyone in the league.<br>But the margin in Game 5 — on the road, in a building that will be the loudest it has been all season, against a Spurs team with nothing to lose — will come down to decisions. Whether Brown pulls Bridges before the damage compounds. Whether Towns gets off the floor before foul four. Whether Alvarado gets the minutes his performance has earned all postseason.<br>The data has been consistent for six weeks. The question is whether the coaching staff is reading it.<br>All statistics sourced from official SportRadar NBA play-by-play and box score data across the 2026 NBA Playoffs. Net ratings and efficiency metrics reflect player-specific on/off splits per game.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b7ab9b4950c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supabase + Appsmith (supabase-js + headers)]]></title>
            <link>https://medium.com/@mwoollen/supabase-appsmith-supabase-js-headers-f3ac1b4694aa?source=rss-1c4f1b51c3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3ac1b4694aa</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[appsmith]]></category>
            <dc:creator><![CDATA[Mark Woollen]]></dc:creator>
            <pubDate>Tue, 31 Dec 2024 22:10:24 GMT</pubDate>
            <atom:updated>2024-12-31T22:10:24.192Z</atom:updated>
            <content:encoded><![CDATA[<p>Appsmith (front-end “low-code”) and Supabase (Postgres + REST stack) are an interesting combination. Free = Fun. Stable = Compelling. Low Code = Efficient. As I use this combo, I uncover interesting hidden gems that either aren’t documented, or not immediately obvious.</p><p>Today’s challenge… Leverage supabase-js Javascript library to make calls from Appsmith → to → Supabase. (on <a href="https://github.com/supabase/supabase-js/tree/master">github</a>).</p><p>In your Appsmith app, go to “Installed Libraries” (near the bottom of left nav bar) and then add supabase-js library URL (you can search for the appropriate URL on <a href="https://www.jsdelivr.com/package/npm/@supabase/supabase-js">jsDelivr</a> website. Copy the URL and paste into the appropriate text box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x62Vi1Mvj33G6N-5fm6rhA.png" /></figure><p>Now, back to Appsmith Editor and create Javascript that can make Supabase calls using the supabase-js library.</p><pre>export default {<br> supaclient: {},<br> base_url: &quot;SUPABASE_URL&quot;,<br> anon_key: &quot;SUPABASE_ANON_KEY&quot;,<br> get_headers: {&#39;Prefer&#39;: &quot;count=exact&quot;},<br> auth: {},<br> <br> reset() {<br>    supaclient = {};<br>    auth = {};<br>},<br><br> login: async (inputs = {}) =&gt; {<br>  // use async-await or promises<br>  this.supaclient = supabase.createClient(&quot;SUPABASE URL&quot;,&quot;SUPABSE ANON KEY&quot;);<br><br>  let { data, error } = await this.supaclient.auth.signInWithPassword({<br>   &quot;email&quot;: &quot;REGISTERED USER EMAIL&quot;,<br>   &quot;password&quot;: &quot;REGISTERED USER PASSWD&quot;<br>  });<br><br>  this.auth = data;<br>  return data;<br> },<br><br> connect: async (inputs = {}) =&gt; {<br>  if (null === this.auth?.session?.access_token || undefined === this.auth?.session?.access_token)<br>   {<br>      // attempt login<br>      await this.login(inputs);<br>   }<br><br>   // if login still fails then<br>   if (null === this.auth?.session?.access_token || undefined === this.auth?.session?.access_token)<br>   {<br>      // reset and return nada.<br>      return this.reset();<br>   }<br>  let defaults = {url: &quot;SUPABASE URL&quot;, token: this.auth.session.access_token};<br>  let response = {};<br>  let error = {};<br>  let request = {...defaults, ...inputs};<br><br>  console.log(&quot;request: &quot; + JSON.stringify(request));<br>  this.supaclient = supabase.createClient(request.url,request.token, {&#39;global&#39;: {&#39;headers&#39;: {&#39;Prefer&#39;: &quot;count=exact&quot;}}});<br><br>  return this.supaclient.auth.getUser();<br> },<br> <br> rest_get: async (inputs = {}) =&gt; {<br>  await this.connect(inputs);<br>  if (null === this.auth?.session?.access_token || undefined === this.auth?.session?.access_token)<br>   {<br>    return this.auth;<br>   }<br>  <br> let defaults = {<br>          url: this.base_url, <br>          token: this.auth.session.access_token,<br>          range: {start: 0,  end: 0},<br>          filters: [<br>           { field: &#39;id&#39;, operator: &#39;gt&#39;, value: &#39;00000000-0000-0000-0000-000000000000&#39;}, <br>          ],<br>          entity: &quot;activity&quot;, <br>          select: &quot;name, shortid, data&quot;, <br>          orders: [{field: &#39;modified&#39;, ascending: false}],<br>          };<br>  let response = {};<br><br>  // this will merge / override defaults with inputs<br>  let request = {...defaults, ...inputs};<br><br>  console.log(&quot;inputs:&quot; + JSON.stringify(inputs));<br>  console.log(&quot;request: &quot; + JSON.stringify(request));<br>  var query = this.supaclient<br>      .from(request.entity)<br>      .select(request.select)<br>      .range(request.range.start, request.range.end);<br><br>  // Sort Orders<br>  request.orders.forEach(order  =&gt; {<br>   query = query.order(order.field, {ascending: order.ascending});<br>  });<br><br>  // Filters<br>  request.filters.forEach(filter  =&gt; {<br>   switch (filter.operator) {<br><br>     //.eq(&#39;column&#39;, &#39;Equal to&#39;)<br>    case &#39;eq&#39;:<br>     query = query.eq(filter.field, filter.value)<br>     break;<br><br>     //.neq(&#39;column&#39;, &#39;Not equal to&#39;)<br>    case &#39;neq&#39;:<br>     query = query.neq(filter.field, filter.value)<br>     break;<br><br>     //.like(&#39;column&#39;, &#39;%CaseSensitive%&#39;)<br>    case &#39;like&#39;:<br>     query = query.like(filter.field, filter.value)<br>     break;<br><br>     //.gt(&#39;column&#39;, &#39;Greater than&#39;)<br>    case &#39;gt&#39;:<br>     query = query.gt(filter.field, filter.value)<br>     break;<br><br>     //.gte(&#39;column&#39;, &#39;Greater than or equal to&#39;)<br>    case &#39;gte&#39;:<br>     query = query.gte(filter.field, filter.value)<br>     break;<br><br>     //.lt(&#39;column&#39;, &#39;Less than&#39;)<br>    case &#39;lt&#39;:<br>     query = query.lt(filter.field, filter.value)<br>     break;<br><br>     //.lte(&#39;column&#39;, &#39;Less than or equal to&#39;)<br>    case &#39;lte&#39;:<br>     query = query.lte(filter.field, filter.value)<br>     break;  <br><br>     //.ilike(&#39;column&#39;, &#39;%CaseInsensitive%&#39;)<br>    case &#39;ilike&#39;:<br>     query = query.ilike(filter.field, filter.value)<br>     break;  <br><br>     //.is(&#39;column&#39;, null)<br>    case &#39;is&#39;:<br>     query = query.is(filter.field, filter.value)<br>     break;  <br><br>     //.in(&#39;column&#39;, [&#39;Array&#39;, &#39;Values&#39;])<br>    case &#39;in&#39;:<br>     query = query.in(filter.field, filter.value)<br>     break;  <br><br>     //.contains(&#39;array_column&#39;, [&#39;array&#39;, &#39;contains&#39;])<br>    case &#39;contains&#39;:<br>     query = query.contains(filter.field, filter.value)<br>     break;  <br><br>     //.containedBy(&#39;array_column&#39;, [&#39;contained&#39;, &#39;by&#39;])<br>    case &#39;containedBy&#39;:<br>     query = query.containedBy(filter.field, filter.value)<br>     break;  <br>   }<br>  });<br><br>  console.log(&quot;query: &quot; + JSON.stringify(query));<br><br>  response = await query;<br>  console.log(&quot;response: &quot; + JSON.stringify(response));<br>  return {request, response};<br> },<br>}</pre><p>Now, you can make a simple call to retrieve from Supabase</p><pre><br>await rest_get(<br>{<br>inputs: {entity: &quot;Table_name&quot;, <br>          select: &quot;field1, field2, field3&quot;,}})</pre><p>There are a few assumptions: a) that there is an “id” field as type UUID and b) that there is a “modified” field of type timestampsz that is populated. (I use standard supabase / postgres function to perform this.</p><p>The main thing that I wanted to highlight in this exercise is how to apply additional “headers” to the supabase-js client request. Notice this line</p><pre>  this.supaclient = supabase.createClient(request.url,request.token, {&#39;global&#39;: {&#39;headers&#39;: this.get_headers}});</pre><p>The third parameter allows for a variety of runtime parameters. Read more at <a href="https://supabase.com/docs/reference/javascript/initializing">Supabase Reference Javascript Initializing</a> page. I set the get_headers variable at the top of the object.</p><pre>get_headers: {&#39;Prefer&#39;: &quot;count=exact&quot;},</pre><p>By adding header Prefer=”count=exact”, the full table count will be returned to supabase-js in a response header Content-Range: 0–14/287 and supabase-js will return the total count in the response JSON</p><pre>{<br>  &quot;request&quot;: {<br>    &quot;url&quot;: &quot;SUPABASE URL&quot;,<br>    &quot;range&quot;: {<br>      &quot;start&quot;: 0,<br>      &quot;end&quot;: 0<br>    },<br>    &quot;filters&quot;: [<br>      {<br>        &quot;field&quot;: &quot;id&quot;,<br>        &quot;operator&quot;: &quot;gt&quot;,<br>        &quot;value&quot;: &quot;00000000-0000-0000-0000-000000000000&quot;<br>      }<br>    ],<br>    &quot;token&quot;: &quot;SUPABASE ACCESS KEY&quot;,<br>    &quot;entity&quot;: &quot;activity&quot;,<br>    &quot;select&quot;: &quot;name, shortid, data&quot;,<br>    &quot;orders&quot;: [<br>      {<br>        &quot;field&quot;: &quot;modified&quot;,<br>        &quot;ascending&quot;: false<br>      }<br>    ]<br>  },<br>  &quot;response&quot;: {<br>    &quot;error&quot;: null,<br>    &quot;data&quot;: [<br>      {<br>        &quot;name&quot;: &quot;User logged in&quot;,<br>        &quot;shortid&quot;: &quot;AB89E3A4&quot;,<br>        &quot;data&quot;: {<br>          &quot;email&quot;: &quot;EMAIL&quot;<br>        }<br>      }<br>    ],<br>    &quot;count&quot;: 240,<br>    &quot;status&quot;: 206,<br>    &quot;statusText&quot;: &quot;&quot;<br>  }<br>}</pre><p>You can read more about it on postgrest documentation <a href="https://postgrest.org/en/stable/api.html?highlight=count#exact-count">here</a>.</p><p>Leave a Comment! Connect with me on <a href="https://www.linkedin.com/in/markwoollen/">LinkedIn</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3ac1b4694aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supabase + Appsmith (Part 1): Base Setup]]></title>
            <link>https://medium.com/@mwoollen/supabase-appsmith-part-1-base-setup-e7a56c4792e8?source=rss-1c4f1b51c3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7a56c4792e8</guid>
            <category><![CDATA[appsmith]]></category>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[crud]]></category>
            <dc:creator><![CDATA[Mark Woollen]]></dc:creator>
            <pubDate>Sun, 24 Nov 2024 21:45:58 GMT</pubDate>
            <atom:updated>2024-11-24T21:45:58.847Z</atom:updated>
            <content:encoded><![CDATA[<p>Appsmith (front-end “low-code”) and Supabase (Postgres + REST stack) are an interesting combination. Free = Fun. Stable = Compelling. Low Code = Efficient. So, as we work with Appsmith + Supabase, I find it increasingly challenging to write individual Queries and JS wrappers for <strong>EVERY </strong>CRUD call linking Appsmith to Supabase REST APIs.</p><p>In Part 1, let’s just get the basics setup and configured…</p><ul><li>Login and setup basic environment in Supabase</li><li>Create table(s) in Supabase</li><li>Review and test the Supabase REST APIs using Postman.</li><li>Login and setup base environment in Appsmith</li><li>Create simple app in Appsmith using Queries, JS scripts and Front-end components.</li><li>In Supabase + Appsmith (Part 2): Generic API Get and Count, we will craft a Generic Count, GET, ADD, UPD, DEL query that that can be used for ANY table in Supabase.</li></ul><p>Let’s get started.</p><ul><li>Supabase is a nice wrapped and supported database (Postgres) + REST API solution simplifying dev stack and implementation. To Signup and Setup Supabase, you have a few options: <a href="https://supabase.com/docs/guides/local-development">local develeopment</a> environment, <a href="https://supabase.com/docs/guides/self-hosting">self-hosted</a> installation or <a href="https://supabase.com/docs">cloud configuration</a>. Cloud may be the easiest to get started.<br>Login (create account) at Supabase.com. Create a new project called “supa-fun” (or whatever you like).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jH-0LhVVNHSUgZBX3Jn5ug.png" /><figcaption>Home page for new project “supa-fun”</figcaption></figure><ul><li>Create a simple table, like “notes”. For this SIMPLE exercise, there’s no need for Row Level Security (RLS).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*4hLmzjB8fCrm59wJTK_Brw.png" /><figcaption>Disable RLS</figcaption></figure><p>Add some simple columns: id (primary) and title.</p><p>Add some simple columns: id (primary) and title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*9shfVbny_xhzEC45dS-Rfg.png" /><figcaption>Simple columns: id and title</figcaption></figure><p>Add some sample data to the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-wk1f8iWqYvQSqZOBzQzLA.png" /><figcaption>Add some sample data</figcaption></figure><p>Make note of Supabase API Settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bmDBjh9uECJdfw430Bf_Rw.png" /><figcaption>Go Settings → API and capture your Project URL, Anon Key and Service Key.</figcaption></figure><p>Postman (the STANDARD in API REST verification / testing)… <a href="https://www.postman.com/downloads/">Download Postman</a> and Create a folder / collection for your test requests. Add Collection Variables for the above settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s7RmSW0wET_G7IMh1c_Y3w.png" /><figcaption>Collection variables in Postman</figcaption></figure><p>Set Authorization to use the “anon_key” at the Collection level… API calls can inherit from this collection setting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e45dwjmB7VKLoBXf5D_5mw.png" /><figcaption>Postman Authorization</figcaption></figure><p>Before we create a query in Postman, let’s review details from API documentation in Supabase environment… You’ll find examples for READ, INSERT, UPSERT, UPDATE and DELETE. Examples are provided for Javascript (using Supabase JS client) and for BASH / curl. I like reviewing the curl samples to understand the low-level API call structure (base URL, REST call, Headers, etc).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AcfwL-BwytLb0_gZNrluKg.png" /><figcaption>Supabase API docs</figcaption></figure><p>Replicate the call in Postman. {{url}} pulls the base url from the Collection variables. Plus, “/rest/v1/notes?select=*”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMOlrXVOauabc7Oh8sk_oA.png" /></figure><p>Authorization inherits from Parent by default</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1dhWjXju82ScA-6k-qxjw.png" /></figure><p>Add “apikey” to Headers. (Authorization Header is automagically added)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hE8-OlXNt0vyy0q5LXkkvw.png" /></figure><p>Now “Save” and click “Send”. You should see a JSON-formatted response containing the sample data from your “notes” table in Supabase. (Seriously, that’s pretty cool and easy).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGCSUYD31JpMVqeHn-m4gQ.png" /></figure><p>Follow the pattern for other CRUD functions… Create, Update and Delete. Refer to the API Docs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJOwBGlNojHYextWwgvbtA.png" /></figure><p>Set Headers in POSTMAN. The “Prefer” Header, as <a href="https://github.com/PostgREST/postgrest/blob/8618ffa5fc51ba43c8998f1acda013cc05ff5dc0/src/PostgREST/Types.hs#L87-L90">I just researched</a>, has the following options:</p><ul><li>“return=representation” — returns full record in the response.</li><li>“return=minimal” — no results returned.</li><li>empty — Default, no results returned.</li></ul><p>Now that I know… I plan to use “return=representation” from now on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L9_7bzq9AFh3n05xyaFpww.png" /></figure><p>For the ADD Request in Postman, you can rename the Request, set as POST, update BODY, click SEND and note the Response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s3k-C3KXKd7MRFRJ5pPs5Q.png" /><figcaption>Settings for ADD</figcaption></figure><p>If you run the GET again, you should see the new record(s) added</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlhKLhnQByliuvYe_gDCVQ.png" /><figcaption>Running GET again retrieves newly added records.</figcaption></figure><p>UPSERT *** Placeholder… we’ll come back to this in another post ***</p><p>UPDATE (use HTTP PATCH).. notice the parameter included “ident=eq.note-009”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*noYrv7V7p4TVKUMjuodA3g.png" /></figure><p>And DELETE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_YEvNT2RYV5k2_s4AItrmA.png" /><figcaption>Delete</figcaption></figure><p>OK? High Five! Now, let’s move on into Appsmith…</p><p>Appsmith is a low-cost alternative to Recode providing a low-code / no-code drag-and-drop web-based app creation tool. Very easy to <a href="https://docs.appsmith.com/">get started</a>. Appsmith has cloud and self-hosted options.</p><p>If you haven’t created an account on <a href="https://appsmith.com./">https://appsmith.com</a>, then do it! Then get signed in <a href="https://app.appsmith.com/user/login">https://app.appsmith.com/user/login</a>. Pretty simple to get started for free.</p><p>Once you get logged in… You’ll be on your appsmith home page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKCX1ZbVeBQ86vwGd6E5vA.png" /><figcaption>Appsmith Home Page (logged in)</figcaption></figure><p>Click Create new (Application option is the default). Create new Application. Let’s quickly breeze through the interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SMox2vRT-x-217r9QVhJg.png" /><figcaption>Appsmith Canvas</figcaption></figure><p>Here is more info on <a href="https://docs.appsmith.com/getting-started/tutorials/start-building">Getting Started in Appsmith</a>.</p><p>Create a Data Source to our Supabase instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DHZdvvjZVxKm33QKjE5vlg.png" /><figcaption>Create REST API Data Source in Appsmith</figcaption></figure><p>Before you can create a REST API query, you must first create a Data Source. Appsmith will guide you there. Rename the source to something you will recognize. Provide the Supabase URL that we confirmed in Postman. And Save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rU0lkNnqZj2EdFz-gNZrDQ.png" /><figcaption>Appsmith Create Data Source</figcaption></figure><p>Now create the GET query to retrieve our Notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5fFrUAsbkrDi-dTrd2yzw.png" /><figcaption>Appsmith Run Query (without Auth)</figcaption></figure><p>What about Authorization. Well… we could add standard Bearer Auth to the data source… However, when we get to Authorized User Sessions, we’ll override that. So, let’s add Authorization to each Query (instead of the to the Data Source)… in the request headers, there are two possible options: apikey and Authorization. For <a href="https://github.com/supabase/supabase/issues/28930">reasons that are discussed in depth online</a>, it seems that you should just use both (in my local installation, I just use Authorization. On my cloud installation, apikey works independently. STRANGE)… and moving on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZZfFQqrLscGUc5GiDss9A.png" /><figcaption>Appsmith Query with Supabase Auth</figcaption></figure><p>Now, let’s create the Notes_ADD query. Click the +. Change the Name. Set as “POST” when adding records. Use the same “/rest/v1/notes” in the URL request. Add JSON body. Use the same format returned in the Notes_GET. You can add multiples, too (using [ ] around the individual records). When you click Run, you’ll get result Status of 201 CREATED… but no data returned. Remember, by default, Add/Upd/Del doesn’t return data… Unless, you include header key “Prefer” with value “return=representation”. See the Response below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEyCfwz_LVN7kze_mDK8tw.png" /></figure><p>When we include header key “Prefer” with value “return=representation”, ADD, UPD, DEL will return the record(s) affected. See example below… also with multiple records included as optional in Body (bracketed with [ ]).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eaHwOYzavPpY6diwEHDm1g.png" /><figcaption>ADD Record</figcaption></figure><p>Update:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKHtCgH5oziZK8EAPIa-xg.png" /><figcaption>UPD Record</figcaption></figure><p>DELETE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8aubsR55LhjD-ZuD3fTHbw.png" /><figcaption>DEL Record</figcaption></figure><p>OK… now for Simple front-end… Go UI Canvas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnZJ5wPyuc9GO67--HDWkA.png" /><figcaption>Add Table to Canvas</figcaption></figure><ul><li>Add New UI element</li><li>Choose Table, Drag Table widget to Canvas</li><li>Click “Connect data”</li><li>Select Notes_GET query.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnZJ5wPyuc9GO67--HDWkA.png" /><figcaption>Add Table, Connect to GET Query</figcaption></figure><p>Next add a column with a Column Type of Icon Button, select trash icon. This will place a delete button on each row. Modify the onClick event to Execute the Notes_DEL Query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qq6a6RPfsVQDXxZVdPxu-A.png" /></figure><p>Next we’ll need to modify the DEL Query to recognize which row we want to delete. Use {{Table_Notes.triggeredRow.id}} in the Params list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*crzadXFs6n_Y4HZMbIQj5g.png" /></figure><p>You can then show Alerts on success / fail. And refresh the list using the Callback actions on the Table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCsgY8xMaowZx4jf26PEYQ.png" /></figure><p>Now to update the selected row. Create fields that reflect the selected row setting the “Default”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTExDZWgeJ8sVqGnYIxCmA.png" /></figure><p>Set Params to send to the UPD Query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEwpg5DPEh-VGj0vbvgw-Q.png" /></figure><p>Modify the body of the UPD Query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f-xRb5bIirbOoC0PrvujGg.png" /></figure><p>Modify the UPD Query to use the selected ID in the Params.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGEw3F8SkDjxX6LrlT3GFg.png" /></figure><p>And that’s it!! Cheers!… Next in Part 2, I’ll share how to create “generic” queries so that you don’t have to write individual CRUD queries for EVERY table in your database.</p><p>Connect with me on <a href="https://www.linkedin.com/in/markwoollen/">LinkedIn</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7a56c4792e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>