Local environment setup

When developing your Keel app locally there are two things which you'll probably want to setup - our CLI and our VSCode extension. Our CLI lets you run your project and develop against your APIs locally whilst our VSCode extension provides inline validation, formatting, and syntax highlighting for Keel schema files.

Dependencies

You will need to install the following dependencies in order to use the Keel CLI locally:

Node.js

Node.js is used for running your functions and tests, and NPM is required to install Keel. We require Node version 18 or higher.

You can install Node.js using the installer which is available from https://nodejs.org/en/download (opens in a new tab).

Docker

Docker is used by the CLI to run an instance of PostgreSQL. We only require that Docker is installed and running. You do not need to configure it in any way, nor do you need to install PostgreSQL itself.

There are a few ways to get Docker installed and running on your local machine, however Docker Desktop is the easiest way to get started. Follow the installation instructions for Docker Desktop (opens in a new tab) to get set up.

Please also make sure that Docker is running. You can test this by running docker ps in your terminal.

Install the CLI

Install the CLI globally from NPM (opens in a new tab).

npm install -g keel

If the CLI has installed correctly, the following command will respond with the current version number.

$ keel -v
v0.396.0

VSCode Extension

This extension only works in the desktop version of VSCode and not in the browser.

The Keel VSCode extension provides inline validation, formatting, and syntax highlighting for Keel schema files. You can find the extension by searching for “Keel” in the Extensions tab in VSCode, or click the button below:

Autoformatting in the extension

You can enable autoformatting of your Keel schema by opening your VSCode settings (CMD + P and then type and select "Preferences: Open User Settings (JSON)"), and add the following configuration:

{
  "[keel]": {
    "editor.formatOnSave": true
  }
}

If you already have the top-level configuration value editor.formatOnSave set to true, then this will also work too.