{"version":"https:\/\/jsonfeed.org\/version\/1","title":"Chris Weed","description":"","home_page_url":"https:\/\/cjweed.com","feed_url":"https:\/\/cjweed.com\/feed.json","user_comment":"","author":{"name":"Chris"},"items":[{"id":"https:\/\/cjweed.com\/capacitor-supabase-react\/","url":"https:\/\/cjweed.com\/capacitor-supabase-react\/","title":"Capacitor + Supabase + Social Auth + React In-App\u00a0","summary":"UPDATE: Feb 2026\u00a0- Since Capacitor is basically being abandoned by Ionic (they were bought out) you are better off using\u00a0https:\/\/capgo.app\/docs\/plugins\/social-login\/supabase\/google\/ios\/. Capgo seems to have picked up the slack that the Ionic team left and has created plugins that actually work with the latest version. Bonus&hellip;","content_html":"<p><strong>UPDATE: Feb 2026<\/strong>\u00a0- Since Capacitor is basically being abandoned by Ionic (they were bought out) you are better off using\u00a0<a href=\"https:\/\/capgo.app\/docs\/plugins\/social-login\/supabase\/google\/ios\/\">https:\/\/capgo.app\/docs\/plugins\/social-login\/supabase\/google\/ios\/<\/a>. Capgo seems to have picked up the slack that the Ionic team left and has created plugins that actually work with the latest version.\u00a0 Bonus they even have \"Capacitor+\" which is a drop-in replacement.\u00a0 So just use that!<\/p>\n<p>--- Original post ---<\/p>\n<p>In my <a href=\"https:\/\/cjweed.com\/capacitor-supabase-social-auth-react\/\">previous, extremely long tutorial<\/a> post I walked you through how to get a simple React app to use Supabase Social authentication to work within a Capacitor app. Phew that was a lot of name dropping sorry.<\/p>\n<p>This post will be much much shorter, the goal in this second part is to explain how to extend upon the work we previously did to use the in-app browser experience. The in-app browser the best way to use the social logins as it gives the \"normal\" experience users expect when logging in this way but more critically it does not depend on the users default browser.<\/p>\n<h2>Setup<\/h2>\n<p>If you followed along with the <a href=\"https:\/\/cjweed.com\/capacitor-supabase-social-auth-react\/\">previous post<\/a> you should have a reasonably working native application that can use Google auth flow to authenticate with Supabase. Once you have that working (be sure to have Safari as your default browser) you should be able to get started here.<\/p>\n<figure><figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/13\/app-starting-point.gif\" alt=\"A native app authenticating with Google and redirecting back to the app.\" width=\"320\" height=\"619\"><\/figure>\n<figcaption>A good start but depends on the default browser which can be problematic<\/figcaption>\n<\/figure>\n<p>The three problems we have:<\/p>\n<ol>\n<li>It depends on the current default browser, this could be something like Brave or Orion which do not support deep links (at least as of this writing and in this situation)<\/li>\n<li>It doesn't feel \"normal\" for a user using your native app to bounce out of the app for authentication.<\/li>\n<li>The page that you authenticated with remains there in the browser, the user might get confused or just feel your app is sloppy when it leaves a trail like that.<\/li>\n<\/ol>\n<h2>Prevent Redirect<\/h2>\n<p>The first thing we need to do is stop Supabase from automatically launching the browser when running the sign in code.\u00a0 Let's do this by adding the <a href=\"https:\/\/supabase.com\/docs\/reference\/javascript\/auth-signinwithotp\" target=\"_blank\" rel=\"noopener noreferrer\">lightly documented<\/a> prop called <code>skipBrowserRedirect<\/code> to the <code>signInWithOauth<\/code> call<\/p>\n<p class=\"filename\">components\/LoginComponent.tsx<\/p>\n<pre class=\"language-javascript line-numbers\"><code>const login = () =&gt; {\n  supabase.auth.signInWithOAuth({\n    provider: 'google',\n    options: {\n      redirectTo: `${baseUrl}\/logged`,\n+     \/\/ Skip the Browser Redirect to manually open the browser\n+     skipBrowserRedirect: true,\n      queryParams: {\n        access_type: 'offline',\n        prompt: 'consent',\n      },\n    },\n  })\n}<\/code><\/pre>\n<div>\n<p>With that addition we no longer automatically launch the browser when the user attempts to log in with this method. We have to do that manually now, but because we do it manually we have some control on how we launch that browser.<\/p>\n<p>And with that we can now use the \"in app browser\".<\/p>\n<h2>In App Browser<\/h2>\n<p>The In-App Browser uses the built in browser engine of the devices which means it's consistent regardless of what other browser is set as the default. This also helps us use things we are know supported by these browsers, in this case Deep Linking.<\/p>\n<p>To open an in-app browser in Capacitor we will use the documentation they have provided: <a href=\"https:\/\/capacitorjs.com\/docs\/apis\/browser\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/capacitorjs.com\/docs\/apis\/browser<\/a>. Notice that this <span style=\"text-decoration: underline;\">isn't<\/span> the seemingly better named \"<a href=\"https:\/\/capacitorjs.com\/docs\/apis\/inappbrowser\" target=\"_blank\" rel=\"noopener noreferrer\">in app<\/a>\" browser version \ud83e\udd37.<\/p>\n<pre class=\"language-bash line-numbers\"><code>pnpm i @capactior\/browser<\/code><\/pre>\n<p>And let's create a new component to handle the details of this browser experience. Notice that we are no longer just writing code for a web app, we are now leaning into some of the nice things that Capacitor gives us and is able to adapt automatically based on the environment it lives in.<\/p>\n<p class=\"\">nativeBrowser.ts<\/p>\n<pre class=\"language-typescript line-numbers\"><code>import { Capacitor } from '@capacitor\/core'\nimport { Browser } from '@capacitor\/browser'\n\nexport const openBrowser = async (url: string) =&gt; {\n  \/\/ Open the browser only if we are on a native platform (in-app)\n  if (Capacitor.isNativePlatform()) {\n    await Browser.open({\n      url,\n      presentationStyle: 'popover',\n    })\n  } else {\n    window.location.href = url\n  }\n}\n\nexport const closeBrowser = async () =&gt; {\n  if (Capacitor.isNativePlatform()) {\n    await Browser.close()\n  }\n}\n<\/code><\/pre>\n<p>Notice how we have to check if we are in a native platform or web. If we are in a native environment we want to trigger this new Browser.open function call so we can designate how that experience should look.<\/p>\n<p>Now back at our LoginComponent we want to trigger the openBrowser function call manually to get the authentication flow kicked off.<\/p>\n<p class=\"filename\">components\/LoginComponent.tsx<\/p>\n<pre class=\"language-typescript line-numbers\"><code>  const login = async () =&gt; {\n+   const { data, error } = await supabase.auth.signInWithOAuth({\n      provider: 'google',\n      options: {\n        redirectTo: `${baseUrl}\/logged`,\n        \/\/ Skip the Browser Redirect to manually open the browser\n        skipBrowserRedirect: true,\n        queryParams: {\n          access_type: 'offline',\n          prompt: 'consent',\n        },\n      },\n    })\n\n+   if (error) {\n+     console.error(error)\n+     return\n+   }\n\n+   await openBrowser(data.url)\n  }<\/code><\/pre>\n<p>Obviously we could do something different with the error handling, but for now this is an example. The key is that we manually open the browser now and depending if we are in a native environment or standard browser we handle it slightly differently.<\/p>\n<p>If you attempt to use the app now you'll notice that the in-app browser works and it looks nice except it sticks open.\u00a0 So close!<\/p>\n<figure><figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/13\/out-2025-03-11_20-44-14.gif\" alt=\"Logging in with Google authentication but the browser window stays open\" width=\"400\" height=\"774\"><\/figure>\n<figcaption>The browser is staying open, you need to manually close it.<\/figcaption>\n<\/figure>\n<h2>Closing the Browser<\/h2>\n<p>If you test this out now you'll notice that the browser just hangs open after you authenticate. Luckily we have a function (we already wrote) to close that browser and thus we just need to call that on the redirect page we built in the first post.<\/p>\n<p>We know that we are redirected to the <code>\/logged<\/code> page when we authenticate, so we could brute force the browser closed by saying 'when that page is loaded, close the external browser if there is one'. That could be done with code like this:<\/p>\n<p class=\"filename\">components\/LoggedIn.tsx<\/p>\n<pre class=\"language-typescript line-numbers\"><code>+ import { closeBrowser } from '..\/nativeBrowser'\n\nexport const LoggedIn = () =&gt; {\n  const history = useHistory()\n  const { supabase } = useSupabase()\n\n+  useEffect(() =&gt; {\n+    closeBrowser().catch(() =&gt; {\n+      \/\/ nom nom nom\n+    })\n+  }, [])\n\n....\n\/\/ rest of the component<\/code><\/pre>\n<p>This would simply close the browser when this component is rendered. This would of course be kind of poor form if we wanted to use this page for anything else or if we landed on this page not from the result of logging in.<\/p>\n<p>So a better way to handle this would be to move that logic to the SupabaseProvider we've created in the previous post. Here we can listen for authentication state changes and do some logic based on the \"logged in\" state.<\/p>\n<p class=\"filename\">components\/SupabaseProvider.tsx<\/p>\n<pre class=\"language-typescript line-numbers\"><code>export const SupabaseProvider: FC&lt;SupabaseProviderProps&gt; = ({ children }) =&gt; {\n  const [supabase] = useState&lt;SupabaseClient&gt;(() =&gt;\n    createClient(supabaseUrl, supabaseKey),\n  )\n\n+  useEffect(() =&gt; {\n+    const { data: authListener } = supabase.auth.onAuthStateChange(\n+      (event, session) =&gt; {\n+        if (event === 'SIGNED_IN' &amp;&amp; session?.user) {\n+          closeBrowser().catch(() =&gt; {\n+            \/\/ nom nom nom\n+          })\n+        }\n+      },\n+    )\n\n+    \/\/ Cleanup the listener on unmount\n+    return () =&gt; {\n+      authListener?.subscription.unsubscribe()\n+    }\n+ }, [])\n\n...\/\/ The rest of the component<\/code><\/pre>\n<p>This will listen for the events emitted from the supabase auth and do logic based on that. In our case we simply want to close the browser but you could also expand this to saving the user you get back.<\/p>\n<p>If you use the SupabaseProvider change make sure to remove the LoggedIn.tsx change.<\/p>\n<p>Congrats you can now test the application login and it'll have the standard in-app browser experience that users are expecting.<\/p>\n<figure><figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/13\/out-2025-03-11_21-10-00.gif\" alt=\"Logging into a native application with Google and the in-app browser closes\" width=\"400\" height=\"774\"><\/figure>\n<figcaption>The in-app browser now closes automatically when we log in<\/figcaption>\n<\/figure>\n<h2>Conclusion<\/h2>\n<p>Congrats on getting this far! The goal of this post was to make the example app a bit more \"natural\" feeling but unfortunately it required the first step of \"if native do X\" type of checking.<\/p>\n<p>I like to try and keep the code I write the same across all devices, similar to not having to use specific CSS selectors or other varieties of things that are browser specific in web development. This is a nessissary evil and by abstracting it away into the <code>nativeBrowser.tsx<\/code> component it's at least nicer to look at and use across the app.<\/p>\n<p>This only leaves one last downfall:<\/p>\n<ul>\n<li>You must use the \"consent\" variety of authentication.<\/li>\n<\/ul>\n<p>I haven't yet seen the auth flow work properly even in the in-app experience if you don't use the consent flow (slower, more windows for people to click through). Maybe in the future I'll add yet more native-specific code so we can skip those screens. For now this is good enough for me and doesn't feel too janky to the user.<\/p>\n<\/div>","image":"https:\/\/cjweed.com\/media\/posts\/13\/AllTheThings.png","author":{"name":"Chris"},"tags":["web","tutorial","learning"],"date_published":"2025-03-06T16:40:56-06:00","date_modified":"2026-02-08T11:39:41-06:00"},{"id":"https:\/\/cjweed.com\/capacitor-supabase-social-auth-react\/","url":"https:\/\/cjweed.com\/capacitor-supabase-social-auth-react\/","title":"Capacitor + Supabase + Social Auth + React","summary":"UPDATE: Feb 2026 - Since Capacitor is basically being abandoned by Ionic (they were bought out) you are better off using&nbsp;https:\/\/capgo.app\/docs\/plugins\/social-login\/supabase\/google\/ios\/. Capgo seems to have picked up the slack that the Ionic team left and has created plugins that actually work with the latest version.&nbsp;&hellip;","content_html":"\n  <p>\n    <b>UPDATE: Feb 2026<\/b> - Since Capacitor is basically being abandoned by Ionic (they were bought out) you are better off using&nbsp;<a href=\"https:\/\/capgo.app\/docs\/plugins\/social-login\/supabase\/google\/ios\/\">https:\/\/capgo.app\/docs\/plugins\/social-login\/supabase\/google\/ios\/<\/a>. Capgo seems to have picked up the slack that the Ionic team left and has created plugins that actually work with the latest version.&nbsp; Bonus they even have \"Capacitor+\" which is a drop-in replacement.&nbsp; So just use that!\n  <\/p>\n\n  <p>\n    --- Original post ---\n  <\/p>\n\n  <p>\n    I've been building an application to help with a summer job I've had for a couple years which involves line painting. The app is intended to help painters predict when a field needs to be painted, I decided to take the opportunity to create a solid progressive web app and eventually a native app.\n  <\/p>\n\n  <p>\n    But you're not here to listen to my back story, let's just get our app working with Google Social auth on an iPhone using our mac.&nbsp; This tutorial will get an app running with the following:\n  <\/p>\n\n  <ul>\n    <li>An Ionic web application that uses Google Auth via Supabase<\/li><li>An iOS app that wraps that Ionic web app using Capacitor<\/li><li>A super basic auth flow that doesn't require building anything specific for the native app (this comes with limitations illustrated later)<\/li>\n  <\/ul>\n\n  <p>\n    For those of you that may already know what you're doing and just want to see a working example of this application, go check out the repo: <a href=\"https:\/\/github.com\/Kikketer\/wtftzone\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/Kikketer\/wtftzone<\/a>\n  <\/p>\n\n    <h2 id=\"table-of-contents\">\n      Table of Contents\n    <\/h2>\n<div><ul>\n  <li><a href=\"#baseline-ionic-web-application\">Baseline Ionic Web Application<\/a><\/li>\n  <li><a href=\"#supabase-auth-setup\">Supabase Auth Setup<\/a><\/li>\n  <li><a href=\"#adding-sign-in-with-google-button\">Adding Sign In with Google Button<\/a><\/li>\n  <li><a href=\"#setting-up-capacitor\">Setting Up Capacitor<\/a><\/li>\n  <li><a href=\"#deep-links-and-universal-links\">Deep Links and Universal Links<\/a><\/li>\n  <li><a href=\"#create-the-website\">Create the Website<\/a><\/li>\n  <li><a href=\"#associate-the-app\">Associate the App<\/a><\/li>\n  <li><a href=\"#known-issues\">Known Issues<\/a><\/li>\n  <li><a href=\"#credits-and-references\">Credits and References<\/a><\/li>\n<\/ul><\/div>\n\n    <h2 id=\"overall-flow\">\n      Overall Flow\n    <\/h2>\n\n  <p>\n    Here's a rough overview of what we are about to do. Supabase acts as the middle-person that allows us to get a Supabase Authentication token using Google. Basically the user is able to authenticate to your Supabase app using their Google auth. The real trick is getting the OS to launch the Capacitor native app vs the web page (using Universal Links).\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/AuthFlow.webp\" height=\"450\" width=\"651\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/AuthFlow-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/AuthFlow-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/AuthFlow-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/AuthFlow-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/AuthFlow-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/AuthFlow-2xl.webp 1920w\">\n      \n    <\/figure>\n\n    <h2 id=\"baseline-ionic-web-application\">\n      Baseline Ionic Web Application\n    <\/h2>\n\n  <p>\n    Feel free to jump to the Ionic documentation around creating an app, I'll walk through the high level steps but read their docs to really get a more accurate procedure and reasoning behind them:&nbsp;<a href=\"https:\/\/ionicframework.com\/docs\/intro\/cli\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/ionicframework.com\/docs\/intro\/cli<\/a>\n  <\/p>\n\n  <p>\n    I hate having libraries install things globally to my system, drives me crazy. So if you want to do as I do, add the node_modules\/.bin to your path by editing your `.zshrc` file and put this at the bottom:\n  <\/p>\n<pre class=\"line-numbers  language-html\"><code>export PATH=\".\/node_modules\/.bin:$PATH\"\n<\/code><\/pre>\n\n  <p>\n    Then initialize the application, you can use most any package manager but I tend to like pnpm these days:\n  <\/p>\n<pre class=\"line-numbers  language-bash\"><code>pnpm init\n<\/code><\/pre>\n\n  <p>\n    This will create the package.json in your application and now you can do the steps described (mostly) in the Ionic setup. First let's install the CLI so we can use their nice app creation wizard:\n  <\/p>\n<pre class=\"line-numbers  language-bash\"><code>pnpm i -D @ionic\/cli<\/code><\/pre>\n\n  <p>\n    And now that we've updated our path we should be able to simply run the CLI commands directly in this folder and it didn't mess with our host system. Follow the steps in the Ionic setup cli, this will create another folder in our current folder but that's ok for now, we will move it:\n  <\/p>\n<pre class=\"line-numbers  language-bash\"><code>ionic start<\/code><\/pre>\n<pre class=\"line-numbers  language-bash\"><code>1. Use the app creation wizard? No &lt;&lt; Don't bother with their online thing\n2. React   | https:\/\/reactjs.org &lt;&lt; Pick React (cuz I know that one)\n3. Project name: WTF App &lt;&lt; App name, whatever you want\n4. blank        | A blank starter project &lt;&lt; Blank to stay simple<\/code><\/pre>\n\n  <p>\n    Unfortunately it'll also attempt to do the install of node_modules with npm and we also have a nested folder. This side effect is still worth the trouble vs having the cli installed globally.&nbsp; So let's do some cleanup:\n  <\/p>\n<pre class=\"line-numbers  language-bash\"><code>rm -rf .\/**\/node_modules &lt;&lt; Wipe out all the node_modules folders for now\nmv wtf-app\/* . &lt;&lt; Moves the nested folder components here (overwrite is fine)\nrm -rf wtf-app &lt;&lt; Wipe out the empty folder\npnpm i &lt;&lt; install the dependencies again<\/code><\/pre>\n\n  <p>\n    You should now see index.html, package.json etc in this original folder. Phew that was a little crazy but we are in a good spot to move forward now. You should be able to run the following command and see the application running in your browser:\n  <\/p>\n<pre class=\"line-numbers  language-bash\"><code>pnpm i -D @ionic\/cli &lt;&lt; only need to run this the first time to get the CLI back\nionic serve<\/code><\/pre>\n\n  <p>\n    Congrats you have a baseline Ionic app running (same result as the tutorial they provide):&nbsp;<a href=\"https:\/\/ionicframework.com\/docs\/intro\/cli\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/ionicframework.com\/docs\/intro\/cli<\/a>\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/Blank-Ionic-2.png\" height=\"549\" width=\"320\" alt=\"A blank ionic web application\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/Blank-Ionic-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/Blank-Ionic-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/Blank-Ionic-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/Blank-Ionic-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/Blank-Ionic-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/Blank-Ionic-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n    <h2 id=\"supabase-auth-setup\">\n      Supabase Auth Setup\n    <\/h2>\n\n  <p>\n    We need to setup a simple Supabase application, in this case we are only going to worry about authentication. Once you have that out of the way building the rest of your app can be really easy and fun.\n  <\/p>\n\n  <p>\n    We will be following the tutorial that Supabase provides here:&nbsp;<a href=\"https:\/\/supabase.com\/docs\/guides\/auth\/social-login\/auth-google?queryGroups=platform&amp;platform=web&amp;queryGroups=environment&amp;environment=client\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/supabase.com\/docs\/guides\/auth\/social-login\/auth-google?queryGroups=platform&amp;platform=web&amp;queryGroups=environment&amp;environment=client<\/a><br>We will be following the \"Application Code\" path where we are going to provide our own button and logic to handle that button.\n  <\/p>\n\n  <p>\n    First off we need to create the application within Supabase. Creating an account and project is super easy. After signup (come now I shouldn't have to show you how to do that) you need to create a new project:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-iite-2.png\" height=\"183\" width=\"400\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iite-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iite-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iite-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iite-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iite-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iite-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    After you create the project we need to go to the Authentication section and setup our website redirect url. This is the url for our app, so for example you might do something like `https:\/\/app.isawesome.zone\/logged` or the like. I put the `\/logged` at the end because that's where we will send users with our authentication information once they sign in.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-iioc.png\" height=\"1298\" width=\"1656\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iioc-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iioc-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iioc-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iioc-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iioc-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iioc-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Now we need to create the application within Google itself! Let's create the project here:&nbsp;<a href=\"https:\/\/console.cloud.google.com\/projectcreate\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/console.cloud.google.com\/projectcreate<\/a>. Add your project name and move on.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250221-rlhw.png\" height=\"456\" width=\"1080\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rlhw-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rlhw-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rlhw-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rlhw-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rlhw-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rlhw-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Then we will find the \"Auth Platform\" in the left side sandwich menu:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250221-rmvp.png\" height=\"233\" width=\"400\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rmvp-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rmvp-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rmvp-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rmvp-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rmvp-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250221-rmvp-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Go to the \"Clients\" page and create a new Web client using your projected web address (we will create the webpage for this later) along with localhost.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-ihsw.png\" height=\"1132\" width=\"1670\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-ihsw-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-ihsw-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-ihsw-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-ihsw-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-ihsw-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-ihsw-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Now once this is setup we will get three things:\n  <\/p>\n\n  <ul>\n    <li>Client ID = public client ID to identify your application<\/li><li>Client Secret = the secret used for auth<\/li><li>Callback URL = What Google will call back to with the auth information for a safe exchange of tokens (this domain is handled by Supabase and we tell Supabase to redirect to our own app)<\/li>\n  <\/ul>\n\n  <p>\n    We are going to move that information over into Supabase, click the Sign in\/Up link and then click Google:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-imcm-3.png\" height=\"359\" width=\"500\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-imcm-3-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-imcm-3-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-imcm-3-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-imcm-3-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-imcm-3-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-imcm-3-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    You'll see a fly-out that is asking for the Client ID and Secret. Place the two from the Google page into here. Then take the callback url that's listed and put that into the Google page (swap information!)\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-inbb-2.png\" height=\"668\" width=\"500\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-inbb-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-inbb-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-inbb-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-inbb-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-inbb-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-inbb-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-iloa.png\" height=\"1302\" width=\"2384\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iloa-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iloa-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iloa-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iloa-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iloa-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-iloa-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Phew that was a little painful (especially the Google part) but now you have Supabase setup to use Google authentication! Basically you authenticate with Google, and there's a transaction that happens between Supabase and Google to give you a resulting Supabase token which you can then use to query your Supabase databases!\n  <\/p>\n\n  <p>\n    Note however that we do NOT have the ability to use the Google authentication to use Google services. That's a bonus feature I'm going to leave up to you. Be aware that I wasn't able to get that half of it working with the Capacitor app (there are other limitations too).\n  <\/p>\n\n    <h2 id=\"adding-sign-in-with-google-button\">\n      Adding Sign In With Google Button\n    <\/h2>\n\n  <p>\n    Now that we have Supabase auth setup we need to put it into our actual code. Again I'm using the \"roll your own\" technique vs the \"one tap\" login. I'm doing this mostly as a design aspect but also as a more universal learning so this could be applied to other social logins like Facebook.&nbsp; We will be somewhat following the basic tutorial steps provided by Supabase:&nbsp;<a href=\"https:\/\/supabase.com\/docs\/guides\/auth\/social-login\/auth-google?queryGroups=platform&amp;platform=web&amp;queryGroups=environment&amp;environment=client#signing-users-in\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/supabase.com\/docs\/guides\/auth\/social-login\/auth-google?queryGroups=platform&amp;platform=web&amp;queryGroups=environment&amp;environment=client#signing-users-in<\/a>\n  <\/p>\n\n  <p>\n    First let's create a Supabase provider that will handle setting up Supabase and provide the `supabase` functionality to components:\n  <\/p>\n\n  <p class=\"filename\">\n    components\/SupabaseProvider.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import { createContext, ReactNode, useContext, FC, useState } from 'react'\nimport { createClient, SupabaseClient } from '@supabase\/supabase-js'\n\nconst supabaseKey = import.meta.env.VITE_SUPABASE_KEY\nconst supabaseUrl = import.meta.env.VITE_SUPABASE_URL\n\nconst SupabaseContext = createContext&lt;{ supabase: SupabaseClient } | null&gt;(null)\n\ninterface SupabaseProviderProps {\n  children: ReactNode\n}\n\nexport const SupabaseProvider: FC&lt;SupabaseProviderProps&gt; = ({\n  children,\n}) =&gt; {\n  const [supabase] = useState&lt;SupabaseClient&gt;(() =&gt;\n    createClient(supabaseUrl, supabaseKey),\n  )\n\n  return (\n    &lt;SupabaseContext.Provider value={{ supabase }}&gt;\n      {children}\n    &lt;\/SupabaseContext.Provider&gt;\n  )\n}\n\nexport const useSupabase = () =&gt; {\n  const context = useContext(SupabaseContext)\n  if (context === null) {\n    throw new Error('useSupabase must be used within a SupabaseProvider')\n  }\n  return context\n}\n<\/code><\/pre>\n\n  <p>\n    Notice I provide a hook at the bottom of the file to consume this provider. I like using custom hooks to use providers vs the raw `useContext`, it just makes things clearer and allows us to throw exceptions easily if it's not used properly.\n  <\/p>\n\n  <p>\n    With that let's also create a `&lt;LoginComponent&gt;` that simply has the button and handles the click for that button:\n  <\/p>\n\n  <p class=\"filename\">\n    components\/LoginComponent.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import { IonButton } from '@ionic\/react'\nimport { useSupabase } from '.\/SupabaseProvider'\n\nconst baseUrl = import.meta.env.VITE_BASE_URL\n\nconst LoginComponent = () =&gt; {\n  const { supabase } = useSupabase()\n\n  const login = () =&gt; {\n    supabase.auth.signInWithOAuth({\n      provider: 'google',\n      options: {\n        redirectTo: `${baseUrl}\/logged`,\n        queryParams: {\n          access_type: 'offline',\n          prompt: 'consent',\n        },\n      },\n    })\n  }\n\n  return (\n    &lt;div id=\"login\"&gt;\n      &lt;IonButton onClick={login}&gt;Log In with Google&lt;\/IonButton&gt;\n    &lt;\/div&gt;\n  )\n}\n\nexport default LoginComponent\n<\/code><\/pre>\n\n  <p>\n    See how nice that looks with the hook?&nbsp; If we really wanted to get fancy we could\/would provide more helper functionality out of the hook\/provider such as `signIn` but for now let's keep it simple.\n  <\/p>\n\n  <p>\n    Notice how I also use the `import.meta.env` to get environment variables. These are used to bring the environment variables into a Vite application. When it's built these are injected and can be changed based on what you are building the application for. That's a hint for your potential future if you ever need to do a specific build for Capacitor vs Web (we won't be doing that here).\n  <\/p>\n\n  <p>\n    And now let's use that component in our Home.tsx page:\n  <\/p>\n\n  <p class=\"filename\">\n    pages\/Home.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import {\n  IonContent,\n  IonHeader,\n  IonPage,\n  IonTitle,\n  IonToolbar,\n} from '@ionic\/react'\nimport LoginComponent from '..\/components\/LoginComponent'\nimport '.\/Home.css'\n\nconst Home: React.FC = () =&gt; {\n  return (\n    &lt;IonPage&gt;\n      &lt;IonHeader&gt;\n        &lt;IonToolbar&gt;\n          &lt;IonTitle&gt;Auth Test&lt;\/IonTitle&gt;\n        &lt;\/IonToolbar&gt;\n      &lt;\/IonHeader&gt;\n      &lt;IonContent fullscreen&gt;\n        &lt;IonHeader collapse=\"condense\"&gt;\n          &lt;IonToolbar&gt;\n            &lt;IonTitle size=\"large\"&gt;Auth Test&lt;\/IonTitle&gt;\n          &lt;\/IonToolbar&gt;\n        &lt;\/IonHeader&gt;\n        &lt;LoginComponent \/&gt;\n      &lt;\/IonContent&gt;\n    &lt;\/IonPage&gt;\n  )\n}\n\nexport default Home\n<\/code><\/pre>\n\n  <p>\n    This is exactly the same as the stock Ionic Home page except we have brought in the new LoginComponent we just built.\n  <\/p>\n\n  <p>\n    We need one final component: the debug component so we can see that all of this works. Create a new component called DebugComponent.tsx:\n  <\/p>\n\n  <p class=\"filename\">\n    components\/DebugComponent.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import { useEffect, useState } from 'react'\nimport { useSupabase } from '.\/SupabaseProvider'\nimport { User } from '@supabase\/supabase-js'\n\nexport const DebugComponent = () =&gt; {\n  const [user, setUser] = useState&lt;User | undefined&gt;()\n  const { supabase } = useSupabase()\n\n  useEffect(() =&gt; {\n    const getUser = async () =&gt; {\n      const { data, error } = await supabase.auth.getUser()\n      if (error) {\n        console.log(error)\n      } else {\n        setUser(data.user)\n      }\n    }\n    getUser()\n  }, [supabase])\n\n  return (\n    &lt;div id=\"debug\"&gt;\n      &lt;h2&gt;Debug Info:&lt;\/h2&gt;\n      &lt;p&gt;User&lt;\/p&gt;\n      &lt;pre&gt;{JSON.stringify(user ?? {}, null, 2)}&lt;\/pre&gt;\n    &lt;\/div&gt;\n  )\n}\n<\/code><\/pre>\n\n  <p>\n    This component is super basic and really just serves the purpose of showing us the logged in user. Similar to the LoginComponent we could have had some of this user logic handled by the useSupabase hook\/provider but let's keep it simple and clear again. So far your structure should look similar to this:\n  <\/p>\n<pre class=\"line-numbers  language-markdown\"><code>\/app\n  \/src\n  App.tsx\n  main.tsx\n    \/components\n      DebugComponent.tsx\n      LoginComponent.tsx\n    \/pages\n      Home.tsx<\/code><\/pre>\n\n  <p>\n    Let's create a new page called LoggedIn so we can have two routes. Remember when we setup the redirect url we said `\/logged` was the page we wished to land on. That's what we will make here:\n  <\/p>\n\n  <p class=\"filename\">\n    pages\/LoggedIn.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import {\n  IonButton,\n  IonButtons,\n  IonContent,\n  IonHeader,\n  IonPage,\n  IonTitle,\n  IonToolbar,\n} from '@ionic\/react'\nimport { DebugComponent } from '..\/components\/DebugComponent'\nimport { useSupabase } from '..\/components\/SupabaseProvider'\nimport { useHistory } from 'react-router-dom'\n\nexport const LoggedIn = () =&gt; {\n  const history = useHistory()\n  const { supabase } = useSupabase()\n\n  const signOut = async () =&gt; {\n    await supabase.auth.signOut()\n    history.push('\/')\n  }\n\n  return (\n    &lt;IonPage&gt;\n      &lt;IonHeader&gt;\n        &lt;IonToolbar&gt;\n          &lt;IonTitle&gt;Logged In&lt;\/IonTitle&gt;\n          &lt;IonButtons slot=\"end\"&gt;\n            &lt;IonButton onClick={signOut}&gt;Sign Out&lt;\/IonButton&gt;\n          &lt;\/IonButtons&gt;\n        &lt;\/IonToolbar&gt;\n      &lt;\/IonHeader&gt;\n      &lt;IonContent fullscreen&gt;\n        &lt;IonHeader collapse=\"condense\"&gt;\n          &lt;IonToolbar&gt;\n            &lt;IonTitle size=\"large\"&gt;Logged in&lt;\/IonTitle&gt;\n          &lt;\/IonToolbar&gt;\n        &lt;\/IonHeader&gt;\n        &lt;DebugComponent \/&gt;\n      &lt;\/IonContent&gt;\n    &lt;\/IonPage&gt;\n  )\n}\n<\/code><\/pre>\n\n  <p>\n    Nothing fancy to this page, we are simply rendering the Sign Out button with an onClick handler but also rendering the Debug component so we can see the authenticated user when we land here.\n  <\/p>\n\n  <p>\n    Now let's setup the routing in App.tsx\n  <\/p>\n\n  <p class=\"filename\">\n    pages\/App.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import { Redirect, Route } from 'react-router-dom'\nimport { IonApp, IonRouterOutlet, setupIonicReact } from '@ionic\/react'\nimport { IonReactRouter } from '@ionic\/react-router'\nimport Home from '.\/pages\/Home'\nimport { LoggedIn } from '.\/pages\/LoggedIn'\nimport { SupabaseProvider } from '.\/components\/SupabaseProvider'\n\n\/* Core CSS required for Ionic components to work properly *\/\nimport '@ionic\/react\/css\/core.css'\n\n\/* Basic CSS for apps built with Ionic *\/\nimport '@ionic\/react\/css\/normalize.css'\nimport '@ionic\/react\/css\/structure.css'\nimport '@ionic\/react\/css\/typography.css'\n\n\/* Optional CSS utils that can be commented out *\/\nimport '@ionic\/react\/css\/padding.css'\nimport '@ionic\/react\/css\/float-elements.css'\nimport '@ionic\/react\/css\/text-alignment.css'\nimport '@ionic\/react\/css\/text-transformation.css'\nimport '@ionic\/react\/css\/flex-utils.css'\nimport '@ionic\/react\/css\/display.css'\n\n\/**\n * Ionic Dark Mode\n * -----------------------------------------------------\n * For more info, please see:\n * https:\/\/ionicframework.com\/docs\/theming\/dark-mode\n *\/\n\n\/* import '@ionic\/react\/css\/palettes\/dark.always.css'; *\/\n\/* import '@ionic\/react\/css\/palettes\/dark.class.css'; *\/\nimport '@ionic\/react\/css\/palettes\/dark.system.css'\n\n\/* Theme variables *\/\nimport '.\/theme\/variables.css'\n\nsetupIonicReact()\n\nconst App: React.FC = () =&gt; (\n  &lt;IonApp&gt;\n    &lt;SupabaseProvider&gt;\n      &lt;IonReactRouter&gt;\n        &lt;IonRouterOutlet&gt;\n          &lt;Route exact path=\"\/home\"&gt;\n            &lt;Home \/&gt;\n          &lt;\/Route&gt;\n          &lt;Route exact path=\"\/logged\"&gt;\n            &lt;LoggedIn \/&gt;\n          &lt;\/Route&gt;\n          &lt;Route exact path=\"\/\"&gt;\n            &lt;Redirect to=\"\/home\" \/&gt;\n          &lt;\/Route&gt;\n        &lt;\/IonRouterOutlet&gt;\n      &lt;\/IonReactRouter&gt;\n    &lt;\/SupabaseProvider&gt;\n  &lt;\/IonApp&gt;\n)\n\nexport default App\n<\/code><\/pre>\n\n  <p>\n    This is mostly the stock App.tsx page that Ionic built for us but with the new Logged page. Feel free to style it up a little bit if you'd like.&nbsp;\n  <\/p>\n\n  <p>\n    We need to create the environment variables (remember the import.meta.env portions in our code), simply create the \/app\/.env.local file. These variables can be found in the supabase Data API settings page:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-jjef.png\" height=\"1002\" width=\"2234\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-jjef-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-jjef-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-jjef-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-jjef-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-jjef-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-jjef-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p class=\"filename\">\n    \/app\/.env.local\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>VITE_BASE_URL=http:\/\/localhost:5173\nVITE_SUPABASE_KEY=# The ANON key from Supabase\nVITE_SUPABASE_URL=# The project URL from Supabase\n<\/code><\/pre>\n\n  <p>\n    As a final rundown, your application structure should now look like this:\n  <\/p>\n<pre class=\"line-numbers  language-markdown\"><code>\/app\n.env.local\n  \/src\n  App.tsx\n  main.tsx\n    \/components\n      DebugComponent.tsx\n      LoginComponent.tsx\n    \/pages\n      Home.tsx\n      LoggedIn.tsx<\/code><\/pre>\n\n  <p>\n    Fire up the application with the `pnpm run dev` and you should now be able to log in!\n  <\/p>\n\n  <p class=\"msg msg--info\">\n    If the login process lands you on a 404 page, look at the url and verify that it's redirecting you to the local app properly. If it isn't check the Supabase URLs and change the \"localhost\" fallback to the proper location.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/preview-resized.gif\" height=\"570\" width=\"340\" alt=\"\" >\n      \n    <\/figure>\n\n  <p id=\"setting-up-capacitor\">\n    Before we move on let's kill the server by `cmd-c` in the terminal. This will end the local server and free us up a little bit for the next steps.\n  <\/p>\n\n    <h2 id=\"setting-up-capacitor\">\n      Setting Up Capacitor\n    <\/h2>\n\n  <p>\n    First off we need to get Capacitor setup for iOS and all the environment settings. We will be following the instructions here:&nbsp;<a href=\"https:\/\/capacitorjs.com\/docs\/getting-started\/environment-setup\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/capacitorjs.com\/docs\/getting-started\/environment-setup<\/a>\n  <\/p>\n\n  <p>\n    Since we will be building an iOS app I'll be focusing on getting that half setup. Adding Android isn't so bad and may be the topic for a future tutorial.\n  <\/p>\n\n  <p>\n    To build an iOS app you unfortunately need an Apple Developer account which costs $99\/year! It seriously took me about 8 years to really push myself over that cliff but it's a great way to inspire getting an app built and into the store. You can sign up for an account here:&nbsp;<a href=\"https:\/\/developer.apple.com\/account\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/developer.apple.com\/account<\/a>\n  <\/p>\n\n  <p>\n    Once you have an account created, download and install Xcode:&nbsp;<a href=\"https:\/\/developer.apple.com\/download\/applications\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/developer.apple.com\/download\/applications\/<\/a>\n  <\/p>\n\n  <p>\n    After installing Xcode, let's not open it yet and instead dive back to our app code. First we will install Capacitor in our app:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm i @capacitor\/core @capacitor\/ios\npnpm i -D @capacitor\/cli<\/code><\/pre>\n\n  <p>\n    With that we need to initialize Capacitor, this will create a couple files we need that helps build the project files for iOS:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm exec cap init<\/code><\/pre>\n\n  <p>\n    Before we add some of the iOS specific items we need to setup the Capacitor config file:\n  <\/p>\n\n  <p class=\"filename\">\n    app\/capacitor.config.ts\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>import type { CapacitorConfig } from '@capacitor\/cli'\n\nconst config: CapacitorConfig = {\n  appId: 'zone.wtft',\n  appName: 'WTFT Zone',\n  webDir: 'dist',\n}\n\nexport default config<\/code><\/pre>\n\n  <p>\n    Most of that file may be the same as what's there already but you'll want to modify the appId and appName.\n  <\/p>\n\n  <p>\n    Now we can finally add the Capacitor iOS capabilities:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm i @capacitor\/ios\n<\/code><\/pre>\n\n  <p>\n    Then run the build on the application to make it create the `\/dist` folder:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm run build<\/code><\/pre>\n\n  <p>\n    With the latest Capacitor there's an option to use the official Swift Package Manager vs Cocoapods. As of this writing it's still experimental but since there's not an obvious way to convert applications (yet) and we aren't using any 3rd party plugins we can confidently use this today. If you are using 3rd party plugins or have other oddities you might add in the future you may want to stick to Cocoapods for now.\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm exec cap add ios --packagemanager SPM<\/code><\/pre>\n\n  <p>\n    One last step before we open Xcode is to build and sync our application. This build and sync is something you'll have to do quite often because any changes to your application need to be bundled up and then placed into the native app. Get used to this command (you could even create a custom script in the package.json to make this easier\/shorter):\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm run build && pnpm exec cap sync<\/code><\/pre>\n\n  <p>\n    And now we can finally open Xcode with our nice project:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm exec cap open ios<\/code><\/pre>\n\n  <p>\n    That command will open Xcode with your workspace file. You don't always have to use that to open it, in the future you can simply just open Xcode and the workspace folder manually (or in the previously opened workspaces).\n  <\/p>\n\n  <p>\n    To run our application in a simulator click the dropdown and pick iPhone SE. Why? Well when I'm developing mobile\/web apps I find that it's always best to run it on the slowest\/oldest hardware that you officially support. This will help expose any performance or design issues you may have right away (simulators have the power of your laptop so performance isn't as realistic as it would be on a real device).\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-rxax.png\" height=\"432\" width=\"1282\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-rxax-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-rxax-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-rxax-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-rxax-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-rxax-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-rxax-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Once you've selected the simulator press the play button and watch the magic!\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-suhx.png\" height=\"625\" width=\"800\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    But wait you say. The auth is not sending me back to my own app.. it's sending me to a broken localhost page! Yes that's correct, remember we killed our local server but also even if it was running we'd simply land on that page.\n  <\/p>\n\n  <p>\n    Give it a try once, fire up the local server again:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>pnpm run dev<\/code><\/pre>\n\n  <p>\n    And then try to authenticate with the simulator again. You'll land on the logged page for that website, not back in your native app \ud83d\ude14. This is where Deep Links or as Apple calls them \"Universal Links\" comes into play.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/back-to-localhost.gif\" height=\"619\" width=\"320\" alt=\"\" >\n      \n    <\/figure>\n\n    <h2 id=\"deep-links-and-universal-links\">\n      Deep Links and Universal Links\n    <\/h2>\n\n  <p>\n    Deep Links allow you to have a simple url that opens up a native app if it's installed or just the website. Deep Links provide a great security measure compared to old app-like domains since there's a verification step to claim the domain and prove that it's yours. A good portion of this follows the Capacitor tutorial:&nbsp;<a href=\"https:\/\/capacitorjs.com\/docs\/guides\/deep-links\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/capacitorjs.com\/docs\/guides\/deep-links<\/a>\n  <\/p>\n\n  <p>\n    We will use Deep Links (or Universal Links as Apple likes to call them) to our app to allow the redirect that we get from the Google Authentication flow to open our app. This is a little complicated due to those security measures but worth it!\n  <\/p>\n\n  <p class=\"msg msg--highlight\">\n    Deep links do NOT work for every browser! If you are using Orion, Brave or other \"off-brand\" browsers the Deep Links may not actually open the native app. For this reason I half-feel this authentication procedure is not entirely the best but it's good for simple apps. Please be aware of this if you are building a production level app!<br><br>Even if you don't use Deep Links for authentication in the future it's still good to have for your application for general use. So these steps aren't wasted if you move to a more robust authentication procedure.<br>\n  <\/p>\n\n  <p>\n    Universal Links (I'll just use that term from now on) require the use of a special file on a website to allow Apple to validate that you own the domain. So first we need to build a website! We will use Github Pages for this purpose. If you want an example app to look at you can see it at my repo:&nbsp;<a href=\"https:\/\/github.com\/Kikketer\/wtftzone\/tree\/main\/packages\/website\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/Kikketer\/wtftzone\/tree\/main\/packages\/website<\/a>\n  <\/p>\n\n  <p class=\"msg msg--highlight\">\n    You will need to have a custom domain for this procedure to work. I've tried with just the &lt;username&gt;.github.io and it seems to cause issues for many users. It's best to just suck it up and get a cheap domain on Porkbun:&nbsp;<a href=\"https:\/\/porkbun.com\/tld\/click\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/porkbun.com\/tld\/click<\/a>\n  <\/p>\n\n  <p>\n    Before we go build a website we will tell Apple that we have an \"Identifier\" that our iOS app will use to link a domain to the app. Navigate to&nbsp;<a href=\"https:\/\/developer.apple.com\/account\/resources\/identifiers\/list\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/developer.apple.com\/account\/resources\/identifiers\/list<\/a>\n  <\/p>\n\n  <p>\n    Click the \"+\" icon:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tefa-2.png\" height=\"201\" width=\"500\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tefa-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tefa-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tefa-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tefa-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tefa-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tefa-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Select \"App ID\" and \"App\" type and then fill in the domain you've purchased but in reverse. This is an App ID that is used to uniquely identify your app (behind the scenes) in the Apple App Store and what we will use in Xcode to identify the app. A backwards url is typically how this is done.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tewl.png\" height=\"678\" width=\"1616\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tewl-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tewl-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tewl-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tewl-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tewl-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tewl-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Now scroll down that page, we will want to enable \"Associated Domains\" to allow our app to associate itself with the domain we've purchased (the actual domain that it'll attempt to attach to will be updated in Xcode):\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tfln.png\" height=\"612\" width=\"1182\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tfln-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tfln-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tfln-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tfln-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tfln-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tfln-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Ok phew, now we are finally ready to build a bare-minimum website that will host up a special file so that Apple knows that you own that domain and any links to that domain should open your app.\n  <\/p>\n\n    <h2 id=\"create-the-website\">\n      Create the Website\n    <\/h2>\n\n  <p>\n    Creating a static site on Github is pretty simple, their documentation can be a little confusing but we will be following these steps mostly:&nbsp;<a href=\"https:\/\/docs.github.com\/en\/pages\/getting-started-with-github-pages\/creating-a-github-pages-site\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/docs.github.com\/en\/pages\/getting-started-with-github-pages\/creating-a-github-pages-site<\/a>\n  <\/p>\n\n  <p>\n    First let's create a new Github repository. I'm assuming you've created one of these before, if not their signup process is pretty straight forward.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-stuc-2.png\" height=\"230\" width=\"320\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-stuc-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-stuc-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-stuc-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-stuc-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-stuc-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-stuc-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    The next screen you can fill in your repo name and create the README file. Having the file created here makes editing the repo just by using the browser nice and simple.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-suhx-2.png\" height=\"625\" width=\"800\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-suhx-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    After this step you will be presented with a pretty blank repo. Let's create a new file:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-svmd.png\" height=\"876\" width=\"1806\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-svmd-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-svmd-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-svmd-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-svmd-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-svmd-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-svmd-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    We will then create the `.well-known\/apple-app-site-association` file:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-szdj.png\" height=\"241\" width=\"500\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-szdj-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-szdj-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-szdj-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-szdj-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-szdj-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-szdj-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Then we will paste in the following:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>{\n  \"applinks\": {\n    \"apps\": [],\n    \"details\": [\n      {\n        \"appID\": \"&lt;app id&gt;.&lt;domain&gt;\",\n        \"paths\": [\n          \"*\"\n        ]\n      }\n    ]\n  }\n}\n<\/code><\/pre>\n\n  <p>\n    You will need to change the appID to be what your site is. The app id comes from the Apple App we created earlier:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tavt.png\" height=\"830\" width=\"1668\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tavt-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tavt-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tavt-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tavt-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tavt-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tavt-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    The resulting item should look something like:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>\"appID\": \"PV2C5M6W98.wtft.zone\",<\/code><\/pre>\n\n  <p>\n    We need to create one more file in our repo so that we can tie our repo to the real domain we've purchased. Create a \"CNAME\" file (no extension):\n  <\/p>\n\n  <p class=\"filename\">\n    CNAME\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>wtft.zone<\/code><\/pre>\n\n  <p>\n    This gives Github the information it needs to tie your purchased domain to this site and that it should be used in this repo. Before we are through here though let's make a very basic html page so we know the site is working:\n  <\/p>\n\n  <p class=\"filename\">\n    index.html\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>&lt;head&gt;\n  &lt;title&gt;Basic Site&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;p&gt;Yay!&lt;\/p&gt;\n&lt;\/body&gt;<\/code><\/pre>\n\n  <p>\n    Your resulting repository should look something like this:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>.well-known\/\n  apple-app-site-association\nCNAME\nindex.html<\/code><\/pre>\n\n  <p>\n    Next we need to verify with Github that we own the custom domain. So head over to the global Settings &gt; Pages:&nbsp;<a href=\"https:\/\/github.com\/settings\/pages\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/settings\/pages<\/a>&nbsp;within Github.\n  <\/p>\n\n  <p>\n    Click \"Add Domain\" and enter your domain\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tpim-2.png\" height=\"230\" width=\"400\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tpim-2-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tpim-2-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tpim-2-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tpim-2-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tpim-2-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tpim-2-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Github will then give you instructions on what records to add to your domain register. I'm using Porkbun but yours may look different than this but the IP addresses, CNAME and TXT entries would look similar:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tnlf.png\" height=\"866\" width=\"1744\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tnlf-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tnlf-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tnlf-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tnlf-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tnlf-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tnlf-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    The IPs that you want your A type in the domain would be these (mostly here so you can copy\/paste):\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>185.199.108.153\n185.199.109.153\n185.199.110.153\n185.199.111.153\n<\/code><\/pre>\n\n  <p>\n    Back in Github you should pretty quickly see that it's able to verify your domain:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-trhp.png\" height=\"121\" width=\"320\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-trhp-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-trhp-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-trhp-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-trhp-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-trhp-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-trhp-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    This means you can now use this domain in our repository, so lets head back to the repo and go to Settings &gt; Pages within that specific repository. You can now enter in the custom domain we've verified.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tlym.png\" height=\"1116\" width=\"1750\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tlym-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tlym-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tlym-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tlym-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tlym-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tlym-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Hopefully quickly it'll verify your domain. However the HTTPS portion of the domain won't be instant. This may take up to a day so this is a great opportunity to get up and stretch your legs (same for me).\n  <\/p>\n\n  <p>\n    Once it's verified you should be able to navigate to your domain and see that boring html page we created! Even better test is to navigate to the `.well-known\/apple-app-site-association` location where it'll attempt to download the file. That means we are good to go with linking our app to this domain!\n  <\/p>\n\n    <h2 id=\"associate-the-app\">\n      Associate the App\n    <\/h2>\n\n  <p>\n    We will be following the tutorial:&nbsp;<a href=\"https:\/\/capacitorjs.com\/docs\/guides\/deep-links\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/capacitorjs.com\/docs\/guides\/deep-links<\/a>\n  <\/p>\n\n  <p>\n    Back in Xcode we need to now leverage all of these things we've built to allow our app to use the Universal Link and domain verification we've done. Click the Targets &gt; App and open the Signing &amp; Capabilities tab then click + Capability:\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tvko.png\" height=\"1098\" width=\"1526\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tvko-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tvko-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tvko-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tvko-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tvko-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tvko-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Then add the \"Associated Domains\" capability (does that sound familiar?):\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-twqr.png\" height=\"906\" width=\"1174\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-twqr-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-twqr-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-twqr-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-twqr-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-twqr-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-twqr-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    Within the new Associated Domains section we want to create a Debug and Release version of the entries.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/SCR-20250222-tyud.png\" height=\"930\" width=\"1238\" alt=\"\"  sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tyud-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tyud-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tyud-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tyud-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tyud-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/3\/responsive\/SCR-20250222-tyud-2xl.png 1920w\">\n      \n    <\/figure>\n\n  <p>\n    The Debug version will have the additional search parameter on it to allow us to directly check the domain for the apple-app-page-association file vs using their CDN (which can take awhile to update)\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>Debug:\napplinks:wtft.zone?mode=developer\nRelease:\napplinks:wtft.zone<\/code><\/pre>\n\n  <p>\n    Obviously alter those to match your domain.\n  <\/p>\n\n  <p>\n    Finally back in our app we want to tell it to redirect to this domain of ours when we finish authentication. Remember the original issue we had where we were being redirected to localhost, well now we want to be redirected to our custom domain.\n  <\/p>\n\n  <p>\n    The easiest way is to simply alter your `.env.local` file but I find that annoying when you are developing the app in the browser and the simulator. So I put a custom script in my package.json file to do the build and sync for me each time:\n  <\/p>\n\n  <p class=\"filename\">\n    package.json\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>\"sync\": \"VITE_BASE_URL=https:\/\/wtft.zone pnpm run build && pnpm exec cap sync\",<\/code><\/pre>\n\n  <p>\n    Back at our app we need to actually handle this Universal\/Deep Link as well.&nbsp; Capacitor gives us a hook to be able to listen to the event that the native app was launched via a Deep Link.\n  <\/p>\n\n  <p>\n    Create a component called DeepLinkHandler.tsx:\n  <\/p>\n\n  <p class=\"filename\">\n    components\/DeepLinkHandler.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>\/\/ https:\/\/capacitorjs.com\/docs\/guides\/deep-links#react\nimport { useEffect } from 'react'\nimport { useHistory } from 'react-router-dom'\nimport { App, URLOpenListenerEvent } from '@capacitor\/app'\nimport { useSupabase } from '.\/SupabaseProvider'\n\nexport const DeepLinkHandler = () =&gt; {\n  let history = useHistory()\n  const { supabase } = useSupabase()\n\n  useEffect(() =&gt; {\n    App.addListener('appUrlOpen', (_event: URLOpenListenerEvent) =&gt; {\n      \/\/ We get the access_token and potentially the refresh_token from the url:\n      const url = new URL(_event.url)\n      const params: Record&lt;string, string&gt; | undefined = url.hash\n        ?.substring(1)\n        ?.split('&')\n        ?.reduce((acc: Record&lt;string, string&gt;, s) =&gt; {\n          acc[s.split('=')[0]] = s.split('=')[1]\n          return acc\n        }, {})\n\n      const access_token = params?.['access_token'] ?? ''\n      const refresh_token = params?.['refresh_token'] ?? ''\n\n      \/\/ Only sign in if we got an accessToken with this request\n      if (access_token) {\n        supabase.auth.setSession({ access_token, refresh_token })\n      }\n\n      \/\/ Dive deep into the app if we have a specific place we were told to go:\n      const slug = url.pathname\n      history.push(slug)\n    })\n  }, [])\n\n  return null\n}\n<\/code><\/pre>\n\n  <p>\n    This code will add the listener for the deep links within the Capacitor app and place the resulting auth tokens to set the session. Once this is set in Supabase we are officially authenticated to Supabase!\n  <\/p>\n\n  <p>\n    Your app structure should now look like this:\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>\/app\n.env.local\n  \/src\n  App.tsx\n  main.tsx\n    \/components\n      DeepLinkHandler.tsx\n      DebugComponent.tsx\n      LoginComponent.tsx\n    \/pages\n      Home.tsx\n      LoggedIn.tsx<\/code><\/pre>\n\n  <p>\n    We just need to add this to the App file so that it runs when the application starts up:\n  <\/p>\n\n  <p class=\"filename\">\n    App.tsx\n  <\/p>\n<pre class=\"line-numbers  language-jsx\"><code>\/\/\/... previous code\nconst App: React.FC = () =&gt; (\n  &lt;IonApp&gt;\n    &lt;SupabaseProvider&gt;\n      &lt;IonReactRouter&gt;\n        &lt;DeepLinkHandler \/&gt; &lt;&lt; Adding this within the Router\n        &lt;IonRouterOutlet&gt;\n          &lt;Route exact path=\"\/home\"&gt;\n            &lt;Home \/&gt;\n          &lt;\/Route&gt;\n\/\/\/ ... previous code<\/code><\/pre>\n\n  <p>\n    After this addition we can build and sync the application `pnpm run sync` which will set the environment variable for the base url, build the application then sync it to the native app. Then all you need to do is re-run the native app in Xcode.\n  <\/p>\n\n    <figure class=\"post__image post__image--center\">\n      <img loading=\"lazy\" src=\"https:\/\/cjweed.com\/media\/posts\/3\/app-last.gif\" height=\"619\" width=\"320\" alt=\"\" >\n      \n    <\/figure>\n\n  <p>\n    Did you see that? The native app was launched and we can see the user information is shown to us! We are now authenticated to Supabase via Google and can now build the rest of the app!\n  <\/p>\n\n  <p>\n    Holy awesome batman that was a long process but you've made it.&nbsp; Now time for the gotchas\n  <\/p>\n\n    <h2 id=\"known-issues\">\n      Known Issues\n    <\/h2>\n\n  <p>\n    Here are some known issues, and with these known issues I'm personally doubting that this is a production ready procedure. But with the goal of \"no extra code for native app\" and \"simple side-projects\" this seems to work fairly well. If anything it gets you into a good position to do the extra steps of native-specific authentication.\n  <\/p>\n\n  <p>\n    Here's a list of things I've come across so far, this list may grow\/shrink as I adjust and learn:\n  <\/p>\n\n  <ul>\n    <li>There are some browsers that will not launch the native apps using Universal Links. Orion and Brave are two that I know of. That should\/would account for a tiny percentage of the population but it's difficult\/tricky to know if the user is unable to use your native app because they will simply land on a working page on the web instead of the app.<\/li><li>This only works with the \"prompt: 'confirm'\" option in the Google provider options. It appears that Universal Links do not trigger and load the native app if it's from a redirect. So the extra step process of the confirm windows in the browser allow the Universal Link to work properly.&nbsp;<\/li>\n  <\/ul>\n\n    <h2 id=\"next-steps\">\n      Next Steps\n    <\/h2>\n\n  <p>\n    With the known issues of the different browsers I'm expanding this tutorial to handle the in-app browser experience. This update will require some changes to the code that handle some native-device specifics. The goal of this post was to see how we can add auth without making any specific changes like that.\n  <\/p>\n\n  <p>\n    I would recommend looking at the next post to add the in-app browser experience if you plan to make any of these things production ready. The in-app experience is more inline with the typical process of a true native app and guarantees that the redirect works since it's using the internal browser (Safari in this case).\n  <\/p>\n\n  <p>\n    <a href=\"https:\/\/cjweed.com\/capacitor-supabase-react\/\">Using the In-App Browser for Authentication<\/a>\n  <\/p>\n\n    <h2 id=\"credits-and-references\">\n      Credits and References\n    <\/h2>\n\n  <ul>\n    <li>Ionic Docs:&nbsp;<a href=\"https:\/\/ionicframework.com\/docs\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/ionicframework.com\/docs\/<\/a><\/li><li>Capacitor Docs:&nbsp;<a href=\"https:\/\/capacitorjs.com\/docs\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/capacitorjs.com\/docs\/<\/a><\/li><li>Supabase Docs:&nbsp;<a href=\"https:\/\/supabase.com\/docs\/guides\/getting-started\/quickstarts\/reactjs\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/supabase.com\/docs\/guides\/getting-started\/quickstarts\/reactjs<\/a><\/li><li>Capacitor + Android Inspiration:&nbsp;<a href=\"https:\/\/forum.ionicframework.com\/t\/setting-up-supabase-google-oauth-with-capacitor-android\/234165\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/forum.ionicframework.com\/t\/setting-up-supabase-google-oauth-with-capacitor-android\/234165<\/a><\/li>\n  <\/ul>","image":"https:\/\/cjweed.com\/media\/posts\/3\/Supa.png","author":{"name":"Chris"},"tags":["web","tutorial","learning"],"date_published":"2025-02-22T09:14:07-06:00","date_modified":"2026-02-08T11:39:25-06:00"},{"id":"https:\/\/cjweed.com\/pokemon-rescue-makecode-arcade\/","url":"https:\/\/cjweed.com\/pokemon-rescue-makecode-arcade\/","title":"Pokemon Rescue - MakeCode Arcade","summary":"This is the 3rd in a series of the Pokemon Rescue game, this time I decided to use MakeCode Arcade to build it. Given the struggles I had with GBStudio and GDevelop I thought I could give this platform a try, the biggest draws were&hellip;","content_html":"<p>This is the 3rd in a series of the Pokemon Rescue game, this time I decided to use <a href=\"https:\/\/arcade.makecode.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">MakeCode Arcade<\/a> to build it. Given the struggles I had with GBStudio and GDevelop I thought I could give this platform a try, the biggest draws were the fact that I could write using TypeScript and it's actually something that could be played on a <a href=\"https:\/\/www.kittenbot.cc\/products\/meowbit-codable-console-for-microsoft-makecode-arcade\" target=\"_blank\" rel=\"noopener noreferrer\">handheld device<\/a>!<\/p>\n<h2>Goals<\/h2>\n<ol>\n<li>Have the game be simple, my young daughter is the target audience<\/li>\n<li>Have it be portable, she'd like to be able to play it while on the move<\/li>\n<li>Have something to do with animals, she loves animals<\/li>\n<li>Challenge me in terms of code level and graphics (also learn MakeCode Arcade)<\/li>\n<\/ol>\n<h2>Overall Game Challenges<\/h2>\n<p>After some thought I decided to make the game a sort of \"rescue\" where instead of accepting dogs and cats you'd accept Pokemon characters. Bonus with these if you feed and keep them happy they could have the opportunity to grow (sorry I don't know the terms for the later level Pokemon).<\/p>\n<p>Feeding the Pokemon is relatively simple but posed some solid programming challenges, mostly around \"where is the Pokemon\" and \"are there other Pokemon in this same zone\".<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/2\/SCR-20250225-oufz.png\" alt=\"\" width=\"1390\" height=\"1012\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-oufz-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-oufz-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-oufz-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-oufz-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-oufz-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-oufz-2xl.png 1920w\"><figcaption>The Pokemon will feed if put into these pens, but not if there's more than one.<\/figcaption><\/figure>\n<p>I ended up creating 3 \"zones\" where the Pokemon could feed and had to check all the other Pokemon to see if they are also within that zone. If there were more than just one in a specific zone then they wouldn't eat.<\/p>\n<p>On the counter of the food, there's also a happiness level. This happiness level is decreased slowly while the Pokemon are not in the play area. This includes the food area, so they will slowly become less happy even while they eat. The game is to constantly move the Pokemon from the food to the play area to try and keep them fed and happy.<\/p>\n<p>Other fun items added to the game include a computer (always wanted to make a computer interface inside of a computer interface) where I had to hand build a UI for the computer. It was surprisingly difficult to get the cursor to look and work naturally along with showing the data of all the Pokemon.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/2\/SCR-20250225-ozri.png\" alt=\"\" width=\"500\" height=\"373\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-ozri-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-ozri-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-ozri-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-ozri-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-ozri-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-ozri-2xl.png 1920w\"><figcaption>User Interfaces look easy from a distance, but actually writing them is tricky<\/figcaption><\/figure>\n<h3>Fast vs Slow \"tick\"<\/h3>\n<p>Some of the overall game techniques I ended up discovering are things I'll likely use for future games. One of those is the aspect of a \"fast\" and \"slow\" tick.<\/p>\n<p>Basically my goal was to reduce \"forever\" running blocks to update stats, move creatures and other time based things. I could have created a forever block in each creature or every other component, but to me that felt like it would slow the game down. So I created a global tick block:<\/p>\n<p class=\"filename\">main.ts<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/2\/SCR-20250225-owxs.png\" alt=\"\" width=\"320\" height=\"202\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-owxs-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-owxs-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-owxs-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-owxs-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-owxs-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/SCR-20250225-owxs-2xl.png 1920w\"><figcaption>A \"forever\" block that triggers slow ticks for elements<\/figcaption><\/figure>\n<p>I have a \"slow\" and \"fast\" which are the same except they have different pause levels but do the same sort of calls to the Critters and Events.\u00a0 The Critters and Events loop over their own inventory of things (Critters for example keeps track of a list of critters in the game and propagates that event for each).<\/p>\n<p>This of course does cause the slight angle of things either updating at the same time but I added some random \"should I move\" or \"should I eat\" per creature\/element so the overall look is quite random and feels natural.<\/p>\n<h2>Coding Experience<\/h2>\n<p>The development environment for MakeCode Arcade is absolutely great. Their editor is completely online and I've actually been able to use it to teach a video game class!<\/p>\n<p>The best part of their experience is the fact that you can move somewhat freely between block coding (which the kids love) and Typescript. This allows anyone to see some direct \"how this looks\" when you transition between the two. For me where I wouldn't touch block coding with a 10' pole, it actually was quite useful to learn what capabilities I could use within the framework.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/2\/transition.png\" alt=\"\" width=\"320\" height=\"259\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/2\/responsive\/transition-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/transition-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/transition-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/transition-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/transition-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/2\/responsive\/transition-2xl.png 1920w\"><figcaption>Blocks can easily become real Typescript code, and back again<\/figcaption><\/figure>\n<p>I would use this transition between blocks and code quite a bit to learn how to build what I was going for. Eventually I was confident enough to know what global component to use for what. They have great typeahead as well and checking, but using the blocks to learn that `scene` is a global variable is great experience. I wonder if other frameworks could do something like this.<\/p>\n<h2>Conclusion<\/h2>\n<p>I realize that a lot of this isn't new to any vet game developer. This post (and this entire blog) is mostly for me to look back at some of the things I've built and the enjoyment I had building it.<\/p>\n<p>The game is not actually complete at this point. There was quite a bit more I wanted to do such as actual adoptions baed on how happy the Pokemon were and their \"level\". But I found after playing it for awhile that the game actually wasn't much fun! I'm sure there's way to make everyday chores exciting, maybe there's something I could add to make this more exciting but I ran out of motivation.<\/p>\n<p>Feel free to play the game however, it's a nice experience and may inspire the next amazing game!<\/p>\n<div style=\"position: relative; height: 0; padding-bottom: 117.6%; overflow: hidden;\"><div class=\"post__iframe\"><iframe loading=\"lazy\" style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%;\" src=\"https:\/\/arcade.makecode.com\/---run?id=S26462-36447-03400-66973\" allowfullscreen=\"allowfullscreen\" sandbox=\"allow-popups allow-forms allow-scripts allow-same-origin\" frameborder=\"0\"><\/iframe><\/div><\/div>","image":"https:\/\/cjweed.com\/media\/posts\/2\/SCR-20250225-pbvz.png","author":{"name":"Chris"},"tags":["videogame","learning"],"date_published":"2022-11-06T14:12:00-06:00","date_modified":"2025-02-25T18:35:01-06:00"},{"id":"https:\/\/cjweed.com\/pokemon-rescue-gbstudio\/","url":"https:\/\/cjweed.com\/pokemon-rescue-gbstudio\/","title":"Pokemon Rescue - GBStudio","summary":"Moving from\u00a0GDevelop\u00a0to\u00a0GB Studio\u00a0to and really gaining traction on the game development. In my previous post about the game development of Pokemon Rescue I explained how I decided on using GDevelop to quickly create a game for my daughter. The idea was to keep it simple&hellip;","content_html":"<p>Moving from\u00a0<a href=\"https:\/\/gdevelop-app.com\/\">GDevelop<\/a>\u00a0to\u00a0<a href=\"https:\/\/www.gbstudio.dev\/\">GB Studio<\/a>\u00a0to and really gaining traction on the game development.<\/p>\n<h2>Moving to GBStudio<\/h2>\n<p>In my previous post about the game development of <a href=\"https:\/\/cjweed.com\/pokemon-rescue-gdevelop\/\">Pokemon Rescue<\/a> I explained how I decided on using GDevelop to quickly create a game for my daughter. The idea was to keep it simple and force myself into a limited environment.<\/p>\n<p>In today's realm of web and mobile technology, there's really no limit to what you can do. That can be entirely overwhelming for anyone learning something new, I've tried several times to build a video game using things like <a href=\"https:\/\/phaserjs.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">PhaserJS<\/a>. However whenever I start a project like this I always get hung up for hours on the development environment, graphics and \"what limits should I put on myself\".<\/p>\n<p><a href=\"https:\/\/gdevelop-app.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">GDevelop<\/a> opened my eyes to the \"drag and drop IDEs\" that have been built to create games. And my experience in GDevelop has been amazing. I was able to quickly create a small video game and focus on the fun stuff instead of useless little details that make me twitch like code formatting.<\/p>\n<p>Then I discovered <a href=\"https:\/\/www.gbstudio.dev\/\" target=\"_blank\" rel=\"noopener noreferrer\">GBStudio<\/a> that was geared for building games for GameBoy. This satisfied nearly the exact requirements I set for myself: simple, limited and playable on dedicated hardware. With that I decided to give GBStudio a real chance.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/8\/pokemon-rescue-gb-drag-drop.webp\" alt=\"GB Studio screenshot of the Pokemon Rescue game\" width=\"658\" height=\"497\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-drag-drop-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-drag-drop-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-drag-drop-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-drag-drop-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-drag-drop-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-drag-drop-2xl.webp 1920w\"><\/figure>\n<h2>Some Clear Progress<\/h2>\n<p>Within a few days (these are parent\/adult days, where I only get to spare a few hours) I was able to get a game built out that mirrored the same functionality that I had in GDevelop!<\/p>\n<p>As I was building and adapting the game, I had to take into account a few more limitations that I think actually improved the game. This reminds me of the other things I'm studying around web accessibility: making a website accessible tends to make the site even better than you first imagined.<\/p>\n<p>I started by making sure I could do the more difficult requirement: \"carry a creature from one space to another\". Unlike what I built in GDevelop, I wasn't able to simply take a sprite and move it with the character. I had to create a \"carrying\" sprite for the player and show\/hide the creature being carried. This actually turned out quite well and is exciting to see how it works.<\/p>\n<p>With this new \"carrying\" technique figured out I changed my initial plan to be more of a \"pick up and carry\" game vs a menu-driven game for each creature. This type of \"just carry creatures around\" aspect the game actually became much more fun. I'm still working out all the details but here are a few initial screens:<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/8\/pokemon-rescue-gb-pickup.gif\" alt=\"A pixelart character picking up a monster\" width=\"300\" height=\"272\"><\/figure>\n<h2>Development Experience in GBStudio<\/h2>\n<p>GBStudio a bit more buggy than GDevelop as there are several times when I attempt to use one of their more advanced features and it doesn't work as expected. There's not much feedback for the developer either as I've not yet found a \"run in debug mode\" type of thing. I've actually had to use in-game dialogs to debug what variables are set to.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/8\/pokemon-rescue-gb-crazy-nest.webp\" alt=\"A giant nested if check within GBStudio\" width=\"485\" height=\"616\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-crazy-nest-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-crazy-nest-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-crazy-nest-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-crazy-nest-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-crazy-nest-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-crazy-nest-2xl.webp 1920w\"><\/figure>\n<p>The drag and drop nature of the IDE can feel a bit cumbersome at times as well especially when you are already a developer. A bug I've filed recently really makes my head hurt because of my ingrained knowledge of if checks.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/8\/pokemon-rescue-gb-dialog-bug.webp\" alt=\"GBStudio showing a bug found within the application\" width=\"822\" height=\"437\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-dialog-bug-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-dialog-bug-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-dialog-bug-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-dialog-bug-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-dialog-bug-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/8\/responsive\/pokemon-rescue-gb-dialog-bug-2xl.webp 1920w\"><\/figure>\n<h2 id=\"abandoned\">Abandoned<\/h2>\n<p>Updated Jan 1st 2022: I've walked away from GBStudio for now since there were some critical things that I was not able to do. The two major issues were:<\/p>\n<ol>\n<li>Performance issues around movement<\/li>\n<li>Update for each critter paused when off screen<\/li>\n<\/ol>\n<p>For the \"performance issues around movement\", I had the critters move one space at a time using a random number (1-4 one for each direction). The problem wasn't so much that the random number was slowing things down, it was the actual movement. I found that while a critter was moving the entire game slowed dramatically. My goal was to have 10 critters at a time, but the game was unplayable at 4.<\/p>\n<figure class=\"post__video\"><video loading=\"lazy\" width=\"600\" height=\"300\" controls=\"controls\" data-mce-fragment=\"1\">\n<source src=\"..\/media\/files\/pokemon-gb-move-performance.mp4\" type=\"video\/mp4\" \/><\/video><\/figure>\n<p>The \"update offscreen\" issue comes from an inherent GB performance necessity to keep the game running smoothly. The onUpdate logic was great, each critter had it's own bit of code to run to add or subtract it's health and happiness on a timer. Simply walking far enough away from a critter would allow it to live and be happy forever. I want the constant \"oh better go check on X critter\" feeling in my game.<\/p>\n<p>A suggested solution was to make a single actor, always visible that maintained all of the other critters. But the way GBStudio is built you can not access \"internal\" variables for an actor from a separate actor. This means I would have to have all the health and happiness of each actor tracked in individual global variables.<\/p>\n<p>All of these limitations are fantastic to have when attempting to build something. I loved that GBStudio forced me to re-evaluate the actual game itself and made the game simpler and more fun at the same time. The GDevelop version had a whole menu system to pet, pick up and feed the critters which now feels very clunky and annoying. GBStudio forced me to make it a simple \"pick up a critter and place it where it needs to be\" game.<\/p>\n<p>I've updated GDevelop version to remove the menu but now I'm going to try and build this game using <a href=\"https:\/\/arcade.makecode.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">MakeCode Arcade<\/a> because it has the ability to use dedicated <a href=\"https:\/\/www.amazon.com\/Kittenbot-Card-Sized-Computer-Microsoft-Compatible\/dp\/B07XSWXPZL\/ref=sr_1_1_sspa\" target=\"_blank\" rel=\"noopener noreferrer\">external hardware<\/a> very similar to the GameBoy. I'll be posting my adventure with that platform next.<\/p>","image":"https:\/\/cjweed.com\/media\/posts\/8\/PokemonGBCover.png","author":{"name":"Chris"},"tags":["videogame","learning"],"date_published":"2021-12-26T11:14:00-06:00","date_modified":"2025-02-23T11:41:11-06:00"},{"id":"https:\/\/cjweed.com\/pokemon-rescue-gdevelop\/","url":"https:\/\/cjweed.com\/pokemon-rescue-gdevelop\/","title":"Pokemon Rescue - GDevelop","summary":"Building a video game that allows my daughter to do what she wants with Pokemon characters: Care for them. The idea is pretty simple for this video game: You run an animal rescue where you must care for the animals you accept and try to&hellip;","content_html":"<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/7\/pokemon-rescue-gdevelop.png\" alt=\"A GDevelop screenshot of the code that looks like a spreadsheet\" width=\"827\" height=\"437\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/7\/responsive\/pokemon-rescue-gdevelop-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/7\/responsive\/pokemon-rescue-gdevelop-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/7\/responsive\/pokemon-rescue-gdevelop-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/7\/responsive\/pokemon-rescue-gdevelop-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/7\/responsive\/pokemon-rescue-gdevelop-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/7\/responsive\/pokemon-rescue-gdevelop-2xl.png 1920w\"><\/figure>\n<p>Building a video game that allows my daughter to do what she wants with Pokemon characters: Care for them.<\/p>\n<h2>The Idea<\/h2>\n<p>The idea is pretty simple for this video game: You run an animal rescue where you must care for the animals you accept and try to get them adopted.<\/p>\n<p>The difference here is that it uses Pokemon as the animals.<\/p>\n<p>Like many other projects, I'm not intending to make any money on this at all. Or even release it to the wild. The goal will be to have a game that my daughter would enjoy playing and I learn a few things around game development.<\/p>\n<h2>Requirements<\/h2>\n<ol>\n<li>Simple to build, I don't want to spend half a day getting the code formatting worked out. I do that every day at work, I don't want that in my free time.<\/li>\n<li>Dedicated hardware or at least can be dedicated (like an iPad since she knows how to use that)<\/li>\n<li>A top down RPG-like game where you are able to pet, feed and carry the animals around to put them into pens or outside to play<\/li>\n<li>The animals slowly degrade in health and happiness, petting, feeding and letting out to play will help<\/li>\n<li>Depending on the health and happiness of the animals they have a chance to be adopted<\/li>\n<\/ol>\n<h2>Learning Path<\/h2>\n<p>There are a TON of options for building a video game. I remember making a game in Q-Basic back when I was learning to code (middle school) and had a great time. I'd like to recapture that fun but I don't have much time to spend working out the baseline framework.<\/p>\n<p><strong><a href=\"https:\/\/phaser.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">PhaserJS<\/a><\/strong>. I've been looking at using and learning PhaserJS for a few years but it may be too low-level for the time commitment I have for this project. It will remain on my radar for future games but the options of other platforms have exploded and the exportable targets for this platform are almost too limited.<\/p>\n<p><strong><a href=\"https:\/\/arcade.makecode.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">MakeCode Arcade<\/a><\/strong>. My son and I are loving this environment because it's easy to use and gets you started quickly. It has dedicated hardware options which was a nice touch. However it's more geared for learning how to code and not producing \"real\" games.<\/p>\n<p><strong><a href=\"https:\/\/gdevelop-app.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">GDevelop<\/a><\/strong>. This platform looks promising. I spent a couple weeks looking and playing around with this environment. The whole drag\/drop thing was hard for me to get over as a developer but you still need to know the \"overall mindset\" of a developer to get anything useful done. I produced a pretty solid proof of concept with this environment in a short amount of time.<\/p>\n<p><strong><a href=\"https:\/\/www.gbstudio.dev\/\" target=\"_blank\" rel=\"noopener noreferrer\">GB Studio<\/a><\/strong>. This may be my end goal. The idea that the dedicated hardware is a GameBoy is a fantastic fit! The game size is limited, graphics are simple and the tool looks easy to use and build. This will likely be where I port the game to after I get something built with GDevelop.<\/p>\n<h2>The Results<\/h2>\n<p>This game is far from complete and my goal is to have it done by the end of December 2021. It's been nice using GDevelop to be able to sit down for a few minutes and accomplish a feature.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/7\/pokemon-rescue-clips-and-doors.gif\" alt=\"An animation of a lady walking out of fenced area and approaching a monster\" width=\"680\" height=\"516\"><\/figure>\n<p>Using standard repository features I was able to make sure this application was saved and had history in case things get knotted up.<\/p>\n<p>As I was building it I discovered GBStudio and had a few regrets that I didn't start there. But that's the purpose of a proof of concept, learn the environment and get a sense of the viability of this project.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/7\/pokemon-rescue-drop-off.gif\" alt=\"A pixelart character picking up a monster with a little menu system\" width=\"680\" height=\"516\"><\/figure>\n<p>My plan is to use GDevelop to create the game that satisfies the requirements I have above. My daughter should be able to play it on the iPad for now. Then I want to move it over to GB Studio and put it on a GameBoy using a re-programmable cartridge.<\/p>\n<p>Stay tuned! I'll be updating this or adding new posts as this project moves forward!<\/p>","image":"https:\/\/cjweed.com\/media\/posts\/7\/PokemonGDevelop.png","author":{"name":"Chris"},"tags":["videogame","learning"],"date_published":"2021-12-23T09:59:00-06:00","date_modified":"2025-02-23T11:41:39-06:00"},{"id":"https:\/\/cjweed.com\/card-studio-application\/","url":"https:\/\/cjweed.com\/card-studio-application\/","title":"Card Studio Application","summary":"I was helping my son create a new board game and was looking for an easy way to generate cards using CSV data. This is a small desktop (electron) app that kind of works. Repo There are many days where my son will attempt to&hellip;","content_html":"<p>I was helping my son create a new board game and was looking for an easy way to generate cards using CSV data. This is a small desktop (electron) app that kind of works.<\/p>\n<p><a href=\"https:\/\/github.com\/Kikketer\/CardStudio\" target=\"_blank\" rel=\"noopener noreferrer\">Repo<\/a><\/p>\n<h2>Card Studio Idea<\/h2>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/6\/card-studio-shot.png\" alt=\"A card editing studio example\" width=\"831\" height=\"455\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-shot-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-shot-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-shot-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-shot-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-shot-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-shot-2xl.png 1920w\"><\/figure>\n<p>There are many days where my son will attempt to build a board game. I love this since I've attempted this same thing many many times without much success (see <a href=\"#non-existing-post-with-id-4\">Catapults Game<\/a>). He proposed this pretty fantastic and simple game based on his love for <a href=\"https:\/\/www.goodreads.com\/series\/92037-wings-of-fire\" target=\"_blank\" rel=\"noopener noreferrer\">Wings of Fire<\/a>.<\/p>\n<p>During the creation of the game I wanted to have a way to quickly generate the playing cards. I know that <a href=\"https:\/\/www.thegamecrafter.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">The Game Crafter<\/a> created an application called <a href=\"https:\/\/component.studio\/\" target=\"_blank\" rel=\"noopener noreferrer\">Component Studio<\/a> which serves the purpose of building game components. This product has a monthly fee and since I change projects nearly daily, it didn't make much sense financially.<\/p>\n<p>But I'm cheap and I like to build things. I decided to attempt to build a desktop version of the application with the intent that this is free, easy and gets the job done well enough.<\/p>\n<h2>The Goals<\/h2>\n<p>The goals were simple:<\/p>\n<ul>\n<li>Allow the user to build a \"master\" template of the cards<\/li>\n<li>Read a CSV document to generate the cards<\/li>\n<li>Allow the use of a drag\/drop style interaction to design the cards<\/li>\n<li>Run entirely on the desktop, allowing a user to have a project that could be easily shared (think Github)<\/li>\n<\/ul>\n<h3>The User Flow<\/h3>\n<p>A user would open a \"project\" file, likely a JSON5 document (I love JSON5). This project file would have all the needed meta-data like project title and the like but also the definitions and descriptions for each \"deck\".<\/p>\n<p>The user then would be able to edit the \"master\" file of a deck which is sort of like a template for the entire deck. Using a specially crafted variable input they would be able to use the values that existed in the CSV document.<\/p>\n<p>Lastly the user would be able to click the \"generate\" button and would get a series of images that are \"Game Crafter ready\" that they could use to upload or print.<\/p>\n<h2>The Tools<\/h2>\n<p>Through building this application I used the following tools:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.electronjs.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Electron<\/a>: The foundation to make your web application be a desktop application. This technique isn't new and is used by many applications today.<\/li>\n<li><a href=\"https:\/\/konvajs.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Konva<\/a>: A great canvas library that allows you to draw on an HTML canvas.<\/li>\n<\/ul>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/6\/card-studio-drag-drop.gif\" alt=\"Dragging and dropping items onto the card to create the design\" width=\"680\" height=\"514\"><\/figure>\n<h2>The \"Conclusion\"<\/h2>\n<p>I've since moved away from this project since new things have landed on my plate. The game did make it all the way to <a href=\"https:\/\/www.thegamecrafter.com\/games\/dragon-world\" target=\"_blank\" rel=\"noopener noreferrer\">The Game Crafter<\/a> but didn't use Card Studio directly.<\/p>\n<p>I did however generate the cards used in the game using the same tools, I just didn't use the IDE that I was intending to build.<\/p>\n<p>Lastly this project is a bit paused right now mostly because I've not updated my OS on my MacBook Air and it seems the SASS dependencies no longer compile for the project.<\/p>\n<h2>The Learnings<\/h2>\n<p>I had a couple ah-ha moments when I realized that I could use a standard mindset of a network API to generate the cards without having to view the page each time.<\/p>\n<p>Previous adventures in this type of thing required me to render the entire card on a visible HTML page to export it as a .png file. This involved an annoying process of having to click each card and then click a \"download\" button.<\/p>\n<p>The solution was to have the cards render on the \"client\" (renderer) but hidden and their base64 encoded result would be sent to the \"backend\" (main) of Electron. From there the file can be saved directly to the file system.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/6\/card-studio-to-64.png\" alt=\"A red box turned 45 degrees comparing to another\" width=\"616\" height=\"406\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-to-64-xs.png 640w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-to-64-sm.png 768w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-to-64-md.png 1024w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-to-64-lg.png 1366w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-to-64-xl.png 1600w ,https:\/\/cjweed.com\/media\/posts\/6\/responsive\/card-studio-to-64-2xl.png 1920w\"><\/figure>\n<h2>The Future<\/h2>\n<p>I do plan to continue working on this fun project but I always need more inspiration. My kids are the source of all my inspiration and I'll likely come back to this project once my son decides to build yet another game.<\/p>","image":"https:\/\/cjweed.com\/media\/posts\/6\/dragon-world.png","author":{"name":"Chris"},"tags":["web","boardgame","application"],"date_published":"2020-06-21T09:40:00-05:00","date_modified":"2025-02-23T11:44:17-06:00"},{"id":"https:\/\/cjweed.com\/catapults-3d-printed-game-2\/","url":"https:\/\/cjweed.com\/catapults-3d-printed-game-2\/","title":"Catapults 3D Printed Game","summary":"Using the power of my 3D printers, I wanted to create a board game. Inspired by the NES game \"Rampart\" I created a fun little game that can mostly be created by anyone with a 3D printer. The Inspiration Inspired by an old NES game&hellip;","content_html":"<header class=\"header\"><\/header><main id=\"main\" class=\"main\">\n<article class=\"post\"><header class=\"post__header\">\n<div class=\"post__details\"><span style=\"color: var(--text-primary-color); font-family: var(--editor-font-family); font-size: inherit; font-weight: var(--font-weight-normal);\">Using the power of my 3D printers, I wanted to create a board game. Inspired by the NES game \"<\/span><a href=\"https:\/\/en.wikipedia.org\/wiki\/Rampart_(video_game)\" style=\"font-family: var(--editor-font-family); font-size: inherit; font-weight: var(--font-weight-normal);\">Rampart<\/a><span style=\"color: var(--text-primary-color); font-family: var(--editor-font-family); font-size: inherit; font-weight: var(--font-weight-normal);\">\" I created a fun little game that can mostly be created by anyone with a 3D printer.<\/span><\/div>\n<\/header>\n<div class=\"post__content\">\n<h2>The Inspiration<\/h2>\n<p>Inspired by an old NES game I wanted to use my newly\u00a0<a href=\"https:\/\/www.prusa3d.com\/category\/original-prusa-i3-mk3s\/\">purchased 3D printer<\/a>\u00a0and combine it with one of my passions: board game design.<\/p>\n<p>The original game was similar to Tetris where you'd received random shaped pieces and use them to build a complete castle.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/5\/catapults-nes-original.webp\" alt=\"Video game screen showing top down castles with catapults within them\" width=\"640\" height=\"480\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-nes-original-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-nes-original-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-nes-original-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-nes-original-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-nes-original-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-nes-original-2xl.webp 1920w\"><\/figure>\n<p>Once your castle was complete you'd be gain a number of cannons and had to find places for them within the castle walls.<\/p>\n<p>Both characters would then start launching cannon balls at the opposing players castle, attempting to wreck their castle for the next round of building.<\/p>\n<p>Players would play about three rounds and the player with the most cannons at the end was the winner.<\/p>\n<h2>Adapting to Physical Components<\/h2>\n<p>Creating a board game has many aspects that must be considered, a few of which are size, complexity and price.<\/p>\n<p>In a (typical) board game you do not have any automated processes or artificial intelligence, everything must be done by a human player. In video games you'd be able to use the computer to calculate complicated scores, perform large if\/then blocks of rules. Every bit of \"overhead\" that a human must do in a board game is something that detracts from the fun.<\/p>\n<p>First challenge I wanted to solve was the hectic feel of getting the random pieces.<\/p>\n<p>\"Hectic\" is an easy solve by having a timer. Players hate being rushed into decisions and this matched the original game since it had a timer around placing pieces of your castle. A simple sand timer was the solution.<\/p>\n<p>For the random pieces aspect I used a deck of cards. Cards are the cheapest part of any board game and are incredibly versatile. Each player would get a small deck of cards to draw from in the \"build\" phase using the timer.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/5\/catapults-deck.webp\" alt=\"Two cards showing wall shapes\" width=\"1569\" height=\"1255\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-deck-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-deck-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-deck-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-deck-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-deck-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-deck-2xl.webp 1920w\"><\/figure>\n<p>The second challenge was how to benefit the players for building a complete castle with these cards and pieces (see designing pieces next). I didn't want this game to be a \"dexterity game\" where you are physically throwing pieces around to see if they hit, that always ends up feeling cheep and is a mess.<\/p>\n<p>A simple solution was to re-use the deck of cards that you played to build your castle as a number system for the sizes of pieces you could remove. This left the player with bit of choice but restricted them based on how many pieces they were able to place within the build phase.<\/p>\n<p>Ok that was pretty easy, the two biggest challenges were out of the way... mostly. I still wanted to use the 3D printer and having it create the castle wall pieces made the most sense.<\/p>\n<h2>Designing the Components<\/h2>\n<p>For designing the 3D printed components I exclusively used\u00a0<a href=\"https:\/\/www.tinkercad.com\/\">Tinkercad<\/a>. It's incredibly easy to build simple shapes and it fit my \"just get it done\" attitude.<\/p>\n<p>By trial and error I was able to get a piece that not only printed without supports by using arches but allowed for enough gap to be placed quickly on a board.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/5\/catapults-pieces.webp\" alt=\"3D Designed wall pieces\" width=\"559\" height=\"299\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-pieces-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-pieces-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-pieces-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-pieces-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-pieces-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-pieces-2xl.webp 1920w\"><\/figure>\n<p>The board! Yes there needed to be a board, similar to a lego where the pieces would click into place but would be easier to place than an official LEGO style piece.<\/p>\n<p>I came up with a reasonable sized board that was a grid of raised squares. The pieces were Tetris shaped pieces with little \"grab\" handles on the top that kind of almost looked like a\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Battlement\">battlement<\/a>.<\/p>\n<p>I then made sure that each piece shape was a different color to allow grabbing of the pieces to be quick. We all know what it's like getting the \"L\" or \"J\" piece mixed up when playing Tetris.<\/p>\n<h2>Printing<\/h2>\n<p>I used\u00a0<a href=\"https:\/\/www.thegamecrafter.com\/\">The Game Crafter<\/a>\u00a0to print the box, cards, rules and provide the timer. The plan was to get these boxes printed then fill them with the 3D printed walls.<\/p>\n<p>I ordered a pile of colored filament and started printing away. I even ordered a backup printer as I was afraid the first was going to fail, the side effect was that I was able to double production.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/cjweed.com\/media\/posts\/5\/catapults-castle-example.webp\" alt=\"A topdown view of the final printed pieces\" width=\"1000\" height=\"814\" sizes=\"(max-width: 1920px) 100vw, 1920px\" srcset=\"https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-castle-example-xs.webp 640w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-castle-example-sm.webp 768w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-castle-example-md.webp 1024w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-castle-example-lg.webp 1366w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-castle-example-xl.webp 1600w ,https:\/\/cjweed.com\/media\/posts\/5\/responsive\/catapults-castle-example-2xl.webp 1920w\"><\/figure>\n<p>In the end I printed about 15 sets of pieces and bagged them all ready for their boxes.<\/p>\n<h2>Proposing to Publishers<\/h2>\n<p>I was able to propose this game to publishers during a \"speed dating\" style event at GenCon. I was chosen after submitting my one-page rundown of the game and since I was heading down there to play games, it was perfect timing.<\/p>\n<p>Almost every publisher that saw the game loved it and was able to play a round during the 2 or 3 minutes that we had to talk.<\/p>\n<p>However everyone quickly realized the cost of creating Catapults. Each piece required a different mold since they each needed to be their own color. The publishers that saw the game didn't have the means to take this high of a risk.<\/p>\n<p>I even talked to a printing company to see what it would take and they agreed the price was high for the perceived value of the game.<\/p>\n<p>In the end none of the publishers were ready to take my game.<\/p>\n<h2>The Results<\/h2>\n<p>This game is sitting in my basement, waiting to be played. I have several copies printed out and in baggies. I've since taken the official website down and this game shows up randomly at\u00a0<a href=\"https:\/\/www.gameholecon.com\/\">conventions<\/a> where I host when there's not a global pandemic.<\/p>\n<\/div>\n<\/article>\n<\/main><footer class=\"footer\">\n<div class=\"footer__content\">\u00a0<\/div>\n<\/footer>","image":"https:\/\/cjweed.com\/media\/posts\/5\/catapults-overall-board.webp","author":{"name":"Chris"},"tags":["boardgame","3dprinting"],"date_published":"2019-05-19T09:30:00-05:00","date_modified":"2025-02-23T09:35:54-06:00"}]}