Project 17: Unit Converter (Expert Mode)
35 min read
API IntegrationScientific NotationSearchable DropdownsUnit Conversion MathCaching StrategyConversion History
📋 Project Brief
Build a comprehensive unit converter supporting scientific, financial, and everyday measurements. This includes live currency exchange rates via API, scientific notation for extreme values, and a searchable dropdown system for finding units quickly.
✅ Feature Requirements
Feature 1: Live Currency Exchange
Acceptance Criteria:
- Fetch real-time exchange rates from a financial API (e.g., exchangerate-api.com)
- Support at least 30 major currencies
- Cache rates for 1 hour to reduce API calls
- Show "Last updated: X minutes ago" timestamp
- Handle API failures by using cached/fallback rates with a warning badge
Feature 2: Scientific Notation
Acceptance Criteria:
- Support very large numbers (e.g., kilometers to nanometers: 1 km = 1,000,000,000,000 nm)
- Automatically switch to scientific notation (e.g., 1 × 10¹²) when numbers exceed 6 digits
- Support very small numbers (e.g., 0.000001 → 1 × 10⁻⁶)
- A toggle to switch between standard and scientific notation display
Feature 3: Searchable Dropdowns
Acceptance Criteria:
- Typing in the unit selector filters the list in real-time
- Search matches unit name, abbreviation, and category
- Recent/frequent units appear at the top of the list
- Keyboard navigation: arrow keys to move, Enter to select
Feature 4: Conversion History
Acceptance Criteria:
- A side panel shows the last 10 conversions
- Each entry shows: input value, input unit, output value, output unit, timestamp
- Clicking a history entry re-populates the converter
- History persists in localStorage
Feature 5: Reverse Toggle
Acceptance Criteria:
- A single button swaps the "From" and "To" units instantly
- The input value stays the same; the result recalculates
- The button has a rotate animation (↔) on click
📊 Unit Categories
| Category | Example Units |
|---|---|
| Length | mm, cm, m, km, in, ft, yd, mi, nm, μm |
| Weight | mg, g, kg, oz, lb, ton, stone |
| Temperature | °C, °F, K |
| Volume | mL, L, gal, qt, pt, cup, tbsp, tsp, fl oz |
| Speed | m/s, km/h, mph, knots |
| Data | bit, byte, KB, MB, GB, TB, PB |
| Time | ms, s, min, hr, day, week, month, year |
| Currency | USD, EUR, GBP, JPY, INR, + 25 more |
🧪 Testing Checklist
- Unit test all conversion formulas (especially temperature which isn't simple multiplication)
- Unit test scientific notation formatting
- Unit test search/filter algorithm
- Integration test: selecting units and entering a value produces correct output
- A11y: all dropdowns and inputs properly labeled
🚀 Stretch Goals
- Add a "Favorites" list for frequently used conversions
- Implement batch conversion (convert one value to multiple units simultaneously)
- Add a conversion formula display ("1 mile = 1.60934 kilometers")