A modern web application for managing and building design systems. This application allows you to create and manage components, variations, tokens, and their relationships with an intuitive admin interface.
The fastest way to get started is using Docker:
# Clone the repository
git clone <repo-url>
cd ds-builder-structure
# Run the automated setup script
./setup-docker.sh
# Or manually:
docker-compose -f docker-compose.dev.yml up -d
Visit:
- π± Frontend: http://localhost:3000
- π§ Backend API: http://localhost:3001
- π API Documentation: http://localhost:3001/api-docs
- ποΈ Database: localhost:5432
π For detailed Docker documentation: See DOCKER.md
- Component Management: Create and organize UI components with cascade delete support
- Variation System: Define different states/types for each component
- Token System: Manage design tokens (colors, spacing, typography, etc.) with platform-specific parameters
- Smart Token Assignment: Intelligent token-to-variation assignment based on configuration structure
- Cross-Platform Support: Define platform-specific parameters for Android XML, Jetpack Compose, iOS, and Web
- Admin Interface: Clean, modern three-panel UI for efficient workflow
- Real-time Updates: Live UI updates with proper state management
- Search & Filtering: Independent search functionality for components, variations, and tokens
- Visual Indicators: Clear indication of unassigned tokens and current assignments
- Multi-Selection: Bulk token assignment capabilities
- Database Integrity: Proper foreign key constraints with cascade delete for data consistency
- CLI Tool: Generate component configurations from design systems
- Node.js (v18 or higher)
- PostgreSQL database
- Docker & Docker Compose
- 4GB+ RAM recommended
# Automated setup
./setup-docker.sh
# Manual setup
docker-compose -f docker-compose.dev.yml up -d
# Initialize database
docker-compose -f docker-compose.dev.yml exec backend npm run migrate
docker-compose -f docker-compose.dev.yml exec backend npm run seed
-
Clone the repository
-
Install dependencies:
npm run install:all
-
Set up the database:
- Create a PostgreSQL database named
ds_builder
- Create a
.env
file in the backend directory with the following variables:# Database Configuration DB_HOST=localhost DB_PORT=5432 DB_USER=postgres DB_PASSWORD=postgres DB_NAME=ds_builder # Server Configuration PORT=3001
- Create a PostgreSQL database named
-
Generate and run migrations:
cd backend npm run generate npm run migrate
-
(Optional) Seed the database with sample components:
cd backend npm run seed
This will create Button, IconButton, and Link components with proper variations and tokens matching web configuration structure.
-
Start the development servers:
npm run dev
This will start both the backend (port 3001) and frontend (port 5173) servers.
Generate TypeScript component configurations from your design systems:
cd generate-ds
npm install
# Generate components for design system ID 1
npm run dev 1
# With custom output directory
npm run dev 1 --output ./my-components
# Dry run (preview only)
npm run dev 1 --dry-run
The CLI tool creates:
design-system/
src/
components/
Button/
Button.config.ts
IconButton/
IconButton.config.ts
The API includes comprehensive OpenAPI/Swagger documentation available at:
- Interactive Docs: http://localhost:3001/api-docs
- OpenAPI Spec: http://localhost:3001/api-docs.json
- π¨ Design Systems: Create and manage design systems, add/remove components
- π§© Components: Retrieve available components with variations and tokens
- π Variation Values: Manage component variation instances with token values
- π Health: System health monitoring
- Interactive Testing: Test all endpoints directly from the documentation
- Request/Response Examples: See real JSON examples for all operations
- Schema Validation: Complete TypeScript-compatible data models
- Error Handling: Detailed error responses with proper HTTP status codes
The documentation covers all /api
endpoints used by the CLI tool and external integrations.
/backend
- Node.js backend with Express and Drizzle ORM/frontend
- React frontend with TypeScript and shadcn/ui/generate-ds
- CLI tool for generating component configurations/docs
- Documentation including database schemadocker-compose.yml
- Production Docker configurationdocker-compose.dev.yml
- Development Docker configurationDOCKER.md
- Comprehensive Docker documentation
The admin interface provides a streamlined workflow:
- Components Panel (1/3): Browse and manage UI components
- Tokens & Variations Tabs (2/3): Manage component tokens and variations
- Token Assignment: Assign component tokens to specific variations
- Linear Workflow: Components β Variations β Tokens
- Independent Search: Separate search for components, tokens, and variations
- Visual Feedback: Unassigned tokens are highlighted in orange
- Multi-Token Assignment: Select multiple tokens for bulk assignment
- Platform Parameters: Define token values for XML, Compose, iOS, and Web
GET /admin-api/components
- Get all components with variations and tokensPOST /admin-api/components
- Create a new componentPUT /admin-api/components/:id
- Update a componentDELETE /admin-api/components/:id
- Delete a componentGET /admin-api/components/:id
- Get component details with relations
GET /admin-api/variations
- Get all variationsPOST /admin-api/variations
- Create a new variationPUT /admin-api/variations/:id
- Update a variationDELETE /admin-api/variations/:id
- Delete a variationGET /admin-api/variations/:id/tokens
- Get tokens assigned to variation
GET /admin-api/tokens
- Get all tokensPOST /admin-api/tokens
- Create a new tokenPUT /admin-api/tokens/:id
- Update a tokenDELETE /admin-api/tokens/:id
- Delete a token
POST /admin-api/tokens/:tokenId/variations/:variationId
- Assign token to variationDELETE /admin-api/tokens/:tokenId/variations/:variationId
- Remove token from variation
GET /api/design-systems
- Get all design systemsPOST /api/design-systems
- Create a new design system
The system uses a sophisticated many-to-many relationship model with proper cascade delete:
- Components have many Tokens (component-level tokens)
- Components have many Variations (component states/types)
- Tokens can be assigned to multiple Variations (via junction table)
- Variations can use multiple Tokens (flexible assignment)
- Cascade Delete: Deleting a component automatically removes all related variations, tokens, and assignments
- Foreign Key Constraints: Ensures referential integrity across all relationships
- Smart Seeding: Seed script creates components with tokens properly assigned to relevant variations
The system intelligently assigns tokens to variations based on their purpose:
- View tokens (colors, appearance) β assigned to
view
variations - Size tokens (dimensions, spacing) β assigned to
size
variations - Typography tokens (fonts) β assigned to all variations
- State tokens (disabled, focused) β assigned to their specific variations
This architecture ensures design system principles are maintained while providing maximum flexibility for token reuse.
- Node.js with Express
- Drizzle ORM with PostgreSQL
- TypeScript
- Vitest for testing
- React 18 with TypeScript
- shadcn/ui component library
- Tailwind CSS for styling
- React Router for navigation
- Axios for API communication
- Docker & Docker Compose
- Nginx (production frontend)
- Health checks and monitoring
- Multi-stage builds
- Concurrent development servers
- Hot reload for both frontend and backend
- Type-safe database schema
- Comprehensive test suite
Run the backend test suite:
cd backend
npm test
The project includes comprehensive tests covering:
- Database operations
- API endpoints
- CRUD operations
- Relationship integrity
- Error handling
# Install all dependencies
npm run install:all
# Start both servers
npm run dev
# Backend only
cd backend && npm run dev
# Frontend only
cd frontend && npm run dev
# Run tests
cd backend && npm test
# Database migrations
cd backend && npm run generate && npm run migrate
# Seed database with sample data
cd backend && npm run seed
# Development environment
docker-compose -f docker-compose.dev.yml up -d
# Production environment
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Database operations
docker-compose exec backend npm run migrate
docker-compose exec backend npm run seed
- π Docker Setup Guide - Complete Docker documentation
- π Database Schema - Database architecture details
- π οΈ CLI Tool - Component generation tool