A modern React + TypeScript application for searching and classifying products using the US Census Bureau's Schedule B classification system.
- 🔍 Interactive Product Classification - Guided question flow to accurately classify products
- 📊 Hierarchical Code Display - Tree view of Schedule B codes with expandable sections
- 💾 Code Selection & Export - Select and copy Schedule B codes with descriptions
- 🎨 Modern UI - Built with React 19, TypeScript, and Tailwind CSS
- ✅ Fully Tested - Integration tests with Vitest
- 🚀 Production Ready - Deployed to Vercel with serverless functions
- Frontend: React 19, TypeScript, Tailwind CSS
- Build Tool: Vite
- Testing: Vitest with @testing-library/react
- Deployment: Vercel (with serverless functions)
- API: US Census Bureau 3CE Classification API
- Node.js 18+ and npm
# Clone the repository
git clone <your-repo-url>
cd gmt-schedule-b
# Install dependencies
npm install# Start the development server
npm run dev
# App will be available at http://localhost:5173/The development server includes a proxy to the Census API, so no additional configuration is needed.
# Run tests
npm test
# Run tests with UI
npm test:ui
# Run tests once (for CI)
npm test:runSee TESTING.md for detailed testing documentation.
# Create production build
npm run build
# Preview production build locally
npm run previewgmt-schedule-b/
├── api/ # Vercel serverless functions
│ ├── classify.ts # Classification API proxy
│ └── schedule-b.ts # Schedule B lookup proxy
├── src/
│ ├── api/ # API client
│ │ ├── classifyApi.ts # Main API functions
│ │ └── __tests__/ # Integration tests
│ ├── components/ # React components
│ │ ├── SearchInput.tsx # Product search input
│ │ ├── QuestionPanel.tsx # Drill-down questions
│ │ ├── KnownCharacteristics.tsx # Answer breadcrumbs
│ │ ├── ScheduleBTable.tsx # Hierarchical code tree
│ │ └── SelectedCodeDisplay.tsx # Final code display
│ ├── hooks/ # Custom React hooks
│ │ ├── useClassify.ts # Classification state machine
│ │ └── useScheduleBFind.ts # Schedule B data fetching
│ ├── types/ # TypeScript type definitions
│ │ └── census.ts # Census API types
│ ├── App.tsx # Main application component
│ └── main.tsx # Application entry point
├── vite.config.ts # Vite configuration
├── vitest.config.ts # Test configuration
├── vercel.json # Vercel deployment config
└── tailwind.config.js # Tailwind CSS configuration
- User enters product description - e.g., "coffee beans"
- Classification API analyzes - Sends to Census Bureau API
- Guided questions - System asks clarifying questions
- HS Code generated - Based on user answers
- Schedule B codes displayed - Hierarchical tree of related codes
- User selects final code - Choose the most specific code
- Vite proxy handles API requests
- Direct connection to Census API
- Fast and simple for local development
- Vercel serverless functions proxy requests
- Handles CORS and authentication
- Secure and scalable
See TESTING-SETUP-SUMMARY.md for detailed architecture diagrams.
# Install Vercel CLI
npm install -g vercel
# Deploy
vercel
# Or deploy to production
vercel --prodThe serverless functions in /api/ are automatically deployed and configured.
No environment variables are required for basic functionality. All configuration is handled automatically.
npm run dev- Start development servernpm run build- Build for productionnpm test- Run tests in watch modenpm run test:ui- Run tests with UInpm run test:run- Run tests oncenpm run lint- Run ESLintnpm run preview- Preview production build
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run tests:
npm test - Submit a pull request
[Your License Here]
- US Census Bureau for the 3CE Classification API
- Built with modern web technologies