<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: James 'Dante' Midzi</title>
    <description>The latest articles on Forem by James 'Dante' Midzi (@psypher1).</description>
    <link>https://forem.com/psypher1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F778297%2F104e4184-3c67-4836-bf91-cc3c1b5d679a.jpeg</url>
      <title>Forem: James 'Dante' Midzi</title>
      <link>https://forem.com/psypher1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/psypher1"/>
    <language>en</language>
    <item>
      <title>Crypto Forge - Embracing Nuxt</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Tue, 06 Jan 2026 15:58:39 +0000</pubDate>
      <link>https://forem.com/psypher1/crypto-forge-embracing-nuxt-5ahh</link>
      <guid>https://forem.com/psypher1/crypto-forge-embracing-nuxt-5ahh</guid>
      <description>&lt;p&gt;I was out of commission for several months. During my time away I got time to refocus, recentre and work on my writing.&lt;/p&gt;

&lt;p&gt;When I was finally cleared one of the things I did was refresh my memory in several technology I had settled on. One of them was Nuxt, as I outlined in &lt;a href="https://dantedecodes.vercel.app/articles/how-svelte-5-made-me-understand-nuxt-2joj" rel="noopener noreferrer"&gt;this article&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;I am here to present to you &lt;strong&gt;&lt;a href="https://cryptoforge-nuxt.vercel.app/" rel="noopener noreferrer"&gt;Crypto Forge&lt;/a&gt;&lt;/strong&gt;- an app that lists cryptocurrencies and allows you to sort them in different ways.&lt;/p&gt;

&lt;p&gt;In essence it is a migration of Brad Traversy's project, &lt;a href="https://crypto-dash-two.vercel.app/" rel="noopener noreferrer"&gt;&lt;strong&gt;Crypto Dash&lt;/strong&gt;&lt;/a&gt; that was in React.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Recreate Instead of Building Something New?
&lt;/h2&gt;

&lt;p&gt;As I mention, I needed a refresher on a lot of the tools I had chosen. Rather than come up with a whole new ides, to dip my toes back in, I thought migrating something that is already working would be simpler than starting something completely from scratch. I do have ideas.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Learnt
&lt;/h2&gt;

&lt;p&gt;This exploration offered several learning opportunities, and entailed understanding what React was doing and translating that to Vue/Nuxt.&lt;/p&gt;

&lt;h3&gt;
  
  
  API Routes For Data Fetching
&lt;/h3&gt;

&lt;p&gt;Initially when I stated, I tried to fetch the data directly in the page. Upon further reading, and advice from the discord I learnt that it was recommended to use the &lt;code&gt;server&lt;/code&gt; folder and API routes to handle fetching of data.&lt;/p&gt;

&lt;p&gt;This helps in better managing server only parts of a Nuxt application. Using the server folder also helps in scalability and structuring of endpoints. &lt;/p&gt;

&lt;p&gt;While in this project I only made use of GET requests, in another one I am working I made full use of all the HTTP methods - it's a bit more complex.&lt;/p&gt;

&lt;p&gt;My usage looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//server/api/coin.get.js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineEventHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;$fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.coingecko.com/api/v3/coins/markets&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;vs_currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;usd&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;market_cap_desc&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;per_page&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;per_page&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;page&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;sparkline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;NOTE:&lt;br&gt;
Ideally the URL would be in an environment variable&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Composables To Avoid Logic Duplication
&lt;/h3&gt;

&lt;p&gt;A composable is a reusable function that performs some kind of logic. Say you needed to fetch user data for each page they visit on your app, rather that making that call every time, you would create a composable that does that.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//src/composables/useUser.js&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;useUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Shared, SSR-safe state&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


  &lt;span class="nx"&gt;aaync&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchUser&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;useFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;include&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// important for auth cookies&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;

      &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;fetchUser&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I made use of a composable to fetch the coin data. That piece of code is too long too share, you can view it in &lt;a href="https://github.com/Psypher1/crypto-forge" rel="noopener noreferrer"&gt;the repository&lt;/a&gt; though.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;I have already started work on my next project using Nuxt. I am still contemplating whether to make it public or not. Broadly, I need to get a authentication and connecting to the database fully functional. So in the next coming weeks, I just might release it to the wild.&lt;/p&gt;

&lt;p&gt;I am still fixing issues with my policies and &lt;a href="https://dantedecodes.vercel.app/articles/fortify-your-database-supabases-row-level-security-3fh8" rel="noopener noreferrer"&gt;row level security&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;This was a fun exploration to get me back into the swing of things. I got to learn new ways of doing things; which I would argue are better than the other technologies I have explored.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>vue</category>
      <category>api</category>
    </item>
    <item>
      <title>Laravel is How Development Should Be</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Mon, 31 Mar 2025 07:11:42 +0000</pubDate>
      <link>https://forem.com/psypher1/laravel-is-how-development-should-be-9ob</link>
      <guid>https://forem.com/psypher1/laravel-is-how-development-should-be-9ob</guid>
      <description>&lt;p&gt;I have not been doing that much writing. Not because I've nothing to write about, no. It's because I have been head down, silent and learning.&lt;/p&gt;

&lt;p&gt;I have been learning &lt;a href="https://laravel.com/" rel="noopener noreferrer"&gt;Laravel&lt;/a&gt;. If you read &lt;a href="https://dantedecodes.vercel.app/articles/why-sveltekit-will-be-my-goto-moving-forward-4abe" rel="noopener noreferrer"&gt;this article&lt;/a&gt; of mine you will recall I said I wouldn't reach for Laravel because I already use TYPO3. I had to walk back that statement when I realised while I have TYPO3, it is better suited to more involved projects.&lt;/p&gt;

&lt;p&gt;What changed? Well, I have a biggish project I am working on and I landed in a situation where SvelteKit wasn't sufficient and TYPO3 was too much. I needed a midpoint - and I was not going to go back to Nextjs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Laravel
&lt;/h2&gt;

&lt;p&gt;Instead of trying to rattle my head with something new, I chose to leverage the PHP that I already know. On another journey I went, and what a wondrous one it turned out to be.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Laravel Works?
&lt;/h3&gt;

&lt;p&gt;It just does.  In encounters that I have had with it, it shows a lot of thought went into creation of the framework. I don't know how to explain it, but it just does. Most things you may want to do, Laravel most likely has an in-built solution. Batteries included, I hear people say.&lt;/p&gt;

&lt;h4&gt;
  
  
  Authentication and Authorisation
&lt;/h4&gt;

&lt;p&gt;A thing that we all have to handle as developers is auth. In previous times I have always left this until the end because a number of the options were a headache to deal with.&lt;/p&gt;

&lt;p&gt;This is not the case with Laravel. You could choose to setup up the authentication flow on your own with code that sort of looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//validate&lt;/span&gt;
        &lt;span class="nv"&gt;$validatedAttributes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="s1"&gt;'first_name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'last_name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'email'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Password&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s1"&gt;'confirmed'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="c1"&gt;// create user&lt;/span&gt;
        &lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$validatedAttributes&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// log in&lt;/span&gt;
        &lt;span class="nc"&gt;Auth&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;//redirect&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/dashboard'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or you could pick on of the starters that handle this for you. Some of them adding a few features to the process.&lt;/p&gt;

