This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Next.js 15 application that displays economic indicators from the Federal Reserve Economic Data (FRED) API. The app features a dashboard with real-time charts showing key economic metrics like Consumer Price Index (CPI), unemployment rate, and Treasury yields.
The application follows Next.js App Router architecture with these key layers:
- Proxy endpoint for FRED API requests to handle CORS and API key management
- Requires
NEXT_PUBLIC_FRED_API_KEYenvironment variable - Filters invalid data points (marked as '.') and transforms response format
- Falls back gracefully when API key is missing or invalid
- Client-side API functions for fetching FRED data
- Defines FRED series IDs for different economic indicators
- Includes mock data fallback for development/testing
- TypeScript interfaces for data structures
- React hook that manages FRED data fetching with loading/error states
- Handles caching and re-fetching when parameters change
- Returns standardized data format for chart components
- Main dashboard component with sidebar navigation and chart grid
- Uses Recharts library for data visualization
- Responsive design with Tailwind CSS
- Real-time data fetching for last 2 years of economic data
# Install dependencies
npm install
# Start development server with Turbopack
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lintCreate a .env.local file with:
NEXT_PUBLIC_FRED_API_KEY=your_actual_fred_api_key_here
Get your free FRED API key from: https://fred.stlouisfed.org/docs/api/api_key.html
- Next.js 15: React framework with App Router
- Recharts: Data visualization library for economic charts
- Lucide React: Icon library for UI elements
- Tailwind CSS v4: Utility-first CSS framework
- TypeScript: Type safety throughout the application
- Dashboard component renders with predefined date range (last 2 years)
- Multiple
useFredDatahooks fetch different economic indicators simultaneously - Each hook calls
fetchFredDatawhich proxies through/api/fredendpoint - API route fetches from FRED API using configured API key
- Data is transformed and displayed in Recharts components
- Loading states and error handling are managed at hook level
The app currently displays these FRED series:
CPIAUCSL: Consumer Price IndexUNRATE: Unemployment RateDGS10: 10-Year Treasury Constant Maturity RateDGS3MO: 3-Month Treasury Constant Maturity RateFEDFUNDS: Federal Funds Rate (available but not currently displayed)
Charts are configured with:
- 2-year historical data range
- Responsive containers
- Custom date formatting for X-axis
- Appropriate Y-axis domains for each metric type
- Tooltip formatting with proper units (%, currency, index values)
- Direct links to FRED series pages for detailed data