Skip to main content

Salable Configure: Configuring Salable Made Easy

Up until now when getting started with Salable, you had two choices for configuring your account, products, plans, etc.

  1. Salable dashboard
  2. Salable CLI

And, these options are fine for a lot of users but they have some issues when you start to dig into them. For instance, what if you want to share a configuration across multiple team members for easy development and testing? Or, what happens if you just want to do everything via code and don't want to waste precious time clicking around a dashboard or running several CLI commands?

The solution: salable configure

Up until now, there was no solution but we just recently launched the new configure command in our CLI that allows you to write a single configuration file and then deploy the resources within that configuration file to your Salable account.

This means you can now write a single file that defines all of your products, plans, capabilities, features and API keys and have them all automaitcally created for you by running a single command.

And, what if you want to share that configuration with someone else? Easy, you can commit .salable.json into your respository so as soon as someone clones the project they have the file. Alternatively, you can send them the file and once they have the file, they can run salable configure when authenticated with their account!

How to use salable configure

We've covered the high level of how salable configure works but let's run through an actual example so we can see how it works better. First of all, make sure you have the CLI installed and authenticated your account.

Once you have the above CLI steps complete, we can create our configuration file which is called .salable.json. You can create this file whether you want and then inside that file is where we define our resources, below is an example configuration.

{
"settings": {
"apiKeys": [
{
"name": "New API Key",
"scopes": ["apiKey:read"]
}
]
},
"products": [
{
"name": "Example Product",
"displayName": "exampleProduct",
"description": "Example Product",
"appType": "Custom",
"paid": false,
"currency": "GBP",
"features": [
{
"name": "Example Feature",
"displayName": "Example Feature",
"variableName": "exampleFeature",
"description": "An optional desc",
"type": "Boolean",
"defaultValue": true,
"visibility": "Public"
}
],
"plans": [
{
"name": "Pro",
"displayName": "pro",
"description": "An optional desc",
"capabilities": ["Create"],
"planType": "Bespoke",
"planPricing": "Free",
"price": 5,
"planCycle": {
"interval": "Month",
"quantity": 1
},
"licenseType": "Licensed",
"evaluationPeriod": 14,
"visibility": "Public",
"published": true
}
],
"capabilities": ["Create"]
}
]
}

You'll notice that in this configuration we define a "free" product by setting "paid" to false. But, it's worth noting that you can also create paid products by first creating a payment integration in the Salable dashboard.

Once you have the configuration file written, open your terminal and navigate to the directory you created .salable.json inside. Then run the command salable configure and after a few moments you should see an output like the below that shares the details of the resources created with you.

===== API keys created: 1 =====

| (index) | name | value | scopes |
|---------|---------------|-----------------|-------------------|
| 1 | 'New API Key' | 'API_KEY_VALUE' | [ 'apiKey:read' ] |

===== Products created: 1 =====

| (index) | name | uuid | plans |
|---------|-------------------|----------------|-------|
| 1 | 'Example Product' | 'PRODUCT_UUID' | 1 |

===== Plans for Product: PRODUCT_UUID =====

| (index) | name | uuid |
|---------|-------|-------------|
| 1 | 'Pro' | 'PLAN_UUID' |

You can validate this further if you wish by visiting the Salable dashboard and inspecting the resources that have been created.

So, to summarise, you can use salable configure to deploy resources to your Salable account by doing the below.

  1. Create a Salable account
  2. Configure and authenticate the Salable CLI
  3. Create a .salable.json file
  4. Run the salable configure CLI command

And then, with the information outputted by salable configure you're able to start building your applications and products powered by Salable!

The Future

The current version of salable configure has some limitations such as only being able to create new resources in Salable as well as requiring you to visit the Salable dashboard to configure a payment integration for paid products. But, in the future, we're going to resolve both of these issues as well as allow you to easily export a configuration file for your exisiting resources in your Salable dashboard.

If there is a feature or piece of functionality you'd like to see in or think would be helpful in salable configure then make sure to let us know!