September, 10 2023

Deploying Staticus To Vercel

I just finished rebuilding my website using Staticus. Even though Staticus is a static site generator, it requires PHP for Vercel deployment. This is because Staticus executes php vendor/bin/staticus build command when npm run prod command runs.

After a lot of tries, I found an article by Statamic and I just had to make a few modification to the deployment script.

Here is the modified bash script for Staticus deployment:


# Install PHP & WGET
yum install -y amazon-linux-extras
amazon-linux-extras enable php8.1
yum clean metadata
yum install php php-{common,curl,mbstring,gd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
yum install wget

EXPECTED_CHECKSUM="$(wget -q -O -"
php -r "copy('', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

    >&2 echo 'ERROR: Invalid installer checksum'
    rm composer-setup.php
    exit 1

php composer-setup.php --quiet
rm composer-setup.php

php composer.phar install

npm install && npm run prod
  • Create a new file called ./ and paste the code snippet above.

  • Import a new site in your Vercel account.

  • Link the site to your desired GitHub repository

  • Add build command ./

  • Set output directory to dist

Vercel build settings

With the settings above your Staticus site will be successfully deployed on vercel.

Staticus was created last year, It's super slim and it comes with powerful features of SSG like Jigsaw by Tighten. I am shouting out to Gilbert, creator of Staticus whom I modeled my new blog from his own. 🙌

Join my inner circle newsletter

Be the first to hear about anything I publish, launch, or think is helpful for you. Subscribe here

Hey, have you tried Litehost lately ?

Litehost is a web hosting platform for PHP & Laravel developers with Composer, Git, PHP & CLI pre-installed. Try it now