CLI

The StaticKit command line interface (CLI) comes with helpful commands for managing your site.

CommandDescription
deployDeploy your config
secrets addAdd a secret

Installation

Run the following to install the CLI:

npm i -g @statickit/cli

Source on GitHub | npm package

Deploy

Run the following to deploy your config:

statickit deploy -k <your-deploy-key>

Your site's deploy key can be found under the Settings tab in StaticKit. Instead of using the -k flag every time, you can create a .env file in the root of your project and define an environment variable:

echo "STATICKIT_DEPLOY_KEY=<your-deploy-key>" >> .env
echo ".env" >> .gitignore

Do not commit your .env file to version control. You should treat your deploy key like any other secret token. A common convention is to create a .env.example file (excluding the actual key) that developers can use as a template:

echo "STATICKIT_DEPLOY_KEY=" >> .env.example

Add a secret

Secrets are used to store values that are too sensitive to put in version control, like API keys for external services.

Run the following command to add a secret to your site:

statickit secrets add <name> <value>

Example

The Mailchimp integration needs an API key in order to communicate with your account. This command will create a secret called mailchimp-api-key:

statickit secrets add mailchimp-api-key "jf89s..."

Then, in your form config, you can reference the secret you just added (notice the @-symbol prefix).

  {
    "forms": {
      "newsletter": {
        "name": "Newsletter",
        "actions": [
          {
            "app": "mailchimp",
            "type": "addOrUpdateContact",
+           "apiKey": "@mailchimp-api-key"
          }
        ]
      }
    }
  }