Mohamed GhoniemWeb Developer
MohamedGhoniem
  • Work
  • Services
  • Experience
  • Blog
Available
CV
Open to opportunities
WorkServicesExperienceBlogDownload CV
All blogs

© 2026 Mohamed Ghoniem. All rights reserved.

TwitterGitHubLinkedIn
Building a design system from scratch with Figma tokens & Tailwind
DesignFrontend
All blogs

Building a design system from scratch with Figma tokens & Tailwind

MG
Mohamed Ghoniem
·July 16, 2026·8 min read

Prefer to watch?

This article has a full video walkthrough on YouTube

Watch the same walkthrough on YouTube.

Why most design systems fail

I've seen this happen three times at three different companies. Someone builds a beautiful design system in Figma — consistent spacing, tokens, a proper type scale — and six months later the engineering team has drifted so far from it that the two are completely out of sync. Nobody's fault. Just entropy.

The problem is almost never the design. It's the handoff layer. When tokens live in Figma and values are manually copy-pasted into CSS variables, you've created a system that requires human discipline to stay consistent. And human discipline at scale doesn't work.

The token pipeline architecture

The stack I settled on after way too many failed experiments: Figma Variables → Style Dictionary → Tailwind config. Here's why each piece matters and what I almost got wrong.

Figma Variables as the source

Since Figma introduced native Variables (not just styles), you can export a structured JSON of your entire token set. The key is naming discipline — everything follows a category/scale/variant pattern from day one. If you start with arbitrary names, the pipeline becomes a mess fast.

json
// Exported from Figma Variables
{
  "color": {
    "primary": { "value": "#efc983", "type": "color" },
    "surface": {
      "container": { "value": "#201f1f", "type": "color" },
      "low":       { "value": "#1c1b1b", "type": "color" }
    }
  }
}

Style Dictionary transforms

Style Dictionary takes that JSON and outputs whatever format your platform needs — CSS custom properties, JS objects, Swift, Kotlin, whatever. The transform step is where you handle platform-specific concerns like unit conversion or color format normalization.


Keeping Figma and code in sync

The real trick is automation. I run a GitHub Action that triggers whenever the design team exports a new token file, runs it through Style Dictionary, and opens a PR with the diff. Engineers review a real code change. Nothing is invisible. Nothing drifts silently.

Practical tips from the trenches

A few things I wish someone had told me before I spent three weekends debugging a token collision between light and dark mode aliases inside Style Dictionary's reference resolution.

First — never use raw hex values in component tokens. Always reference a primitive. --color-button-bg: var(--color-primary) not --color-button-bg: #efc983. This is the difference between a system that supports theming and one that doesn't.

On this page8 min left
Why most design systems failThe token pipeline architectureFigma Variables as the sourceStyle Dictionary transformsKeeping Figma and code in syncPractical tips from the trenches

Share

On this page8 min left
Why most design systems failThe token pipeline architectureFigma Variables as the sourceStyle Dictionary transformsKeeping Figma and code in syncPractical tips from the trenches

Written by

Mohamed Ghoniem

I build fast, responsive web experiences, from pixel-perfect UI to the backend behind it.

Get in touchAll posts
Older postThe hidden cost of unoptimized images in Next.js
Keep reading
The hidden cost of unoptimized images in Next.js
DesignFrontendJuly 16, 2026

The hidden cost of unoptimized images in Next.js

A practical walkthrough of how I set up a token-driven design system that stays in sync between Figma and code — no plugin lock-in, no manual updates.

MG
Mohamed G.
5 min read
JWT refresh token rotation — the right way
DesignFrontendJuly 16, 2026

JWT refresh token rotation — the right way

A practical walkthrough of how I set up a token-driven design system that stays in sync between Figma and code — no plugin lock-in, no manual updates.

MG
Mohamed G.
6 min read
Smooth page transitions with Framer Motion and Next.js App Router
DesignFrontendJuly 16, 2026

Smooth page transitions with Framer Motion and Next.js App Router

A practical walkthrough of how I set up a token-driven design system that stays in sync between Figma and code — no plugin lock-in, no manual updates.

MG
Mohamed G.
7 min read