Introduction
Welcome to Thrive UI Design System - the shared UI component library with documentation and AI-powered tooling.
The Thrive Cart Design System monorepo — a shared UI component library with documentation and an MCP server for AI-powered component generation.
├── apps/
│ ├── design-system-docs/ # Documentation site (Fumadocs + Storybook)
│ └── design-system-mcp/ # MCP server for AI component generation
├── packages/
│ └── ui/ # @thrivecart/ui — the publishable component library
├── pnpm-workspace.yaml # pnpm workspace configuration
└── turbo.json # Turborepo configuration@thrivecart/ui as a Dependencythrive-ui-packages)read:packages, write:packages, repo scopeNPM_TOKEN Environment VariableAdd the token to your shell profile (~/.bashrc, ~/.zshrc, or equivalent):
export NPM_TOKEN=your_token_hereFor permanent use, add it to the .bashrc file:
echo "export NPM_TOKEN=your_token_here" >> ~/.bashrcReload your shell:
source ~/.zshrc.npmrc to Your ProjectCreate a .npmrc file in the root of your project with the following content:
@thrivecart:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
${NPM_TOKEN}reads from your environment variable, so this file is safe to commit. Never hardcode the token directly in.npmrc.
Install tailwindcss to your project:
pnpm add -D tailwindcss postcss autoprefixer# npm
npm install @thrivecart/ui
# pnpm
pnpm add @thrivecart/ui
# yarn
yarn add @thrivecart/uiNPM_TOKEN LocallyFor local development, set the NPM_TOKEN environment variable so that npm/pnpm/yarn can authenticate with the GitHub Packages registry.
Option A: Export in your current terminal session (temporary)
export NPM_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxThis lasts only for the current terminal session.
Option B: Add to your shell profile (permanent)
Append the export to your shell config file so it persists across sessions:
# For zsh (macOS default)
echo 'export NPM_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' >> ~/.zshrc
source ~/.zshrc
# For bash
echo 'export NPM_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' >> ~/.bashrc
source ~/.bashrcOption C: Use a .env file (project-scoped)
Create a .env file in your project root:
NPM_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxThen load it before running install commands:
source .env && pnpm installImportant: Add
.envto your.gitignoreto avoid committing secrets.
After setting the token, ensure your project has a .npmrc file (see step 3 above), then run your install command as normal.
NPM_TOKEN in Deployment (AWS)In CI/CD and production environments, store the token as a secret and inject it as an environment variable at build time.
Add NPM_TOKEN as an environment variable in your buildspec.yml:
version: 0.2
env:
secrets-manager:
NPM_TOKEN: "arn:aws:secretsmanager:us-east-1:123456789:secret:npm-token:NPM_TOKEN"
phases:
install:
commands:
- npm install
build:
commands:
- npm run buildAlternatively, set it as a plaintext environment variable in the CodeBuild project settings (less secure) or use AWS Systems Manager Parameter Store:
env:
parameter-store:
NPM_TOKEN: "/myapp/NPM_TOKEN"NPM_TOKEN, value = your GitHub tokenSet the environment variable in the task definition (ECS), environment properties (Elastic Beanstalk), or user data / shell profile (EC2):
ECS Task Definition (JSON):
{
"containerDefinitions": [
{
"name": "app",
"environment": [
{
"name": "NPM_TOKEN",
"value": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
]
}
]
}For production, use AWS Secrets Manager with secrets instead of environment:
{
"containerDefinitions": [
{
"name": "app",
"secrets": [
{
"name": "NPM_TOKEN",
"valueFrom": "arn:aws:secretsmanager:us-east-1:123456789:secret:npm-token"
}
]
}
]
}If you use GitHub Actions for deployment, add NPM_TOKEN as a repository secret and reference it in your workflow:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: pnpm install
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm buildSecurity best practice: Never hardcode the token in source code, Dockerfiles, or build scripts. Always use secrets management (AWS Secrets Manager, SSM Parameter Store, or GitHub Secrets).
Import the CSS in your application entry point (e.g. layout.tsx or main.tsx):
import '@thrivecart/ui/style.css';import { Button } from '@thrivecart/ui';
export default function App() {
return <Button>Click me</Button>;
}Make sure your project has these peer dependencies installed:
react ^19.2.3react-dom ^19.2.3npm install -g pnpm)git clone git@github.com:thrivecart/thrive-ui.git
cd thrive-ui
pnpm install# Run the UI package + docs app
pnpm dev
# Run only the UI package
pnpm dev:ui
# Run only the docs app
pnpm dev:docspnpm build| Command | Description |
|---|---|
pnpm dev | Start development servers |
pnpm dev:ui | Develop the UI package only |
pnpm build | Build all packages and apps |
pnpm lint | Run ESLint across all packages |
pnpm format | Format code with Prettier |
pnpm format:check | Check formatting without writing |
pnpm type-check | Run TypeScript type checking |
pnpm clean | Clean build artifacts |
button/
├── button.tsx
├── button.types.ts # optional — for complex prop interfaces
└── index.ts// 1. External dependencies
import { useState } from 'react';
// 2. Internal packages
import { cn } from '@thrivecart/ui';
// 3. Local imports
import { ButtonProps } from './button.types';