<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Manuel AZ</title>
    <description>The latest articles on DEV Community by Manuel AZ (@manuelalzzum).</description>
    <link>https://dev.to/manuelalzzum</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1912582%2F2ac7fa1e-c861-4cfb-93ff-604ef88fb015.png</url>
      <title>DEV Community: Manuel AZ</title>
      <link>https://dev.to/manuelalzzum</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manuelalzzum"/>
    <language>en</language>
    <item>
      <title>Deploying Your SvelteKit App to GitHub Pages with a Custom Domain (Ditch GoDaddy for Porkbun)</title>
      <dc:creator>Manuel AZ</dc:creator>
      <pubDate>Tue, 17 Dec 2024 17:45:51 +0000</pubDate>
      <link>https://dev.to/manuelalzzum/deploying-your-sveltekit-app-to-github-pages-with-a-custom-domain-ditch-godaddy-for-porkbun-eln</link>
      <guid>https://dev.to/manuelalzzum/deploying-your-sveltekit-app-to-github-pages-with-a-custom-domain-ditch-godaddy-for-porkbun-eln</guid>
      <description>&lt;p&gt;It's 2023, I've been laid off, and I need a portfolio site to prove I know things. I sketch out a design in Figma but get sidetracked building a sauna in my basement. Spoiler: the sauna gets finished before the site.&lt;br&gt;
Fast forward - new job secured, but the portfolio mocks gather dust. Eight months later, I finally finish the site using Svelte, the shiny new framework with syntax I loved. But deploying it? Enter GoDaddy. Hours of wrestling with DNS settings and learning I'd need to buy and configure an SSL certificate left me frustrated. That's when I found Porkbun - transparent pricing, free SSL, and a painless setup.&lt;br&gt;
Now, let me show you how to get your Svelte app live, step by step, without the headaches I endured.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1: Install the Static Adapter
&lt;/h2&gt;

&lt;p&gt;SvelteKit offers a variety of &lt;a href="https://svelte.dev/docs/kit/adapters" rel="noopener noreferrer"&gt;adapters&lt;/a&gt; tailored to different deployment setups - Node.js servers, serverless platforms, edge functions, and more. The adapter you choose determines how your app gets deployed. For GitHub Pages, we'll use the @sveltejs/adapter-static, which is ideal for static site hosting.&lt;br&gt;
Install it as a development dependency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm add -D @sveltejs/adapter-static
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this adapter, your app is pre-rendered into static files during the build process, ready to go live. Simple and effective!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Configure Static Adapter
&lt;/h2&gt;

&lt;p&gt;Start by importing the newly installed package into your svelte.config.js file. Next, add the default configuration provided below. Feel free to tweak it to suit your needs, and refer to the adapter-static &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fsvelte.dev%2Fdocs%2Fkit%2Fadapter-static" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; for more details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import adapter from '@sveltejs/adapter-static';
import { sveltePreprocess } from 'svelte-preprocess';

export default {
 preprocess: sveltePreprocess({ ...sveltePreprocess() }),
 kit: {
  adapter: adapter({
   // default options are shown. On some platforms
   // these options are set automatically - see below
   pages: 'build',
   assets: 'build',
   fallback: 'index.html',
   precompress: false,
   strict: true
  })
 },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, run your build command and confirm that your project's output is in the build folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Hands-Free Deployment with GitHub Actions
&lt;/h2&gt;

&lt;p&gt;Add a .github/workflows folder to the root of your project, and inside it, create a deploy.yml file. This file tells GitHub Actions how to handle your app’s deployment. Here’s an example configuration—be sure to adjust it for the package manager you’re using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Deploy to GitHub Pages

on:
  push:
    branches:
      - main

jobs:
  build_site:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install pnpm
        uses: pnpm/action-setup@v3
        with:
          version: 8

      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: pnpm

      - name: Install dependencies
        run: pnpm install

      - name: Build
        env:
          BASE_PATH: '/${{ github.event.repository.name }}'
        run: pnpm run build

      - name: Upload Artifacts
        uses: actions/upload-pages-artifact@v3
        with:
          # This should match the `pages` option in your adapter-static configuration
          path: 'build/'

  deploy:
    needs: build_site
    runs-on: ubuntu-latest

    permissions:
      pages: write
      id-token: write

    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    steps:
      - name: Deploy
        id: deployment
        uses: actions/deploy-pages@v4

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

&lt;/div&gt;



&lt;p&gt;With this in place, every time you push changes to the main branch, GitHub will automatically deploy your app. You can verify the deployment by visiting your GitHub Pages default URL, which is typically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://&amp;lt;your-github-username&amp;gt;.github.io/&amp;lt;your-repo-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Porkbun Over GoDaddy — DNS Setup Made Easy
&lt;/h2&gt;

&lt;p&gt;Head over to &lt;a href="https://porkbun.com/?utm_source=Google_Search&amp;amp;utm_medium=General_Audience_Porkbun_Registrar&amp;amp;utm_campaign=Q1_2022&amp;amp;gad_source=1&amp;amp;gclid=CjwKCAiA34S7BhAtEiwACZzv4UGFosDnb9uReS8Sunch02GrVJ6Ia3hbizrjIdmi1uBOP-N2f03WZxoC2psQAvD_BwE" rel="noopener noreferrer"&gt;Porkbun&lt;/a&gt; and purchase your domain. Feel free to add any extras you want — I went with the most basic option, which cost $38.55.&lt;/p&gt;

&lt;p&gt;Next, go to your Domain Management page. Hover over the row for your domain, and you’ll see the DNS text appear — click it to open the settings modal (see the screenshot for reference).&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz60uq6md8gnzd6bsms2x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz60uq6md8gnzd6bsms2x.png" alt="Image description" width="800" height="68"&gt;&lt;/a&gt;&lt;br&gt;
With the modal open, scroll down to the Quick DNS Config section and select GitHub. This will automatically populate the necessary DNS records for your deployment, saving you possibly an hour of setup and sparing you the headache of worrying about SSL certificate configuration — unlike GoDaddy.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Step 5: Github page Settings
&lt;/h2&gt;

&lt;p&gt;The last step is to update your GitHub Pages settings and point them to your custom domain. Head to the settings page for your repository and navigate to the Pages section. Make sure the deploy source is set to GitHub Actions (since that’s how we’ve set up deployment).&lt;/p&gt;

&lt;p&gt;Next, paste your custom domain into the Custom Domain input field and save the changes. GitHub will start verifying your domain and setting up the SSL certificate. This might take some time, and you may need to refresh or retry for the Enforce HTTPS checkbox to become available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwerpc8gny3lel7thjv01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwerpc8gny3lel7thjv01.png" alt="Image description" width="800" height="607"&gt;&lt;/a&gt;&lt;br&gt;
Once everything is verified, your app will be live at your custom domain. Congratulations — you’ve officially deployed your Svelte app! 🎉&lt;/p&gt;

&lt;p&gt;Want to see an example in action? Check out my site &lt;a href="https://manuelaz.dev/" rel="noopener noreferrer"&gt;here&lt;/a&gt; and let me know what you think!&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>portfolio</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