&lt;p&gt;The same goes for authorisation. Based on how you want the access to things to be be you can specify the authorisation rules on the specific routes, app-wide or on individual controllers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// auth on a route&lt;/span&gt;
&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/jobs/{job}/edit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;JobController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'edit'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'auth'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;can&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'edit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'job'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// the policy that manages it&lt;/span&gt;
 &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;edit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;User&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;Job&lt;/span&gt; &lt;span class="nv"&gt;$job&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$job&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;employer&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Database Relations
&lt;/h4&gt;

&lt;p&gt;A thing that has given me trouble when building is database relations. I recall a time on one of the projects I was working on I got stuck trying to define database relations with Prisma. Some of it was because of how new I was at it. But even after I understood what was required the particular process manged to confuse me more.&lt;/p&gt;

&lt;p&gt;Laravel on the other hand is intuitive about relations. Yes, you have a couple of places you have to ensure you have handled. But that, I have found makes you consider things more deeply and pay close attention.&lt;/p&gt;

&lt;p&gt;Take for example; you have an Employers table and a Jobs table. Each Employer can have many Jobs. For that you would:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the relation in the migration file&lt;/li&gt;
&lt;li&gt;Define the relations in the respective model files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnk3kx46nsmuaqivewb1d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnk3kx46nsmuaqivewb1d.png" alt="Image description" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;Code snippets in this article are taken from my Learn Laravel in 30 days repository as well as the final project from that.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Appreciation
&lt;/h2&gt;

&lt;p&gt;I would also like to thank &lt;strong&gt;&lt;a href="https://x.com/jeffrey_way" rel="noopener noreferrer"&gt;Jeffrey Way&lt;/a&gt;&lt;/strong&gt; for making my journey into Laravel an enjoyable experience. I highly recommend the &lt;a href="https://www.youtube.com/watch?v=1NjOWtQ7S2o&amp;amp;list=PL3VM-unCzF8hy47mt9-chowaHNjfkuEVz" rel="noopener noreferrer"&gt;30 days to learn Laravel&lt;/a&gt; playlist.&lt;/p&gt;




&lt;h2&gt;
  
  
  What About SvelteKit?
&lt;/h2&gt;

&lt;p&gt;It's a very unfortunate thing really. I find myself in the position of having to walk back on things I said.&lt;/p&gt;

&lt;p&gt;A little while after I adopted Svelte, several changes were made that go against the simplicity I have been aiming for. As such, if I am to use SvelteKit now, it would be in the state that I found it in when I started and now. As for the time being, me and Sveltekit are taking a break.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;I never paid that much attention to Laravel and I regret that. However, at least I have seen the light.&lt;/p&gt;

&lt;p&gt;Although, I am not a fan of how the Laravel team are trying to streamline the project creation process. I don't like starters I didn't make is all.&lt;/p&gt;

&lt;p&gt;I have been doing a lot of walking back my statements recently, huh?&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>programming</category>
    </item>
    <item>
      <title>How Svelte 5 Made Me Understand Nuxt</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Thu, 27 Feb 2025 10:38:37 +0000</pubDate>
      <link>https://forem.com/psypher1/how-svelte-5-made-me-understand-nuxt-2joj</link>
      <guid>https://forem.com/psypher1/how-svelte-5-made-me-understand-nuxt-2joj</guid>
      <description>&lt;p&gt;I have gone on a journey. A long winding journey. A journey I could not have foreseen. As it would have it; I am back, once again, announcing  my change in methodologies and workflows. &lt;/p&gt;

&lt;p&gt;A lot has happened in the world of development and tech; from React and Next.js, to Lucia, to Laravel, to Astro. So much to talk about...&lt;/p&gt;

&lt;p&gt;One of those 'changes' has made go back to the drawing board yet again. Something I did not think I would have had to to do for about 3 to 5 years. Yet, here we are; me eating my words. Rather than having to answer question later down the line, I figured it would be simpler for me to talk about and explain my decisions.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Changes
&lt;/h2&gt;

&lt;p&gt;It all boils down to one thing really. One thing that has been made core and I cannot get with it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runes - My Friction Point
&lt;/h3&gt;

&lt;p&gt;I have read through the documentation, I watched the release videos. I have explored the &lt;em&gt;new&lt;/em&gt; way. After all that, I will never accept the runes syntax. My brain will not find synergy.&lt;/p&gt;

&lt;p&gt;This - whatever this way is - is in opposition of all the reasons I gravitated towards Svelte and Sveltekit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$state&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;double&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$derived&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;$effect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;elapsed&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I understand all of it, I get what they were trying to accomplish. I just don't like it. It is too indicative of React; and I left React ages ago.&lt;/p&gt;

&lt;p&gt;I left the &lt;code&gt;useState&lt;/code&gt; and &lt;code&gt;useEffect&lt;/code&gt; of React because they wound up complicating what should have been simple. The runes syntax of Svelte feels a little to similar to React and I have no intention of writing that kind of code again. Regardless of how 'better' it may be.&lt;/p&gt;

&lt;p&gt;For me there was something elegant about Svelte's &lt;code&gt;$:&lt;/code&gt; syntax. It was simple, straightforward and easy enough to understand. It wasn't perfect, but it worked.&lt;/p&gt;

&lt;h4&gt;
  
  
  Then Snippets...
&lt;/h4&gt;

