A modern, type-safe component registry system built with Next.js, React, TypeScript, and Builder.io integration. This project demonstrates how to create a scalable component architecture with automated testing, linting, and pre-commit hooks.
Experience the full component registry showcase with interactive search, sorting, and dynamic rendering capabilities.
- Type-Safe Component Registry - Centralized component management with full TypeScript support
- Builder.io Integration - Ready for visual page building and content management
- Modern Development Stack - Next.js 15, React 19, TypeScript 5.9
- Automated Quality Gates - ESLint, Jest testing, and pre-commit hooks
- Component Showcase - Live examples of Hero, CardList, CTA, TicketList, and SearchBar components
- Advanced Search Component - Debounced SearchBar with URL sync and accessibility features
- Data Transformation Utilities - Robust ticket data processing with comprehensive validation
- Testing Suite - Comprehensive test coverage with React Testing Library
// Centralized component registry
export const registry = {
Hero,
CardList,
CTA,
SearchBar,
TicketList,
};type Block = HeroBlock | CardListBlock | CTABlock | SearchBarBlock | TicketListBlock;// Render blocks dynamically from data
{renderBlocks(page.blocks)}// Transform raw ticket data with validation and normalization
import { transformTickets } from 'src/lib/transformTickets';
const tickets = transformTickets(rawData);- Purpose: Page headers with title and subtitle
- Props:
title,subtitle - Usage: Perfect for landing pages and section headers
- Purpose: Sortable list of items with pricing
- Props:
items[]withtitle,price,href - Features: Auto-sorting by price, responsive design
- Purpose: Call-to-action buttons
- Props:
label,href,variant(primary/secondary) - Features: Accessible, customizable styling
- Purpose: Interactive ticket listing with search and sorting
- Props:
tickets[]withid,title,price,currency - Features:
- Real-time search (case-insensitive, performance optimized)
- Multiple sort options (price ascending/descending, title alphabetical)
- Proper currency formatting with Intl.NumberFormat (USD: $25.00, EUR: β¬45.00, GBP: Β£75.00)
- Accessible form controls with proper label associations
- Performance optimized with memoized filtering and sorting
- Responsive design with clean styling
- Empty state handling
- Purpose: Reusable search input with advanced features
- Props:
value,onChange,placeholder,debounceMs,syncWithUrl,urlParam,aria-label,id - Features:
- Debounced Input: Configurable delay (default 300ms) to prevent excessive API calls
- URL Synchronization: Automatically syncs search terms with URL parameters
- Accessibility: Full ARIA support, proper label associations, keyboard navigation
- Clear Functionality: Built-in clear button with hover states
- Focus Management: Visual focus indicators and proper tab order
- SSR Compatible: Handles server-side rendering gracefully
- Customizable: Flexible styling and behavior options
- Performance: Optimized with useCallback and proper event handling
- Layout Integration: Uses
display: 'block'for proper full-width container behavior
import SearchBar from './components/SearchBar';
function MyComponent() {
const [searchTerm, setSearchTerm] = useState('');
return (
<SearchBar
value={searchTerm}
onChange={setSearchTerm}
placeholder="Search items..."
debounceMs={300}
syncWithUrl={true}
urlParam="search"
aria-label="Search for items"
id="item-search"
/>
);
}- Purpose: Transform and validate raw ticket data
- Input: Unknown data (arrays of RawTicket objects)
- Output: Normalized Ticket objects
- Features:
- Type-safe validation and transformation
- Handles missing/invalid data gracefully
- Filters out invalid entries
- Converts price_cents to dollars
- Normalizes currency codes (USD/EUR/GBP)
import { transformTickets } from 'src/lib/transformTickets';
const rawData = [
{ id: 1, title: 'Concert', price_cents: 1234, currency: 'USD' },
{ id: 2, title: null, price_cents: 2000, currency: 'CAD' }
];
const tickets = transformTickets(rawData);
// Result: [
// { id: '1', title: 'Concert', price: 12.34, currency: 'USD' },
// { id: '2', title: 'Untitled', price: 20.00, currency: 'USD' }
// ]- Node.js 18+
- npm or yarn
π Try it now at https://component-registry-showcase.onrender.com
-
Clone the repository
git clone https://github.com/DouglasMacKrell/component-registry-showcase.git cd component-registry-showcase -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser
http://localhost:3000
| Script | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm test |
Run test suite |
npm run test:watch |
Run tests in watch mode |
The project includes comprehensive testing with:
- Jest - Test runner and assertion library
- React Testing Library - Component testing utilities
- Jest DOM - Custom matchers for DOM testing
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm test -- --coveragetests/
βββ Page.test.tsx # Main app integration tests
βββ smoke.test.tsx # Basic smoke tests
βββ renderBlocks.test.tsx # Component registry tests
βββ transformTickets.test.ts # Data transformation tests
βββ TicketList.test.tsx # Interactive component tests
Automated quality checks run before every commit:
- ESLint - Code linting with auto-fix
- Jest - Related test execution
- TypeScript - Type checking
# Check for issues
npm run lint
# Auto-fix issues
npm run lint -- --fixβββ src/
β βββ components/ # Reusable components
β β βββ Hero.tsx
β β βββ CardList.tsx
β β βββ CTA.tsx
β β βββ SearchBar.tsx
β β βββ TicketList.tsx
β βββ lib/ # Utility functions
β β βββ transformTickets.ts
β βββ registry.ts # Component registry
β βββ renderBlocks.tsx # Dynamic rendering
β βββ types.ts # TypeScript definitions
β βββ mockPage.ts # Sample data
β βββ mockEvents.ts # Sample event data
βββ tests/ # Test files
βββ .husky/ # Git hooks
βββ eslint.config.cjs # ESLint configuration
βββ jest.config.ts # Jest configuration
βββ tsconfig.json # TypeScript configuration
This component registry is perfect for:
- Content Management Systems - Dynamic page building
- Design Systems - Centralized component library
- E-commerce - Product listings and CTAs
- Marketing Sites - Hero sections and call-to-actions
- Documentation Sites - Component showcases
- Data Processing Applications - Robust data transformation and validation
- Ticket/Event Systems - Interactive ticket listings with search and sorting
- E-commerce Platforms - Product catalogs with filtering and sorting
- Event Management - Ticket sales and event listings
Current Status: β LIVE at https://component-registry-showcase.onrender.com
The application is automatically deployed to Render with continuous deployment enabled. Every push to the main branch triggers an automatic deployment.
# Build for production
npm run build
# Start production server
npm run start- Status: β Live and deployed
- URL: https://component-registry-showcase.onrender.com
- Auto-deploy: Enabled on main branch pushes
- Configuration: Uses
render.yamlfor deployment settings
- Connect your GitHub repository to Vercel
- Vercel will automatically detect Next.js and configure build settings
- Deploy with zero configuration
- Build command:
npm run build - Publish directory:
.next - Deploy with continuous integration
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]No environment variables required for basic functionality.
- Static Generation: Pages are pre-rendered at build time
- Code Splitting: Automatic code splitting with Next.js
- Image Optimization: Built-in Next.js image optimization
- Bundle Analysis: Use
npm run buildto analyze bundle size
Ready for Builder.io integration with:
- Component registration
- Type-safe props
- Dynamic rendering
Optimized for Next.js with:
- App Router support
- Server-side rendering
- Static generation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js - React framework
- Builder.io - Visual page building
- React Testing Library - Testing utilities
- Husky - Git hooks
Built with β€οΈ for modern web development