[Tutorial] How to deploy a SvelteKit Application on CyberPanel

Step 1: Install CyberPanel and Create Website

You first need to install CyberPanel and create your website . Skip this step if you have already done so. You can also issue SSL for this website.

I will be using svelte.mydomain.com as my example for this so change this to whatever your website domain is.

Step 2: Install Node.js via Command Line

Next step is to install Node.js via command line

$ cd ~
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\

Refer to the NodeSource documentation for more information on the available versions and instllation process for CentOS and AlmaLinux

$ sudo apt-get install -y nodejs
$ node -v

Step 3: Setup a Reverse Proxy

Follow this tutorial on how to Reverse Proxy a website then continue below.

Step 4: Setup AppServer Context to Serve SvelteKit Application

Open website launcher by visiting https:// < IP Address >:8090/websites/svelte.mydomain.com and click vHost conf to add the following context configurations, make sure this is on your backend website where your server files are located.

context / {
  type                    appserver
  location                /home/svelte.mydomain.com/public_html/backend
  binPath                 /usr/bin/node
  appType                 node
  maxConns                100
  rewrite  {
  addDefaultCharset       off

Step 5: Start SvelteKit Application

In my case i goto where my website files are located on my backened and type in this order:

npm install
npm run build
cd build
pm2 start index.js

Once all these steps are done you should have a working SvelteKit Application ran through a Reverse Proxy :slight_smile:

1 Like

@sxroot Can You Explain it more detail , Please @admin try to post a video on sveltekit deployment on cyperpanel’s youtube channel