&lt;p&gt;To be able to have and reuse chunks of code. Sounds cool on paper, but looking at the code and the implementation, it feels too much like a React way of doing things. There are &lt;strong&gt;waaaaay&lt;/strong&gt; to many symbols for my liking. This is horrible to look at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`it's great to see you!`&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$props&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;snippet&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sr"&gt;/snippet&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;
&lt;span class="p"&gt;{@&lt;/span&gt;&lt;span class="nd"&gt;render&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="p"&gt;{@&lt;/span&gt;&lt;span class="nd"&gt;render&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bob&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Nuxt
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://dantedecodes.vercel.app/articles/why-sveltekit-will-be-my-goto-moving-forward-4abe" rel="noopener noreferrer"&gt;an article&lt;/a&gt;, where I sang the praises of SvelteKit, I said that I didn't like Nuxt and how it did templating.&lt;/p&gt;

&lt;p&gt;With the looming arrival of Svelte 5, I revisited decisions I had made earlier. I realised that a lot of what I was complaining about had to do with my misunderstanding. I got over those misconceptions and learnt, built and migrated some projects. &lt;/p&gt;

&lt;p&gt;A few things that finally won me over were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File-Based Routing&lt;/strong&gt;: Nuxt implements file based routing, not directory based - I have &lt;a href="https://dantedecodes.vercel.app/articles/file-based-vs-directory-based-routing-understanding-the-difference-30mp" rel="noopener noreferrer"&gt;an article&lt;/a&gt; on this. I have always been partial to file-based routing. I only tolerated SvelteKit's directory approach because everything else is simple.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto Imports&lt;/strong&gt;: In most frameworks if you wish to import something into a file, you usually have an import statement at the top. This is not the case with Nuxt&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Separation of Concerns&lt;/strong&gt;: I mentioned this in that same article; how I was not a fan of Next.js placing everything in a single directory. Nuxt doesn't have that problem - everything has its specified place

&lt;ul&gt;
&lt;li&gt;Pages&lt;/li&gt;
&lt;li&gt;Layouts&lt;/li&gt;
&lt;li&gt;Middleware&lt;/li&gt;
&lt;li&gt;Server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Modules&lt;/strong&gt;: So the Nuxt people have modules, modules upon modules to things you may want to add to your project; icons, SEO, sitemaps, fonts. Nuxt probably has a module for that. Reminds me of Astro integrations - I love those.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;I was wrong about Nuxt, I admit that.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;I guess that's the beauty of being a developer and an adult; the ability to choose what I use and what I don't. If I am not happy in what I am doing and what I am doing it with, I will rarely ever invest that much commitment into it - this is where I have arrived with Svelte - I am not happy, I feel I am moving backwards.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>nuxt</category>
      <category>svelte</category>
      <category>sveltekit</category>
    </item>
    <item>
      <title>You Don't Need The Flex</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Mon, 27 Jan 2025 12:04:52 +0000</pubDate>
      <link>https://forem.com/psypher1/you-dont-need-the-flex-42km</link>
      <guid>https://forem.com/psypher1/you-dont-need-the-flex-42km</guid>
      <description>&lt;p&gt;I find it very amusing that this is going to be my first post of the year. But it has bothered me enough that I must speak about it. &lt;/p&gt;

&lt;p&gt;No one can deny the godsend that tailwind has been. We are able to prototype faster and get things done quickly.&lt;/p&gt;

&lt;p&gt;I have noticed in the upsurge of Tailwind, has come with a forgetting and overlooking of some properties inherent in CSS and HTML.&lt;/p&gt;




&lt;h2&gt;
  
  
  Block and Inline Elements
&lt;/h2&gt;

&lt;p&gt;Yes, I am afraid we have to go there...&lt;/p&gt;

&lt;h3&gt;
  
  
  Block-Level Element
&lt;/h3&gt;

&lt;p&gt;I actually fail to understand how people forgot about the block element aspect of HTML. I see someone doing this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"flex flex-col"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;One&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Two&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Three&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And all they wanted to do was have elements one after each other - stack them. They already do that! That is what HTML inherently does. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Block-level elements always start a new line.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yes, of course I understand there are certain instances where you want your element to only take up as little space as possible - what &lt;code&gt;flex&lt;/code&gt; does - but paying attention to what they have done, that is &lt;strong&gt;rarely&lt;/strong&gt; the case.&lt;/p&gt;

&lt;p&gt;Have a gander a some block elements&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;section&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;-&lt;span class="nt"&gt;&amp;lt;h6&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To quote something Kevin Powell said (I am paraphrasing):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Don't undo the styling and then end up redoing it again. Use the HTML to your advantage"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Inline-Level Element
&lt;/h3&gt;

&lt;p&gt;For posterity, it is only right I talk about inline elements as well. In HTML, there are certain elements that are not block. These elements only take up as much width as necessary. As such you can place them side by side - they do not naturally stack.&lt;/p&gt;

&lt;p&gt;Some inline elements you are familiar with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;img&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;input&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;    &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;So next time you are trying to stack elements, don't just rush to add &lt;code&gt;flex&lt;/code&gt;. Put your elements on the page and see if they stack as you want. Unhand the flex and think about what you want your resulting outcome to be.&lt;/p&gt;

&lt;p&gt;And if what I said, doesn't make sense, here is a link to &lt;a href="https://www.w3schools.com/html/html_blocks.asp" rel="noopener noreferrer"&gt;w3schools&lt;/a&gt; with examples you can play around with.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>css</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Your Constant Quest For Productivity May Be Hurting You</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Wed, 17 Jul 2024 12:26:44 +0000</pubDate>
      <link>https://forem.com/psypher1/your-constant-quest-for-productivity-may-be-hurting-you-631</link>
      <guid>https://forem.com/psypher1/your-constant-quest-for-productivity-may-be-hurting-you-631</guid>
      <description>&lt;p&gt;I have been head down working on several things. During the time I found myself accomplishing a lot of what I had set out to. Accomplishing a lot more than I would previously. What changed?&lt;/p&gt;

&lt;p&gt;Let me take you on a journey...&lt;/p&gt;

&lt;p&gt;A number of the decisions I took towards the end of the previous year began to pay dividend. These included my stepping away from React and that ecosystem. Changing how I go about accomplishing the things I set out to. Elimination of things from my life and avoidance of others.&lt;/p&gt;

&lt;p&gt;Anyway, I digress...&lt;/p&gt;

&lt;p&gt;Let's talk productivity...&lt;/p&gt;




&lt;h2&gt;
  
  
  Productivity
&lt;/h2&gt;

&lt;p&gt;You will be hard pressed to not encounter someone talking about productivity this or productivity that. Be it an app, a book or some system that has 'increased their productivity'. Everyone and their grandma is on some tool, some book, some extension or some keyboard shortcuts to increase productivity - and it never ends. There is always going to be something, there is always something and there will always be something.&lt;/p&gt;

&lt;p&gt;One of the things I did, or rather didn't do, was stop hunting down tools and methods to 'achieve ultimate productivity'. A realisation hit me; I asked myself; with all this focus on creating the most productive work environment, is anything actually getting done?&lt;/p&gt;

&lt;p&gt;Why that question specifically? It boils down to an insight I had while I was reading and taking in the words in my own time. In it, our guide said something that made me stop and think. It was something to effect of:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The only thing you have the power to control is you. And as long as you are controlled by external forces, you will not be free.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Which in turn got me thinking; all this 'productivity' everyone is stuck in endless loops in search of, who is it for? Does anyone really want to be productive, or do they want to look like they're being productive? I have to admit, at a point I was guilty of the latter.&lt;/p&gt;

&lt;p&gt;That choice, that simple decision of asking myself; this that I am doing, is it helping me in any way? Is it aiding me getting to my keystones in any way? When I answered those questions honestly, a shift in my mindset occurred. I did away with all the hype and zeroed in on what was important to me.&lt;/p&gt;




&lt;h2&gt;
  
  
  The More You Look for Productivity, the Less You Accomplish
&lt;/h2&gt;

&lt;p&gt;That was the observation, the conclusion I came to. Every minute, every second spent on trying to and looking for ways to be 'productive' was a minute spent on not getting anything done. Simple as that. There is no hidden tool, special book or supposed system that will get you to be more 'productive'. &lt;/p&gt;

&lt;p&gt;The change that needs to happen is you, within you. Once your mind is set right and your focuses are correctly aligned, things will begin to work smoothly and you will attain that 'productivity' that you've been feverishly hunting. &lt;/p&gt;

&lt;p&gt;Contrary to what you might have been lead to believe, there is such a thing as too much 'productivity'.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Forget the productivity tools, forget the books, forget the systems. Do the work, accomplish the task. Quiet the noise. Productivity is not some magic pill you can stumble upon, it is a shift in mindset. Wrap your head around that, and stop hunting for magic geese.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>focus</category>
      <category>mindset</category>
    </item>
    <item>
      <title>Say Hello To shrinkat - A Tiny URL Shortener</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Mon, 15 Apr 2024 14:48:38 +0000</pubDate>
      <link>https://forem.com/psypher1/say-hello-to-shrinkat-a-tiny-url-shortener-310k</link>
      <guid>https://forem.com/psypher1/say-hello-to-shrinkat-a-tiny-url-shortener-310k</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;TLDR&lt;br&gt;
I made a link shortener. The goal was to learn the Pocketbase API and see if it could be viable for some smaller projects I build in the future.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is really not much to say here. I wanted to implement an entirely localised solution to building something&lt;/p&gt;




&lt;h2&gt;
  
  
  Technologies I Used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;SvelteKit (of course)&lt;/li&gt;
&lt;li&gt;Pocketbase &lt;sup id="fnref1"&gt;1&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;TailwindCss&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learnt
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How authentication works with Pocketbase: It's quite different from how something like Supabase handles it.&lt;/li&gt;
&lt;li&gt;Data modelling: Being sqlite, the way I had to think about data needed a slight shift in mindset.&lt;/li&gt;
&lt;li&gt;Working with the Pocktebase sqlite database: Working with a barebones database was actually really fun.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Here Are Some Screenshots
&lt;/h2&gt;

&lt;p&gt;Here is the homepage:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30hr71ggkairt2ody7yi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30hr71ggkairt2ody7yi.jpg" alt="home page unauthed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is what a logged in user sees:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yeibll398akcpg2yzzz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yeibll398akcpg2yzzz.jpg" alt="logged in user"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;This was a fun little thing to build. I learnt quite a bit. There is definitely a place for Pocketbase in my  off the cuff build.&lt;/p&gt;

&lt;p&gt;My one gripe is deploying this database is not simple, not in the slightest.  And no, Docker does not count - I do not use those dark arts.&lt;/p&gt;

&lt;h3&gt;
  
  
  The code
&lt;/h3&gt;

&lt;p&gt;The code for shrinkat is available on GitHub. Fork it, make it your own, create pull requests...&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://github.com/meerkat-collective/shrinkat" rel="noopener noreferrer"&gt;https://github.com/meerkat-collective/shrinkat&lt;/a&gt;
&lt;/h2&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;Testing  ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>svelte</category>
      <category>sveltekit</category>
      <category>pocketbase</category>
      <category>url</category>
    </item>
    <item>
      <title>Rendering External Markdown in Astro</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Wed, 07 Feb 2024 14:30:34 +0000</pubDate>
      <link>https://forem.com/psypher1/rendering-external-markdown-in-astro-46oj</link>
      <guid>https://forem.com/psypher1/rendering-external-markdown-in-astro-46oj</guid>
      <description>&lt;p&gt;It seems like I'm always writing the same article... 😂&lt;/p&gt;

&lt;p&gt;I enjoy Astro, it's a good framework, but there is one thing about it or rather the docs that irks me.&lt;/p&gt;

&lt;p&gt;Astro is pitched as a content first framework with native markdown support. That's what they say. However, this isn't &lt;em&gt;completely&lt;/em&gt; the case.&lt;/p&gt;

&lt;p&gt;When it comes to markdown that is local to your project, Astro does absolute wonders with the rendering and parsing. Your problems arise when you have your markdown from an external source i.e. a CMS. The docs have been structured in such a way that they want you to use local markdown and Content Collections.&lt;/p&gt;

&lt;p&gt;But sometimes, your markdown is somewhere else. What is one to do then?&lt;/p&gt;

&lt;p&gt;Let's go on a journey shall we? ...&lt;/p&gt;

&lt;h2&gt;
  
  
  The Scenario
&lt;/h2&gt;

&lt;p&gt;You use Hygraph as your CMS for your articles. You write your articles in markdown, and you can fetch them and all their data. What you want to do is have your articles rendered on your newly created Astro site.&lt;/p&gt;

&lt;p&gt;The requirements for this task are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It needs to be &lt;strong&gt;one&lt;/strong&gt; thing - a package or whatever - that you import and use.&lt;/li&gt;
&lt;li&gt;You don't want to have to configure any additional things.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before I give you the solutions that I think are best, I challenge you to find the solution within the Astro docs. I'll wait...&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution(s)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Markdown Component (deprecated)
&lt;/h3&gt;

&lt;p&gt;I fought with this a while back when Astro was still in v1, and in those times, there was a package called &lt;code&gt;@astrojs/markdown-components&lt;/code&gt;. That package has long since been deprecated, as such you won't be able to install it.   &lt;/p&gt;

&lt;p&gt;For reference, this is how that would look (those who read my &lt;a href="https://dantedecodes.vercel.app/articles/how-to-display-devto-posts-on-an-astro-site-3icm"&gt;Displaying Dev.to Post on Your Astro Site&lt;/a&gt;  article will be familiar with this code.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- /articles/[slug].astro --&amp;gt;&lt;/span&gt;
---
import Markdown from "@astrojs/markdown-component";

export async function getStaticPaths() {
  const articles = await fetchArticles();

  return articles.map((article) =&amp;gt; {
    return {
      params: { slug: article.slug },
      props: { article },
    };
  });
}

const {article} = Astro.props;
const {body_markdown}  = article;
---

&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Markdown&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;{body_markdown}&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A wise man once said, "If it ain't broke, don't fix it." &lt;/p&gt;

&lt;p&gt;My site has been working well with this package, and because of that, I will not upgrade it to a higher version as I am not in the mood to do the dance again.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h5&gt;
  
  
  Now, let's head on to the stuff that works with newer versions of Astro.
&lt;/h5&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Astro Pub
&lt;/h3&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/astro-community/md"&gt;https://github.com/astro-community/md&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation &amp;amp; Usage
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @astropub/md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- /articles/[slug].astro --&amp;gt;&lt;/span&gt;
---
import Markdown from "@astrojs/markdown-component";

export async function getStaticPaths() {
    ...
}

const {article} = Astro.props;
const {body_markdown}  = article;
---

&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Markdown&lt;/span&gt; &lt;span class="na"&gt;of=&lt;/span&gt;&lt;span class="s"&gt;{body_markdown}&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Currently as of writing this, AstroPub requires  &lt;code&gt;astro@^3.0.0&lt;/code&gt; to work smoothly.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Thoughts
&lt;/h4&gt;

&lt;p&gt;If I had no choice, but to fight this battle again, this is the method I would choose.&lt;/p&gt;




&lt;h3&gt;
  
  
  Markdown-it
&lt;/h3&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/markdown-it/markdown-it"&gt;https://github.com/markdown-it/markdown-it&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation &amp;amp; Usage
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;markdown-it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- /articles/[slug].astro --&amp;gt;&lt;/span&gt;
---
import markdownit from "markdown-it";
const md = markdownit();

export async function getStaticPaths() {
 ...
}

const {content_markdown} = Astro.props
---

&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Fragment&lt;/span&gt; &lt;span class="na"&gt;set:html=&lt;/span&gt;&lt;span class="s"&gt;{md.render(content_markdown)}&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Markdown-it also requires &lt;code&gt;astro ^3.0.0&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Thoughts
&lt;/h4&gt;

&lt;p&gt;I don't like this method. I don't like it because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I have to declare a variable to store markdown-it.&lt;/li&gt;
&lt;li&gt;I have to use the &lt;code&gt;set:html&lt;/code&gt; to render the content.&lt;/li&gt;
&lt;li&gt;I have to additionally call the render function and then pass my content to it.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Astro Remote
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update: 29 February 2024&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
After submitting an issue, Nate added the install command.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/natemoo-re/astro-remote"&gt;https://github.com/natemoo-re/astro-remote&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation &amp;amp; Usage
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;astro-remote
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- /articles/[slug].astro --&amp;gt;&lt;/span&gt;
---
import {Markdown} from "astro-remote";

export async function getStaticPaths() {
 ...
}

const {content_markdown} = Astro.props
---

&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Markdown&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;{body_markdown}&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Thoughts
&lt;/h4&gt;

&lt;p&gt;Astro Remote works very similarly to Astro Pub, and I like that about it.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Thing About Marked
&lt;/h3&gt;

&lt;p&gt;If you did accept my challenge and looked in the docs, you might have found this section:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.astro.build/en/guides/markdown-content/#fetching-remote-markdown"&gt;Fetching Remote Markdown&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Astro docs recommend &lt;strong&gt;marked&lt;/strong&gt;, but there's some things you have to be aware of with marked. &lt;/p&gt;

&lt;p&gt;Marked Site: &lt;a href="https://marked.js.org/"&gt;https://marked.js.org/&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Thoughts
&lt;/h4&gt;

&lt;p&gt;Marked informs you on their site that it does not sanitise your markup. Do with that information what you will.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Astro -  a brilliant little thing. A bit more care with regard to this part of their framework/documentation would be cool. At least as much care as is given to other parts of the docs.&lt;/p&gt;

&lt;p&gt;On a steam, &lt;a href="https://twitter.com/whitep4nth3r"&gt;whitep4nth3r&lt;/a&gt; went on a journey of trying to find this information on stream, her goal was to use things the 'Astro way. In the end, she went with the markdown-it approach.&lt;/p&gt;

&lt;p&gt;The stream if you are curious. It's at 3hrs 57 minutes: &lt;a href="https://www.twitch.tv/videos/1998429304?filter=archives&amp;amp;sort=time"&gt;https://www.twitch.tv/videos/1998429304?filter=archives&amp;amp;sort=time&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>astro</category>
      <category>markdown</category>
      <category>external</category>
    </item>
    <item>
      <title>Why SvelteKit Will Be My Goto Moving Forward</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Mon, 04 Dec 2023 13:00:00 +0000</pubDate>
      <link>https://forem.com/psypher1/why-sveltekit-will-be-my-goto-moving-forward-4abe</link>
      <guid>https://forem.com/psypher1/why-sveltekit-will-be-my-goto-moving-forward-4abe</guid>
      <description>&lt;p&gt;Allow me to tell you a tale, take you on a journey of how I switched how I work completely and I am probably not going back...&lt;/p&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;Anyone who knows me and has been following my journey is aware that my development focuses consist of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;PHP (TYPO#3)&lt;/li&gt;
&lt;li&gt;React/Next.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What this has allowed me to do is be more efficient at picking the correct tool for the things I'll be trying to accomplish.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Then
&lt;/h2&gt;

&lt;p&gt;It's no secret that I have been an advocate of Next.js for some time. I even have a short series I did investigating how to integrate it with different Headless CMS. I have done explorations on the features I believed people should know in regards to Next. As such me and Next have been on very good terms for a while.&lt;/p&gt;

&lt;h3&gt;
  
  
  Breaking Up With Next
&lt;/h3&gt;

&lt;p&gt;Put simply two words - &lt;strong&gt;&lt;em&gt;App Router&lt;/em&gt;&lt;/strong&gt;. I am not sure what the team at Vercel was in a hurry to get to, but they rushed this like I've never seen before. With me, if anything is pushed on me that hard, I form a natural aversion towards it; see one of my &lt;a href="https://dantedecodes.vercel.app/articles/typesafe-an-overused-term-that-needs-a-reality-check-5ho0" rel="noopener noreferrer"&gt;previous articles&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Lie of &lt;code&gt;Stable&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;While they may have made it stable now, when a lot of the &lt;em&gt;features&lt;/em&gt; of the router were introduced they weren't ready; despite what they liked you to believe.&lt;/p&gt;

&lt;p&gt;I could go on and on about the things that were reportedly stable, but that's not the point of the article. What I will do is tell you my main pain points.&lt;/p&gt;

&lt;p&gt;Clear boundaries or lack thereof:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One of the things I liked about Next.js was that there were clear boundaries; your &lt;strong&gt;pages&lt;/strong&gt; go here, your &lt;strong&gt;assets&lt;/strong&gt; go here, API routes go here. That is all but gone, with the brunt of the things happening in the app folder.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Having to add pieces of text to change how your file/component works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This sort of relates to my first point; the adding of &lt;code&gt;'use client'&lt;/code&gt; or &lt;code&gt;'use server'&lt;/code&gt; within a file does not sit well with me. There is something elegant about &lt;code&gt;getStaticProps&lt;/code&gt; and &lt;code&gt;getServerSideProps&lt;/code&gt;; you knew exactly where your data was coming from and how it would be rendered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will not even get started on the actions, sorry server actions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes, I know I can still use Next.js the way I prefer, but the mob makes so much noise I would just rather maintain the project I have the way they are and just not deal with this &lt;em&gt;new&lt;/em&gt; way.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Now
&lt;/h2&gt;

&lt;p&gt;After all the noise with Next.js I went on a journey to find something else that would meet my needs and not lie to me. My journey led me to several options; ones that did things better than Next.js, others not so much. Here is a very brief rundown:&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Laravel&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Considering I already use PHP in the form of TYPO3. I didn't go that way because I already got a sufficient dose of PHP. Also, I wouldn't randomly whip out TYPO3 for any 'ol project.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Vue/Nuxt&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;What put me off of &lt;em&gt;Vue/Nuxt&lt;/em&gt; was mainly their templating engine. It just didn't sit well with me; the particular way the files in it are written. Also, something about its routing felt iffy.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Solid&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;This would have been going back to a version of React/Nextjs type framework. I wouldn't learn as much as I would like. Also things would still be abstracted from me, I was trying to avoid that.&lt;/p&gt;




&lt;h3&gt;
  
  
  Enter Svelte
&lt;/h3&gt;

&lt;p&gt;Long ago, I tried to dabble in Svelte, but that was in my naive and hard-headed days and never took the time to understand what it required of me. Additionally, I tried to do it alongside another person and that did not go well. This time instead, I chose to knuckle down and get into what made Svelte Svelte; the changes in mindset I would need to undertake for this part of my journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding Synergy
&lt;/h3&gt;

&lt;p&gt;I am not going to lie, the move to SvelteKit was not seamless. A lot of shift in mindset was required&lt;/p&gt;

&lt;p&gt;To start the &lt;a href="https://dantedecodes.vercel.app/articles/file-based-vs-directory-based-routing-understanding-the-difference-30mp" rel="noopener noreferrer"&gt;&lt;strong&gt;directory-based routing&lt;/strong&gt;&lt;/a&gt; and wrapping my head around the &lt;code&gt;+page.svelte&lt;/code&gt; naming convention was a bit confusing to get comfortable with. Afterwards; understanding how working with data was accomplished and what the &lt;code&gt;+page.js&lt;/code&gt; and &lt;code&gt;+page.server.js&lt;/code&gt; files did, and where I used each.&lt;/p&gt;

&lt;p&gt;Understanding those things would aid me greatly in grasping how SvelteKit works and how I should approach my journey with it. With determination in my heart and a vantage point I was aimed at, I went to work.&lt;/p&gt;

&lt;p&gt;And then, it clicked! &lt;/p&gt;

&lt;p&gt;During the struggling, the change in mindset and embracing the power of native HTML and how SvelteKit leverages that, it clicked. Sticking to it paid off and my new home had been found and solidified.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I Like About SvelteKit
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Native HTML&lt;/strong&gt;: It strips away the abstraction; no virtual DOM or anything of the kind. It's all just native HTML. Because of that your elements work the way they were intended.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Things are defined clearly&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;+page.svelte&lt;/code&gt;: is your frontend stuff what you see when a page loads. Basically the crux of what a user sees when they visit your site/app.
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;+page.js&lt;/code&gt; / &lt;code&gt;+page.server.js&lt;/code&gt;: this is where you load data to be displayed on your pages, and where your form actions run.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;+layout.svelte&lt;/code&gt;: this applies styling and/or data to set of routes under the same directory.
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;+layout.js&lt;/code&gt; / &lt;code&gt;+layout.server.js&lt;/code&gt;: allows you to specify data you want applied to an entire set of routes. In essence, the higher level of your &lt;code&gt;page.server.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Form actions&lt;/strong&gt;: With it leveraging the native HTML means it takes advantage of all the functionality already present with forms. This means that nothing is hidden from you; what you can do in a form on a basic page, you can do with Sveltekit.  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;progressive enhancement&lt;/em&gt;: since we leverage the default functionality of forms, they will reload the page on a submit. Progressive enhancement gives us the ability to utilise the submit action without making the entire page reload.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes sure, Next.js might have now implemented some of this in their new version, but with SvelteKit it feels a lot more thought out and not rushed.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;All in all, I actually thank Vercel for taking the approach they did. I would not have rediscovered Sveltekit otherwise. In addition, it helps in my goal of stripping away complexity that I talked about in these articles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dantedecodes.vercel.app/articles/fortify-your-database-supabases-row-level-security-3fh8" rel="noopener noreferrer"&gt;Row Level Security&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dantedecodes.vercel.app/articles/automate-database-processes-supabase-triggers-2dla" rel="noopener noreferrer"&gt;Supabase Triggers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;And that's the journey; How an advocate of Next.js was not impressed by the direction it took and moved to SvelteKit. Thereby finding a better way, a more honest way, a streamlined way of doing things. A way he is much happier with.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>sveltekit</category>
      <category>complexity</category>
      <category>simplicity</category>
    </item>
    <item>
      <title>File-Based vs. Directory-Based Routing: Understanding the Difference</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Fri, 24 Nov 2023 18:57:41 +0000</pubDate>
      <link>https://forem.com/psypher1/file-based-vs-directory-based-routing-understanding-the-difference-30mp</link>
      <guid>https://forem.com/psypher1/file-based-vs-directory-based-routing-understanding-the-difference-30mp</guid>
      <description>&lt;p&gt;I don't know who did it, and why everyone is suddenly confused by this. What you are calling file-based routing is not what you claim. I will gladly explain.&lt;/p&gt;

&lt;p&gt;I am going to use Next.js as an example:&lt;/p&gt;

&lt;h3&gt;
  
  
  File Based
&lt;/h3&gt;

&lt;p&gt;This is file-based routing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;src/
└── pages/
    ├── index.js
    ├── about.js
    └── contact.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the folder that defines your pages, if you are able to create a file in there and it automatically becomes a page (contact, about, services etc) that is file based routing.&lt;/p&gt;

&lt;p&gt;File-based routing is a routing where the entry point to your routes is an index file. What that mean is the same way you can have a &lt;code&gt;contact.jsx&lt;/code&gt; , you could also make a &lt;code&gt;contact/index.js&lt;/code&gt; and these two would do exactly the same with little to no issues.&lt;/p&gt;

&lt;p&gt;Frameworks that employ this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Astro&lt;/li&gt;
&lt;li&gt;Eleventy&lt;/li&gt;
&lt;li&gt;Nextjs (with pages)s&lt;/li&gt;
&lt;li&gt;Vue&lt;/li&gt;
&lt;li&gt;Svelte &lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Directory Based
&lt;/h3&gt;

&lt;p&gt;This is directory based routing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;src/
└── app/
    ├── page.js
    ├── about/
    │   └── page.js
    └── contact/
        └── page.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this way, there is a defined method of creating new pages i.e a folder with the file name and a special file within it.&lt;/p&gt;

&lt;p&gt;When using this way, anything that does not follow this pattern is not regarded a page.&lt;/p&gt;

&lt;p&gt;Frameworks that use this&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nextjs (with app)&lt;/li&gt;
&lt;li&gt;SvleteKit&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  A Table To Know What You Are Using
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ask&lt;/th&gt;
&lt;th&gt;File-Based Routing&lt;/th&gt;
&lt;th&gt;Directory-Based Routing&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Can I make a file name as a route and it works?&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can I create a folder with an &lt;code&gt;index&lt;/code&gt; file and that will become the page?&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Do I have a special naming convention for pages?&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With this clarification at hand, can you all stop confusing this? You can? Thank you.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>routing</category>
      <category>filebased</category>
      <category>directorybased</category>
    </item>
    <item>
      <title>Typesafe - An Overused Term That Needs a Reality Check</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Fri, 17 Nov 2023 18:04:42 +0000</pubDate>
      <link>https://forem.com/psypher1/typesafe-an-overused-term-that-needs-a-reality-check-5ho0</link>
      <guid>https://forem.com/psypher1/typesafe-an-overused-term-that-needs-a-reality-check-5ho0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article is &lt;strong&gt;rant&lt;/strong&gt;. Nothing more, nothing less. A rant.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Of all the internet &lt;em&gt;hype words&lt;/em&gt;, this one really gets on my nerves. I didn't mind initially, but now - it is EVERYWHERE!!!&lt;/p&gt;

&lt;p&gt;Every place I turn, be it articles or YouTube videos, someone is going on and on about typesafe this or typesafe that. I am at a point where it is virtually impossible for someone doing things related to web development to not mention typesafe.&lt;/p&gt;

&lt;p&gt;I hear people saying typesafety makes the web better. It doesn't, not really. Because all the problems pointed to in favour of this still exist regardless. The actual problem isn't JavaScript or its lack of types, no - it is people not adequately learning JavaScript correctly and then blaming the language.&lt;/p&gt;

&lt;p&gt;And It's not that I have an issue with typesafety, no. I use several strictly typed languages all the time. It's the fact that y'all won't shut up about it that's annoying me. I get it, move on, there's better things to do - things to be shipped.&lt;/p&gt;

&lt;p&gt;We are at a point at which people are no longer writing good code, but typesafe code. Because that's the focus - typesafe code, not working code. I personally see this as a bad thing as we are moving further and further away from the fundamentals. The &lt;strong&gt;fundamentals&lt;/strong&gt;. Remember those? the building blocks - the foundations - that meant you understood why things happen the way they do.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Makes Me So Confident?
&lt;/h2&gt;

&lt;p&gt;For a good 5 months, I watched a developer much more experienced than I and several of the people preaching this typesafety mantra build consistently without it. He built and took to production in JavaScript. How? Because he understood the &lt;strong&gt;core fundamentals&lt;/strong&gt; of the language he was using.&lt;/p&gt;

&lt;p&gt;Here is an example, say you were making an input component in React:&lt;/p&gt;

&lt;p&gt;What you and your ilk would have done:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;}){&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;versus&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What he would do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So if anything what you have succeeded in doing is making sure I do not conform to this typesafe noise.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If any one of you comes to this and says it's necessary, I'm reporting you for antagonising me.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If you noticed, I have a conscientious attempt to not mention the offending language itself specifically. Or the superset around whatever as they said when they were convincing you all to fall in line.&lt;/p&gt;

&lt;p&gt;Here's the thing, if y'all didn't push this typesafe agenda so much I might have gotten with it. Right now, it's just too much and I am tired.&lt;/p&gt;

&lt;p&gt;I promise you, if this current state of things was my introduction to development I would have stopped and pursued other ventures. Matter of fact, I am getting closer and closer to doing so.&lt;/p&gt;

&lt;p&gt;You and your typesafety can go hang. I don't want it. I am going to be focusing on my open-source commitments.&lt;/p&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;LEARN THE LANGUAGE AND WHAT IT REQUIRES! STOP TRYING TO FIT IT TO WHAT YOU ARE USED TO!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Side Note
&lt;/h2&gt;

&lt;p&gt;Another thing that's exacerbating me could possibly be that I just finished reading &lt;strong&gt;&lt;a href="https://www.goodreads.com/book/show/61439040-1984?ac=1&amp;amp;from_search=true&amp;amp;qid=eZRinv2clE&amp;amp;rank=1"&gt;1984&lt;/a&gt;&lt;/strong&gt; and the mind control in it is oddly indicative of all of this.&lt;/p&gt;



&lt;blockquote&gt;
&lt;p&gt;Yes. I have animosity towards your typesafety. I didn't before, I do now.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>rant</category>
      <category>fundamentals</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Automate Database Processes: Supabase Triggers</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Tue, 17 Oct 2023 13:12:33 +0000</pubDate>
      <link>https://forem.com/psypher1/automate-database-processes-supabase-triggers-2dla</link>
      <guid>https://forem.com/psypher1/automate-database-processes-supabase-triggers-2dla</guid>
      <description>&lt;p&gt;This article follows my &lt;a href="https://dantedecodes.vercel.app/articles/fortify-your-database-supabases-row-level-security-3fh8"&gt;Row Level Security&lt;/a&gt; one ...&lt;/p&gt;

&lt;p&gt;As I was doing my tests I came across an issue whereby the &lt;code&gt;user_data&lt;/code&gt; table wasn't created if there was an issue with connectivity. The &lt;code&gt;upsert&lt;/code&gt; that I was trying to run wouldn't fire.&lt;/p&gt;

&lt;p&gt;That got me thinking; the profiles table gets created when a user signs up, right? Something, somewhere is being automated to accomplish that. But how?  &lt;/p&gt;

&lt;p&gt;So, I went on another adventure...&lt;/p&gt;

&lt;p&gt;I went searching in my project to see what had been done when I was following the &lt;a href="https://supabase.com/docs/guides/getting-started/tutorials/with-sveltekit"&gt;guide&lt;/a&gt; that I was using as a starting point. What I discovered was really interesting. The starter that I used from the guide - User Management -  created a function. What that function does is create a profiles table row and populates it with certain fields.  &lt;/p&gt;

&lt;p&gt;That looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;begin&lt;/span&gt;
  &lt;span class="k"&gt;insert&lt;/span&gt; &lt;span class="k"&gt;into&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;full_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;avatar_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;values&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;raw_user_meta_data&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="s1"&gt;'full_name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;raw_user_meta_data&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="s1"&gt;'avatar_url'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this knowledge, I went digging further and found out that functions are the first key to the puzzle I was trying to solve, the other being triggers.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Are Triggers?
&lt;/h3&gt;

&lt;p&gt;Triggers allow us to watch database events (insert, update, delete) and call a function whenever they occur, allowing us to automate functionality in our database while keeping our data in sync.   &lt;/p&gt;




&lt;h2&gt;
  
  
  Automating Database Events
&lt;/h2&gt;

&lt;p&gt;The automation that I need is comprised of three main aspects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Relations&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Triggers
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Relations
&lt;/h3&gt;

&lt;p&gt;Recall in the last article I said I wasn't going to delve into table relations. For the coming steps, relations are the lynch pin to a lot of what I want to accomplish.&lt;/p&gt;

&lt;h4&gt;
  
  
  Profiles Table
&lt;/h4&gt;

&lt;p&gt;To start off, here's  the relation between my profiles table and the &lt;code&gt;auth.users&lt;/code&gt; one:   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xshuhj36rhjfalqsmhd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xshuhj36rhjfalqsmhd.png" alt="profile relation" width="579" height="888"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;auth.users&lt;/code&gt; table is from the authentication service I talked about in the prior article.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  User Data Table
&lt;/h4&gt;

&lt;p&gt;I could choose to link this table directly to the auth.users one, the same way the profiles one is - but that creates a separate relation. What I want is to relate the user_data one to the profiles one. In essence; an authenticated user has related profile data as well as user data.&lt;/p&gt;

&lt;p&gt;So instead I have made the relation to the profiles one - that way everything is connected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmczap22mrrn3n2g7qyeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmczap22mrrn3n2g7qyeg.png" alt="user data relation" width="571" height="881"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Functions
&lt;/h3&gt;

&lt;p&gt;Triggers, from what I learnt, require functions. Naturally, I started there. The requirements for my function were straightforward: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;when a row in the &lt;code&gt;profiles&lt;/code&gt; table is created, create a row in the &lt;code&gt;user_data&lt;/code&gt; table that is related by &lt;code&gt;id&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The settings for &lt;strong&gt;functions&lt;/strong&gt; and &lt;strong&gt;triggers&lt;/strong&gt; can be found in the &lt;strong&gt;Database&lt;/strong&gt; area of my project.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdens3cwv0r4aue7fyku7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdens3cwv0r4aue7fyku7.png" alt="database settings" width="700" height="318"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;  &lt;/p&gt;

&lt;h4&gt;
  
  
  Creating The Function
&lt;/h4&gt;

&lt;p&gt;Let's go through the steps to create a function and the important aspects to take note of.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Return Type&lt;/strong&gt;: Because we are making a function that a trigger will call, we have to set its return type to trigger&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsxmhz18giwgvqa89xtq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsxmhz18giwgvqa89xtq.png" alt="function setting" width="700" height="707"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition&lt;/strong&gt;: This is the core of what our function will be doing. It will be similar to the one before:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;begin&lt;/span&gt;
    &lt;span class="k"&gt;insert&lt;/span&gt; &lt;span class="k"&gt;into&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;values&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tre1xhwhdq28mqc9rqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tre1xhwhdq28mqc9rqy.png" alt="function setting" width="700" height="684"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Type of Security&lt;/strong&gt;: It is necessary to change this  to &lt;strong&gt;SECURITY DEFINER&lt;/strong&gt;. This is to ensure that the trigger is run with the same privileges as a dashboard user. If left as SECURITY INVOKER, it would fail because the user trying to run does not have the necessary permissions.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffipd3kzcqym99j0zt48g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffipd3kzcqym99j0zt48g.png" alt="function setting" width="700" height="693"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Triggers
&lt;/h3&gt;

&lt;p&gt;With the function ready, let's create the trigger that calls it.  &lt;/p&gt;

&lt;h4&gt;
  
  
  Creating The Trigger
&lt;/h4&gt;

&lt;p&gt;These are the important aspects to take note of when creating a trigger.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Table&lt;/strong&gt;: We have to set the table that is to be watched for changes. In our case, as we discussed, it's the profiles table.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Events&lt;/strong&gt;: Here we specify what kind of action will invoke our trigger. We want INSERT events.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhvtcaenbj80vb0gig8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhvtcaenbj80vb0gig8y.png" alt="trigger setting" width="700" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Trigger Type&lt;/strong&gt;: Next is to set when we want the trigger to run. We need it to run after because we require there to be a row in the profiles table to be created first. That way it is correctly related.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Orientation&lt;/strong&gt;: As we want accompanying data for each user that is created, we set this to Row. Otherwise, it would only run once and fail on subsequent attempts.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Function to trigger&lt;/strong&gt;: Lastly, we choose the function we need to be triggered.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrnpintjqm933k5zo55o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrnpintjqm933k5zo55o.png" alt="trigger setting" width="700" height="687"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Recapping
&lt;/h2&gt;

&lt;p&gt;We have created a function that is run through a trigger, allowing us to have database actions and events automated whenever specific conditions are met. What it does is create a row in the &lt;code&gt;user_data&lt;/code&gt; table whenever an insert event happens in the &lt;code&gt;profiles&lt;/code&gt; table - all this being linked via the &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Last Update&lt;/strong&gt;: 30 October 2023&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As with most things in Supabase, this also wasn't that hard to get up and running. The beauty also is that I know exactly what is going on and what I have to do if I need to modify or add to it.&lt;/p&gt;

&lt;p&gt;This adventure has been very fruitful. The fact that I can ensure that I can ensure that user data and info is created and related fills me with confidence.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>database</category>
      <category>sql</category>
      <category>automation</category>
    </item>
    <item>
      <title>Fortify Your Database: Supabase's Row Level Security</title>
      <dc:creator>James 'Dante' Midzi</dc:creator>
      <pubDate>Mon, 25 Sep 2023 14:13:31 +0000</pubDate>
      <link>https://forem.com/psypher1/fortify-your-database-supabases-row-level-security-3fh8</link>
      <guid>https://forem.com/psypher1/fortify-your-database-supabases-row-level-security-3fh8</guid>
      <description>&lt;p&gt;Over the last few weeks, I have been working on stripping away complexity from my apps. In those adventures, I needed a database service that would enable me to handle authentication with them as well as store my app data.&lt;/p&gt;

&lt;p&gt;This has to happen with me seeing what exactly is happening in my database. I don't want anything hidden or wrapped in something to form a sort of bridge. That meant no ORM, no third party auth service, etc...&lt;/p&gt;

&lt;p&gt;I remembered &lt;a href="https://supabase.com"&gt;Supabase&lt;/a&gt; was one that seemed interesting when I heard about it. The pathway was chosen...&lt;/p&gt;

&lt;p&gt;One of the first things I had to do was figure out how &lt;strong&gt;Supabase Auth&lt;/strong&gt; worked. This was surprisingly easier than I assumed it would be. That assumption - of auth being complicated - came from some issues I encountered with NextAuth when I was using it.&lt;/p&gt;

&lt;p&gt;The only thing I would say is simpler is &lt;a href="https://clerk.com"&gt;Clerk&lt;/a&gt;. But with Clerk, I would end up having to do some &lt;code&gt;id&lt;/code&gt; gymnastics to get things to sync up - thereby defeating the stripping away of complexity.&lt;/p&gt;




&lt;h2&gt;
  
  
  Authentication Service
&lt;/h2&gt;

&lt;p&gt;Supabase has a built in &lt;strong&gt;Authentication Service&lt;/strong&gt; where users are added when they sign up for your app - this is done automatically when a new user is signed up. This makes it highly efficient to handle the auth logic of your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flw66yfgapy2otq2xk7hg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flw66yfgapy2otq2xk7hg.png" alt="auth service" width="750" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This feature of Supabase simplifies my life when it comes to signing up new users to my app.&lt;/p&gt;

&lt;p&gt;The only issue is that these users who have signed up have no clearly defined permissions. If they got access to your database, they could do whatever they want, and we don't want that.&lt;/p&gt;

&lt;p&gt;That is where &lt;strong&gt;Row Level Security&lt;/strong&gt; comes in...&lt;/p&gt;




&lt;h2&gt;
  
  
  Row Level Security
&lt;/h2&gt;

&lt;p&gt;On each table in your project, you can enable RLS and define who has access to do what on each table.&lt;/p&gt;

&lt;p&gt;By default when you create a table in Supabase, RLS is activated. What it does is make it such that no-one can access the table. However, in most instances you would want specific users to access a table based on specific conditions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8ob8ukkkxe79y5zw3bm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8ob8ukkkxe79y5zw3bm.png" alt="create new table" width="700" height="688"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter... &lt;strong&gt;Policies&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Policies
&lt;/h3&gt;

&lt;p&gt;Policies in Supabase are simply rules as to who can perform which action on a specified table. All policies are; is SQL logic that you attach to a Postgres table. There is no limit as to how many policies you can have on a table.&lt;/p&gt;

&lt;p&gt;They - policies - can be accessed from the Authentication section of your project or the dropdown beside your table's name.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;RLS is a Postgres primitive and can provide "&lt;a href="https://en.wikipedia.org/wiki/Defense_in_depth_(computing)"&gt;defense in depth&lt;/a&gt;" to protect your data from malicious actors even when accessed through 3rd party tooling.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://supabase.com/docs/"&gt;Supabase Docs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  My Use Case
&lt;/h2&gt;

&lt;p&gt;In one of my apps I have two main tables - a &lt;strong&gt;profiles&lt;/strong&gt; table and a &lt;strong&gt;user_data&lt;/strong&gt; one. I need it such that only a user whose &lt;code&gt;id&lt;/code&gt; matches is able to view, add/modify information related to that &lt;code&gt;user id&lt;/code&gt;. While I could write the SQL myself, Supabase simplifies this process with their UI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhsknxb5jfxpqh58kdoci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhsknxb5jfxpqh58kdoci.png" alt="create policy" width="700" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both my &lt;code&gt;profiles&lt;/code&gt; and &lt;code&gt;user_data&lt;/code&gt; table have 3 policies: select, update and insert&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8unzdysuhs6eqrm9xcb1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8unzdysuhs6eqrm9xcb1.png" alt="polices" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recall I mentioned that policies are just logic? Well, the logic for my insert would look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Users can insert their own profile"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="nv"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;"profiles"&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;PERMISSIVE&lt;/span&gt; &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;

&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I allow insert actions on my profiles table, but only if the authentication id (from the authentication service) matches the id of the user. The connection of the &lt;code&gt;auth id&lt;/code&gt; and &lt;code&gt;user id&lt;/code&gt; dives into relations and I am not delving into that right now...&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Supabase has been an absolute joy to work with. From creating a project, and making tables, to defining permissions on said tables. I also appreciate the straightforward approach to accessing your data from whatever frontend you decide to use.&lt;/p&gt;

&lt;p&gt;Their docs are also decent which helps, and if not, the &lt;a href="https://discord.supabase.com/"&gt;discord&lt;/a&gt; is an excellent place to ask for assistance.&lt;/p&gt;

&lt;p&gt;Things... just... work...&lt;/p&gt;

&lt;p&gt;My next exploration will be with the CLI and linking a local instance of Supabase with a hosted one.&lt;/p&gt;

&lt;p&gt;In my goals of reducing complexity, Supabase succeeds in aiding me in accomplishing them.&lt;/p&gt;




&lt;h3&gt;
  
  
  Thank you for reading, let's connect!
&lt;/h3&gt;

&lt;p&gt;Thank you for visiting this little corner of mine. Let's connect on &lt;a href="https://twitter.com/Psypher1"&gt;Twitter&lt;/a&gt;, &lt;a href="https://discord.com/users/Pharaoh#5441/"&gt;Discord&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/jamesmidzi/"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>database</category>
      <category>security</category>
    </item>
  </channel>
</rss>
