How to Sync Modly with Storybook in Under 10 Minutes
Stop manually copying tokens. Connect your Modly design system to Storybook for live, automated synchronization.
By Alex Chen — Published on Oct 24, 2023
Stop manually copying tokens. Connect your Modly design system to Storybook for live, automated synchronization.
By Alex Chen — Published on Oct 24, 2023
Before you begin, ensure your environment is set up correctly to avoid configuration friction later.
Our addon relies on Storybook's new component metadata API (v7.0+) introduced in 2022.
Token sync and module publishing features are available on the Growth and Enterprise tiers.
Your Storybook repository must be connected to your Modly workspace to receive the sync signal.
Open your terminal in your Storybook project directory and run the installation command.
npm install @modly/storybook-addon
modly.config.jsImport the addon and configure the sync settings in your Storybook main configuration file.
import { configure } from '@storybook/react';
import { withModly } from '@modly/storybook-addon';
// Configure the addon with your workspace ID
const config = {
addons: ['@modly/storybook-addon'],
core: { disableStoryshots: true },
modly: {
workspaceId: 'ws_5f8a9b1c2d3e4f6a',
autoSync: true,
themes: ['light', 'dark']
}
};
configure(stories => {
stories.addStoriesWithAddon(withModly);
}, config);
Once installed, open Storybook and navigate to the new Modly tab. Select a theme (e.g., "Light") and map your Modly color tokens to Storybook's global CSS variables.
Configure a GitHub Actions workflow to automatically publish your Storybook modules to Modly whenever you push to the main branch.
name: Publish to Modly
on:
push:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Modly CLI
run: npm install -g @modly/cli
- name: Publish Modules
run: modly publish --repo=modly/my-storybook-app --branch=main
This workflow runs automatically on every successful push, ensuring your documentation is always up to date.
After the configuration is complete, you will see a live badge on your component stories indicating the Modly version. When you update a token in Figma, the change appears in Storybook immediately without refreshing.
*Note: In a real environment, you would see an animated GIF here showing the visual update propagating from the Modly dashboard to the Storybook preview panel.*
Module not found in registry. Ensure your workspaceId in modly.config.js matches the ID in your Modly dashboard settings.
Sync server timeout. Check your GitHub Actions logs for network connectivity issues or rate limits from the Modly API.
Alex Chen is a Senior Frontend Engineer at Modly. He focuses on developer tooling and design system infrastructure. He previously built component libraries at Scale AI and Stripe.
Follow Alex on LinkedIn