Skip to main content

1. Start your Design System

Overview

Setting up your own Design System can be done in one of two ways:

  1. By creating a new project for your Design System to live in, or
  2. by adding everything to an existing project

Create new project

Start in a fresh directory inside your terminal. This should be the directory all your Design System code will live in, and that will also be pushed to a Git host, later on. It shouldn't include a .git folder, yet! We'll use ~/projects/my-design-system here, with ~ denoting the users' home directory.

First, let's create a Git repository:


_10
$ mkdir -p ~/projects/my-design-system
_10
$ cd ~/projects/my-design-system
_10
$ git init
_10
_10
> Initialized empty Git repository in ~/projects/my-design-system/.git/

Working with the terminal

If any of the commands related to git or npm / node fail for you, or you need help working with the terminal, have a look at our Getting Started page about Environment configuration.

Additionally you might not use nvm for Node version management. Just skip those sections, and ensure the correct version for your project is installed and active!

Next we'll add a .gitignore file to the repository, that will be built up through the following sections to exclude generated code files:


_10
touch .gitignore

Add the node_modules folder to it for now:

.gitignore

_10
# Node
_10
node_modules

Then we'll add a .nvmrc file specifying the use of Node 16.14 for this project (this is the version kickstartDS currently works off of) to our project root:

.nvmrc

_10
16.14

Call nvm use right after, to activate the correct Node and npm versions:


_10
$ nvm use
_10
_10
> Found '~/projects/my-design-system/.nvmrc' with version <16.14>
_10
> Now using node v16.14.2 (npm v8.19.2)

Finally we'll make it a valid npm package, too:


_10
$ npm init
_10
_10
> About to write to ~/projects/my-design-system/package.json:
_10
> ...

Enter the prompted information, and you'll end up with a package.json describing your freshly made npm package. Use dist/index.js for the entry point, this is where our bundled code will live. The rest is pretty much up to your liking! It should look roughly like this:

package.json

_11
{
_11
"name": "@my/design-system",
_11
"version": "1.0.0",
_11
"description": "Design System for all @MY needs",
_11
"main": "dist/index.js",
_11
"scripts": {
_11
"test": "echo \"Error: no test specified\" && exit 1"
_11
},
_11
"author": "Jonas Ulrich",
_11
"license": "MIT"
_11
}

With this you can continue with Add to existing project. From here on out the steps will be the same.
You'll just find that, in comparison to having an existing project, you'll probably not find any of the steps to be optional!

Add to existing project

In your terminal, switch to the project that you want to add kickstartDS to first. We'll be adding some dependencies, some glue code and configuration to hook everything up.

Some of the following steps might be optional for your personal setup, so feel free to skip them.
For example: you might already have React installed in your project, so you wouldn't have to complete that part of the setup!

`npm` vs `yarn` vs ...

In this guide we'll be using yarn as our package manager of choice. Feel free to use your preferred solution instead.
For more details see our page about Environment configuration.

For example: if you were using npm, and you'd encounter the following command to run yarn add react@17 react-dom@17... just replace yarn with npm and run npm add react@17 react-dom@17 instead.

Dependencies

First of all we need to add some dependencies to our project:

Start with existing package.json

If you're adding to an existing project, just imagine the same lines being added to your existing package.json.
We'll pretend to start fresh:

package.json

_11
{
_11
"name": "@my/design-system",
_11
"version": "1.0.0",
_11
"description": "Design System for all @MY needs",
_11
"main": "dist/index.js",
_11
"scripts": {
_11
"test": "echo \"Error: no test specified\" && exit 1"
_11
},
_11
"author": "Jonas Ulrich",
_11
"license": "MIT"
_11
}

Add React

package.json

_15
{
_15
"name": "@my/design-system",
_15
"version": "1.0.0",
_15
"description": "Design System for all @MY needs",
_15
"main": "dist/index.js",
_15
"scripts": {
_15
"test": "echo \"Error: no test specified\" && exit 1"
_15
},
_15
"author": "Jonas Ulrich",
_15
"license": "MIT",
_15
"dependencies": {
_15
"react": "17",
_15
"react-dom": "17"
_15
}
_15
}

If your project was not using React before, you should add a compatible version (kickstartDS currently uses React 17) of it now:


_10
yarn add react@17 react-dom@17

Change SemVer requirement

package.json

_15
{
_15
"name": "@my/design-system",
_15
"version": "1.0.0",
_15
"description": "Design System for all @MY needs",
_15
"main": "dist/index.js",
_15
"scripts": {
_15
"test": "echo \"Error: no test specified\" && exit 1"
_15
},
_15
"author": "Jonas Ulrich",
_15
"license": "MIT",
_15
"dependencies": {
_15
"react": "^17.0.2",
_15
"react-dom": "^17.0.2"
_15
}
_15
}

We want to get newer versions for React 17, so we change the import slightly! Learn more about those restrictions.

Add kickstartDS

package.json

_16
{
_16
"name": "@my/design-system",
_16
"version": "1.0.0",
_16
"description": "Design System for all @MY needs",
_16
"main": "dist/index.js",
_16
"scripts": {
_16
"test": "echo \"Error: no test specified\" && exit 1"
_16
},
_16
"author": "Jonas Ulrich",
_16
"license": "MIT",
_16
"dependencies": {
_16
"@kickstartds/base": "^2.0.2",
_16
"react": "^17.0.2",
_16
"react-dom": "^17.0.2"
_16
}
_16
}

Next we'll add the kickstartDS dependencies themselves. We start out by adding our base module (@kickstartds/base), which contains all of the base components, to get started:


_10
yarn add @kickstartds/base

Learn more about the different modules kickstartDS has to offer in our overview here.

Start with existing package.json

If you're adding to an existing project, just imagine the same lines being added to your existing package.json.
We'll pretend to start fresh:

Add React

If your project was not using React before, you should add a compatible version (kickstartDS currently uses React 17) of it now:


_10
yarn add react@17 react-dom@17

Change SemVer requirement

We want to get newer versions for React 17, so we change the import slightly! Learn more about those restrictions.

Add kickstartDS

Next we'll add the kickstartDS dependencies themselves. We start out by adding our base module (@kickstartds/base), which contains all of the base components, to get started:


_10
yarn add @kickstartds/base

Learn more about the different modules kickstartDS has to offer in our overview here.

package.json

_11
{
_11
"name": "@my/design-system",
_11
"version": "1.0.0",
_11
"description": "Design System for all @MY needs",
_11
"main": "dist/index.js",
_11
"scripts": {
_11
"test": "echo \"Error: no test specified\" && exit 1"
_11
},
_11
"author": "Jonas Ulrich",
_11
"license": "MIT"
_11
}

Result

Our repository is initialized. We can now connect it to a Git host, or just continue with the guide without pushing our code to a registry. If you'd like to learn more about Git hosts, see our Environments page about it.

Next Step

We'll continue by applying our branding to kickstartDS, which will result in a bunch of token files (JSON) being added to the project.
This will also give us the opportunity to set up Storybook, and get a first visual representation of our Design System in the browser!

Code Sandbox

See the result of this step in the Code Sandbox below. It's showing specifically the result after this step. You can also view this on Github directly in the ds-guide repository, there's a branch for every step... and we're currently on the branch step/1 in the guide:

Toggle the file browser with the hamburger icon at the top left, or open it directly in your browser.