An interactive dashboard for exploring and comparing starships from the Star Wars universe. Built with Next.js, TypeScript, and modern React patterns.
- 🔍 Real-time Search: Search starships with debounced input
- 📊 Advanced Filtering: Filter by hyperdrive rating and crew size
- ♾️ Infinite Scrolling: Smooth pagination with automatic loading
- 🔄 Comparison System: Compare up to 3 starships side-by-side
- 🔗 URL State Sync: Shareable URLs with current filters and selections
- 📱 Responsive Design: Fully mobile-friendly interface
- 🏃♂️ Performance Optimized: Efficient data loading and caching
- Framework: Next.js 15.3.0 (App Router)
- UI Components: shadcn/ui + TailwindCSS
- State Management:
- Jotai for global state
- URL state for filters
- Data Fetching:
- @tanstack/react-query for caching
- ts-rest for type-safe API calls
- Table: @tanstack/react-table
- API: SWAPI (Star Wars API)
node -v # v18.x or higher required
- Clone the repository:
git clone https://github.com/sanjaypinna/sw-dashboard.git
cd sw-dashboard
- Install dependencies:
yarn install
- Start the development server:
yarn dev
sw-dashboard/
├── app/ # Next.js app router files
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── dashboard.tsx # Main dashboard
│ ├── search-bar.tsx # Search component
│ └── ... # Other components
├── hooks/ # Custom React hooks
├── lib/ # Utilities and configurations
│ ├── api.ts # API client
│ ├── contract.ts # ts-rest contract
│ └── types.ts # TypeScript types
└── public/ # Static assets
- Search: Real-time with 500ms debouncing
- Hyperdrive Rating Filter:
- Less than 1.0
- 1.0 to 2.0
- Greater than 2.0
- Crew Size Filter:
- 1-5 crew members
- 6-50 crew members
- 50+ crew members
- Select up to 3 starships
- Detailed side-by-side comparison
- Persistent selection across page refreshes
- Infinite scrolling using
react-intersection-observer
- Data caching with
react-query
- Debounced search to minimize API calls
- Memoized filter operations
// Synced with URL parameters
/dashboard?search=falcon&hyperdrive=lt1&crew=6to50
// Selected starships persist across navigation
const [selectedStarships, setSelectedStarships] = useAtom(selectedStarshipsAtom)
# Create production build
yarn build
# Start production server
yarn start
The dashboard supports dark mode out of the box. Theme settings persist across sessions.
The API client can be configured in lib/api.ts
:
export const starWarsClient = initQueryClient(starWarsContract, {
baseUrl: "https://swapi.dev",
// ...configuration
})
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
Project Link: https://github.com/sanjaypinna/sw-dashboard