Install Knapsack
Follow this step-by-step guide to get Knapsack up and running on your local machine.
Before You Start
Before starting the installation process, ensure that your project conforms to the system specifications listed in the Required Prep document. This will help avoid any compatibility issues during installation.
Set Up Your Site ID
Before continuing, you’ll need to get your Site ID from our team. This ID will be used in the URL of your Knapsack workspace:
https://app.knapsack.cloud/site/{your-site-id}/latest
Pro Tip: Make sure to keep track of your Site ID, as you’ll need it throughout the setup process.
Install Knapsack
Once you have your Site ID, the next step is to install Knapsack in a directory that contains a package.json file. This could be an existing app or a brand-new project. If your folder doesn’t have a package.json, you can create one by running:
Now, to install Knapsack, run the following command:
This will prompt you with some installation questions:
1. What is your Site ID? Enter your Site ID here.
2. What Renderers would you like to use? Choose the renderer(s) for your project. For example, React. You can add more later if needed.
Here’s an example of the installation process for React:
Once installation is complete, you’ll notice a new Knapsack directory and Knapsack scripts added to your package.json.
Install Dependencies
Knapsack supports multiple package managers like npm, yarn, or pnpm.
Run the following command to install the required dependencies (example using npm):
Build Knapsack
After installing the dependencies, build Knapsack by running the build script added to your package.json:
This will generate new folders inside the Knapsack directory:
- data: Contains structured data files used by Knapsack.
- dist: Contains generated files related to design tokens and metadata which is used for testing purposes, particularly in end-to-end or integration tests.
- public: Contains static assets (images, fonts, etc.) that will be served directly.
Start Knapsack
To start Knapsack and launch the local development server, run:
This will start the server, and you’ll see a URL http://localhost:3999 in the terminal output.
Pro Tip: Look for the rocketship emoji 🚀 in the terminal to find your local URL!
Sign In to Knapsack
When you visit your local URL, you’ll be greeted with a sign-in screen. To access your workspace, follow these steps:
If you are the first user for your workspace, you’ll need to contact our team to invite you to the workspace. Once you’ve been invited, you’ll have the ability to invite other users yourself.
1. Receive the Workspace Invite
Once one of the Knapsack team members has invited you to your workspace, check your email for the invitation. Look for an email with the subject “You’ve been invited to join [workspace-name] on Knapsack.”
3. Set Your Password
After clicking the link, you’ll be redirected to the password setup screen. Create a password that meets the following requirements:
• At least 8 characters in length
• Must include at least 3 of the following:
• Lowercase letters (a-z)
• Uppercase letters (A-Z)
• Numbers (0-9)
• Special characters (e.g., !@#$%^&*)
4. Restart Your Local Dev Server and sign in
After setting your password, restart your local development server by running:
Explore Knapsack
Once you’re signed in, feel free to explore your Knapsack workspace! Here’s what you can start with:
• Connecting Components: Add and modify components locally. Component additions can only be done locally before being pushed to production.
• Importing Design Tokens: Seamlessly work with design tokens and see live previews.
• Writing Documentation: Add or edit documentation in real-time.
Now that Knapsack is set up and running locally, you can start building, testing, and enjoying the collaborative power of your design system!