Token Storage and Sync
Generic Versioned Storage

Generic Versioned sync setup guide

For projects requiring highly controlled and secure data-sharing environments, you can host your Design Token JSON files on your servers or storage solutions.

You can use the Tokens Studio plugin to keep your Design Tokens in sync with your code files without passing your design data through any git or 3rd-party storage providers.

We support two-way sync, meaning you can use the plugin to:

  • push JSON files of Design Tokens to your storage provider
  • pull the Tokens stored in your storage provider into any Figma file

You can configure the permissions of your Generic Versioned sync to be:

  • Read Only
  • Read / Write
  • Read / Write / Create

This means the Design Tokens living in code are the source of truth for our design decisions, which can be shared between design and development teams.

This doc outlines how to configure Generic Versioned storage and add it as a Sync provider in the plugin.

→ Once set up, you can use the plugin's Push and Pull features to keep your Tokens in sync.

How it works

  • Once your Token JSON files are stored on your server, capture the URL endpoint.
  • Configure a new Generic Versioned sync provider within the plugin.
  • Use the plugin to sync Design Token changes between your server and Figma design files.

Generic Versioned sync setup instructions

If you haven't already, store your Design Token JSON files on your server and create a storage endpoint.

Here's an example implementation of token JSON files stored on a SQLite database on a local file if you need a reference.

Here's a guide on using a JSON server as a simple way to use Generic Versioned storage created by Ian Lawton, a Tokens Studio Community member.

1. Storage URL

Copy the URL where your Token JSON files are stored.

  • Store it somewhere safe, as it's needed for the plugin configuration.

2. Capture header pairs

Headers are optional authentication instructions for the plugin set up as key value pairs.

  • Refer to your server technical documentation for more details on headers.

For example, if you want to identify and track which users are accessing your Token files, you could set up a user authorization header:

  • Name = Authorization
  • Value = username

If your server requires authentication:

  • Copy and save the required header pair somewhere safe, as it's needed for the plugin configuration.

Configuring Tokens Studio Plugin

In Figma, open the Tokens Studio plugin and navigate to the Settings page.

  • Under the Sync providers section, select the Add new button to see a list of all Token storage providers.
  • Select Generic Versioned

Add credentials for Generic Versioned sync

You'll need the information saved from the steps above to complete the Tokens Studio sync configuration form.

1. Name

This is a nickname that appears in the plugin settings page later on to identify this specific sync provider configuration.

  • Choose something memorable to you and your project.
  • Example: Hyma brand exploration

2. URL

Enter the complete URL you saved from the step above.

3. Flow type (permissions)

The flow type sets the permissions between the plugin and your storage provider.

  • Read Only
    • Token data is pulled into the plugin to be viewed but cannot be edited.
      • Read requests are sent via GET calls to the endpoint.
  • Read / Write
    • Token data is pulled into the plugin to be viewed, and edits to those Tokens can be made and pushed back to storage.
    • New Tokens, sets, or themes can not be created.
      • Read/Write requests are sent via PUT requests to the endpoint.
  • Read / Write / Create
    • New Tokens, sets, and themes can be created.
    • Token data can be pushed and pulled between the plugin and your storage provider for two-way sync.
      • Read/Write/Create requests are sent via POST requests to the endpoint.
      • The POST request is expected to return:
        • Validation that the endpoint has tracking setup (or not)
        • updatedAt field in the JSON, which can be used to set additional workflows on the storage side, like additional GET requests.

4. Headers

The optional authentication headers you saved from the steps above.

Save and do the initial sync

Save to confirm your credentials, and follow the prompts in the plugin to finish setting up the sync to your Generic Versioned provider.

→ Read the Add New Sync Provider guide for more details.

Shared source of truth

As you work in the plugin, push and pull indicators remind you to stay in sync.

→ Read the Push and Pull to Sync Provider guide for more details.

Once your Token JSON files are synced to your external storage, you have a shared source of truth between Designers and Engineers!

Engineers typically transform Tokens used in code with Style Dictionary, which is tool-agnostic. Tokens coming from Tokens Studio require an additional step: @Tokens-studio/sd-transforms, an npm package that prepares Tokens for Style Dictionary.

The various Token Types supported by Tokens Studio have unique transforms to be aware of.

→ Jump to the Token Type overview.

Resources

Mentioned in this doc:

Community resources:

💡 Something to share? Submit it here!

Known issues and bugs

Tokens Studio Plugin GitHub - Open issues for URL sync

🐞 If you are experiencing an issue not listed here, please reach out to us on the Troubleshooting channel of our community Slack, or submit it on our feedback tool.

Requests, roadmap and changelog

💌 Visit https://feedback.tokens.studio/ to contribute or subscribe to updates.

Last updated on September 9, 2024