Quick Setup
This guide will walk you through setting up and running the Auction Platform Frontend locally.Configure Environment
Create a
.env file in the root directory with your API configuration:.env
Make sure your backend API is running at the specified URL. The API client is configured in
src/app/api/client.ts and includes automatic retry logic, timeout handling, and authentication.Available Scripts
The project includes several npm scripts for different tasks:| Command | Description |
|---|---|
npm run dev | Start the Vite development server |
npm run build | Build the application for production |
npm run preview | Preview the production build locally |
npm run lint | Run ESLint to check code quality |
npm run storybook | Start Storybook on port 6006 |
npm run build-storybook | Build Storybook for deployment |
npm run analyze | Analyze bundle size with visualizer |
Using UI Components
The platform includes a comprehensive set of UI components in thesrc/shared/ui/ directory. Here’s how to use them:
Button Component
The Button component supports multiple variants and sizes:variant:"primary"|"secondary"|"danger"|"outline"size:"sm"|"md"|"lg"block:boolean- Full width buttondisabled:boolean
Typography Component
Render semantic HTML with consistent styling:as:"h1"|"h2"|"h3"|"h4"|"h5"|"h6"|"p"|"label"weight:"light"|"normal"|"medium"|"bold"size:"text-base"|"text-md"|"text-sm"|"text-xs"
Exploring Components with Storybook
The project includes Storybook for interactive component development and testing.Launch Storybook
Start the Storybook development server:Storybook will open in your browser at
http://localhost:6006/Browse Components
Explore the available components in the sidebar:
- Button - All button variants and sizes
- Typography - Text styling options
- TextField - Input components
- CardContainer - Card layouts
All component stories are located alongside their respective components with the
.stories.tsx extension. For example, see src/shared/ui/button/Button.stories.tsx.Understanding the Architecture
The application uses modern React patterns:Routing with TanStack Router
Routes are defined in thesrc/routes/ directory with automatic code splitting:
_with-navbar.tsx- Pages with navigation bar (home)_with-sidebar.tsx- Pages with sidebar (dashboard)_without-navbar.tsx- Auth pages (login, signup, onboarding)
State Management with Zustand
Authentication state is managed with Zustand (src/app/store/auth/auth.store.ts):
API Client
The API client (src/app/api/client.ts:5-57) provides request utilities with built-in features:
- Automatic authentication handling
- Request timeout (30s default)
- Retry logic for failed requests
- Automatic logout on 401 responses
Next Steps
Component Library
Explore the complete UI component library in Storybook
Authentication
Learn about the authentication flow and auth store
Routing
Deep dive into TanStack Router and route layouts
API Integration
Understand how to make API requests and handle responses
The application includes comprehensive error boundaries and theme support. See
src/app/ErrorBoundary.tsx and src/app/providers/Theme.tsx for implementation details.