packages/eclipse/ARCHITECTURE.md
This document explains the structure of the Eclipse Design System and why each file/folder is necessary.
apps/eclipse/
├── src/ # Main design system package
│ ├── components/ # React components
│ │ ├── Button.tsx # Button component with variants
│ │ └── index.ts # Component exports
│ ├── lib/ # Utilities
│ │ └── cn.ts # Class name utility (clsx + tailwind-merge)
│ ├── styles/ # CSS styles
│ │ └── globals.css # ✅ ESSENTIAL: Tailwind + color system
│ ├── tokens/ # Design tokens
│ │ └── index.ts # ✅ ESSENTIAL: Design token definitions
│ ├── examples/ # Example components (if needed)
│ └── index.ts # Main package entry point
├── dev/ # Development showcase
│ ├── src/
│ │ ├── Showcase.tsx # Demo of all components
│ │ ├── main.tsx # Vite entry point
│ │ └── styles/
│ │ └── globals.css # Imports from ../../../src/styles/
│ ├── index.html
│ ├── package.json # Depends on @prisma/eclipse
│ ├── tailwind.config.ts # Extends main config
│ └── vite.config.ts
├── package.json # Package configuration
├── tailwind.config.ts # ✅ ESSENTIAL: Tailwind configuration
├── postcss.config.mjs # ✅ ESSENTIAL: PostCSS with Tailwind v4
└── tsconfig.json
/src/styles/globals.css ✅ REQUIREDPurpose: Initializes Tailwind CSS and defines the color system.
What it does:
@import "tailwindcss"@theme block.dark selectorWhy it's needed:
Key sections:
@import "tailwindcss";
@theme {
/* Light mode colors as CSS custom properties */
--color-background-default: #ffffff;
--color-foreground-neutral: #151923;
/* ... all color tokens */
}
.dark {
/* Dark mode color overrides */
--color-background-default: #0a0e14;
/* ... all dark mode tokens */
}
/src/tokens/index.ts ✅ REQUIREDPurpose: Defines non-color design tokens in TypeScript.
What it contains:
Why it's needed:
tailwind.config.ts to dynamically generate Tailwind utilitiesExample usage in Tailwind config:
import { tokens } from "./src/tokens";
borderRadius: {
circle: `${tokens.borderRadius.circle}px`,
square: `${tokens.borderRadius.square}px`,
}
/tailwind.config.ts ✅ REQUIREDPurpose: Configures Tailwind CSS with Eclipse design tokens.
What it does:
bg-background-default → var(--color-background-default)class-basedWhy it's needed:
className="bg-background-ppg" instead of CSS/postcss.config.mjs ✅ REQUIREDPurpose: Configures PostCSS to process CSS with Tailwind v4.
Content:
export default {
plugins: {
'@tailwindcss/postcss': {},
},
};
Why it's needed:
@tailwindcss/postcss plugin@import "tailwindcss" and @theme directives/src/lib/cn.tsPurpose: Utility for merging class names with Tailwind class deduplication.
Usage:
import { cn } from "@prisma/eclipse/lib/cn";
<button className={cn("bg-background-default", isDark && "bg-background-neutral")} />
/src/components/Purpose: Reusable React components built with the design system.
Note: These are the actual design system components that consumers will use.
globals.css as CSS variablestokens/index.ts as TypeScriptglobals.css with .dark selectorlight.css and dark.css filesDeveloper writes component:
<Button className="bg-background-ppg text-foreground-ppg">
Click me
</Button>
Tailwind config maps to CSS variables:
// tailwind.config.ts
background: {
ppg: "var(--color-background-ppg)"
}
CSS defines the actual color:
/* globals.css */
@theme {
--color-background-ppg: #e8fcf9;
}
.dark {
--color-background-ppg: #0a4943;
}
Dark mode toggle changes the class:
document.documentElement.classList.toggle('dark');
// This changes ALL color variables at once!
Install the package:
pnpm add @prisma/eclipse
Import the CSS (in your root component):
import "@prisma/eclipse/styles/globals.css";
Extend Tailwind config:
import eclipseConfig from "@prisma/eclipse/tailwind.config";
export default {
presets: [eclipseConfig],
content: ["./src/**/*.{ts,tsx}"],
};
Use the components:
import { Button } from "@prisma/eclipse";
That's it! No build steps, no complex configuration.
The /dev folder is a clean showcase that:
@prisma/eclipse (no duplication)When you make changes to /src, the /dev showcase automatically reflects them.
Must have:
/src/styles/globals.css - Color system + Tailwind init/src/tokens/index.ts - Design token definitions/tailwind.config.ts - Tailwind configuration/postcss.config.mjs - PostCSS with Tailwind v4Optional:
/src/components/ - Your design system components/src/lib/ - Utility functions/dev/ - Development showcaseDon't need:
Keep it simple, keep it clean! 🎨