🌐 🧭 SwiftyLaunch for Web
Deploying to Vercel

Account Settings View

AuthKit (SwiftyLaunch Module) - Account Settings View

Deploying your website to Vercel is quite straightforward. There are steps that you complete once, and steps that you complete every time you want to deploy a new version.

Initial Setup Overview

  1. Upload your codebase to GitHub
  2. Connect your GitHub repository to Vercel
  3. Deploy your website
  4. Enable Vercel Analytics
  5. Set your custom domain name

Deploying a new version

  1. Make your changes and commit them to the main branch
  2. Vercel will automatically detect the changes and deploy a new version

Initial Setup

Upload your codebase to GitHub

Create a new local git repository

During setup, you can choose whether you want SwiftyLaunch to initialize a new GitHub repository for your project, if you picked, true, skip this step.

SwiftyLaunch - Auto Create new GitHub repository

If not, go to your project folder, and initialize a new git repository by running:

git init

Create an initial commit by running:

git add .
git commit -m "Initial commit"

Create a new GitHub remote repository

Go to GitHub (opens in a new tab) (obviously log in), and in the top right corner click on the + icon and select New repository.

GitHub - New Repository Step 1

Then, give your repository a name, select the visibility (recommended: private), and click on Create repository.

GitHub - New Repository Step 2

Push your local repository to the remote repository

You will see a page of your new repository, but it will not have any code in it yet. Copy over the following command and paste it into your terminal. After a successfull push, reload the page and you should see your codebase in the remote repository.

Copy this: GitHub - Push your local repository to the remote repository

Run it in your terminal: GitHub - Push your local repository to the remote repository

Refresh the page and you should see your codebase in the remote repository: GitHub - Push your local repository to the remote repository

Connect your GitHub repository to Vercel

Go to Vercel (opens in a new tab), create an account / log in, and click on Add New → Project in the top right corner.

Vercel - New

Select your GitHub account, and press on Import next to the repository that we just created.

Vercel - Import

Here, enter your environment variables (by default, SwiftyLaunch only needs PostHog related variables, if you have enabled AnalyticsKit during setup. These are the veriables that you can find in the .env file in the root of your project). Press on Deploy.

Vercel - Project

After a few seconds your project will be built and you should see your deployed project dashboard.

Vercel - Project Dashboard

Press on one of the domains to visit your deployed project. Congrats, you've just deployed your website to Vercel!

There are a couple of other steps that we will go through in the next sections.

Enable Vercel Analytics

SwiftyLaunch includes Vercel Analytics out of the box. All thats needed for you is to press on the Enable button in the Vercel dashboard.

Vercel - Enable Analytics Vercel - Enable Analytics

After it's done, open your deployed project in the browser and next time you visit the dashboard, you will see the related analytics. It's that simple!

Vercel - Analytics

Set your custom domain name

If you have purchased a custom domain name, you can set easily set it up in the Vercel dashboard. Go to Settings → Domains → Add. Follow the steps to add your domain name.

Vercel - Add Domain

Deploying a new version

Make your changes and commit them to the main remote branch

Make your changes, make sure to add them and commit to the remote branch:

git add .
git commit -m "Your commit message"
git push -u origin main

Deployment

After a few seconds, Vercel will detect changes to your main branch, your project will be built and automatically deployed.

That's it! You've just deployed a new version of your website.