A modern, feature-rich ads platform built with React 19 and TypeScript. This application allows users to browse and post advertisements for various categories including mobile phones, cars, and apartments.
Note: This project currently uses mock data and API responses for development. A real backend will be integrated in a future release.
- Browse Ads: View categorized listings for mobile phones, cars, and apartments
- Post Ads: Dynamic form system that adapts based on selected category
- Dynamic field generation from API/mock data
- Support for text inputs, select dropdowns, and checkbox groups
- Real-time validation with Zod schemas
- Multi-language Support: Full internationalization with English and Arabic (RTL support)
- Responsive Design: Mobile-first approach with modern UI components
- Category Management: Dynamic category selection with nested subcategories
- Form Validation: Comprehensive validation system with Zod schemas and custom rules
- Top Navigation: Fixed horizontal navigation bar with logo, language toggle, and post ad button
- Mock Data: Development mode uses mock data for categories and form fields
- Framework: React 19 with TypeScript
- Build Tool: Vite 7
- UI Components:
- Radix UI (Checkbox, Dialog, Label, Select)
- react-select for dropdowns
- Custom components built with Tailwind CSS
- State Management:
- TanStack Query (React Query) for server state
- React Context for client state
- Routing: React Router v7 with lazy loading
- Internationalization: react-i18next (en/ar) with RTL support
- Forms:
- React Hook Form for form management
- Zod 4 for schema validation
- @hookform/resolvers for integration
- Styling: Tailwind CSS 4
- HTTP Client: Axios
- Testing:
- Vitest for unit tests
- React Testing Library for component tests
- Code Quality: ESLint + Prettier + TypeScript strict mode
- Git Hooks: Husky + lint-staged
src/
βββ components/ # Shared components
β βββ core/ # Core app components
β β βββ CartLogo.tsx
β β βββ ErrorBoundary.tsx
β β βββ PageLoader.tsx
β βββ navigation/ # Navigation components
β β βββ NavigationMenu.tsx
β β βββ index.ts
β βββ shared/ # Shared UI components
β βββ icons/ # Icon components (BackIcon, CheckIcon, etc.)
β βββ dynamic-form/ # Dynamic form system
β β βββ DynamicForm.tsx
β β βββ utils/ # Form transformation utilities
β βββ AdCardSkeleton.tsx
β βββ Alert.tsx
β βββ Button.tsx
β βββ Checkbox.tsx
β βββ CheckboxGroup.tsx
β βββ DynamicField.tsx
β βββ Form.tsx
β βββ Input.tsx
β βββ Select.tsx
β βββ index.ts # Public exports
βββ features/ # Feature-based modules
β βββ home/ # Home feature
β β βββ pages/ # HomePage
β β βββ navigation.ts
β β βββ index.ts
β βββ ad-management/ # Ad management feature
β βββ components/ # Feature-specific components
β β βββ AdCategoryGrid.tsx
β β βββ AdCategoryColumns.tsx
β β βββ BaseAdCard.tsx
β β βββ CarAdCard.tsx
β β βββ ApartmentAdCard.tsx
β β βββ MobileAdCard.tsx
β βββ hooks/ # Feature-specific hooks
β β βββ useAds.ts
β β βββ useCategoryAdFields.ts
β β βββ useAdCardData.ts
β βββ pages/ # Feature pages
β β βββ AdCategoriesPage.tsx
β β βββ SellAdFormPage.tsx
β βββ services/ # Feature API services
β β βββ adsService.ts
β βββ types/ # Feature-specific types
β β βββ ads.ts
β β βββ carAds.ts
β β βββ apartmentAds.ts
β β βββ mobileAds.ts
β βββ utils/ # Feature utilities
β β βββ fieldGrouping.ts
β β βββ carAdFieldExtractors.ts
β βββ navigation.ts
β βββ index.ts
βββ contexts/ # React contexts
β βββ LanguageContext.tsx
βββ hooks/ # Shared custom hooks
β βββ useCategories.ts
β βββ useSelectedCategory.ts
β βββ queryUtils.ts
βββ services/ # API services
β βββ apiService.ts # Axios instance & request handler
β βββ categoriesService.ts
β βββ mocks/ # Mock data for development
β βββ mockCategories.json
β βββ mockMobileFieldsResponse.json
β βββ mockVehicleFieldsResponse.json
β βββ mockApartmentsFieldsResponse.json
βββ routes/ # Routing configuration
β βββ AppRouter.tsx
β βββ RootLayout.tsx
β βββ navigation.ts
βββ types/ # TypeScript type definitions
β βββ adsCategory.ts
β βββ components.ts
β βββ form.ts
β βββ navigation.ts
β βββ index.ts
βββ constants/ # Application constants
β βββ routes.ts
β βββ language.ts
β βββ svgIcons.json
β βββ home.ts
βββ utils/ # Utility functions
β βββ cn.ts # className utility
β βββ ads.ts
β βββ date.ts
β βββ locationUtils.ts
βββ styles/ # Global styles
β βββ global.css
β βββ navigation-menu.css
βββ i18n/ # Internationalization
β βββ index.ts
β βββ locales/
β βββ en.json
β βββ ar.json
βββ test/ # Test setup
β βββ setup.ts
βββ App.tsx # Root app component
βββ main.tsx # Application entry point
- Feature-based Organization: Each feature is self-contained with its own components, hooks, pages, services, types, and navigation
- Atomic Design: Components organized by complexity (atoms, molecules, organisms)
- SOLID Principles: Separation of concerns and single responsibility
- Path Aliases: Uses
&/prefix for src/ imports (e.g.,&/components,&/features) - Dynamic Forms: Form fields are generated dynamically from API/mock data with automatic schema validation
- Type Safety: Strict TypeScript mode with comprehensive type definitions
- Node.js (v22.12.0 or higher recommended)
- Yarn 4.0.2 (npm is not supported)
# Install dependencies
yarn install
# Start development server
yarn dev
# Build for production
yarn build
# Preview production build
yarn previewyarn dev- Start development server with HMRyarn build- Build for production (TypeScript check + Vite build)yarn preview- Preview production build locallyyarn test- Run unit tests with Vitestyarn test:ui- Run tests with Vitest UIyarn test:coverage- Run tests with coverage reportyarn lint- Run ESLintyarn lint:fix- Fix ESLint issues automaticallyyarn format- Format code with Prettieryarn format:check- Check code formatting without fixing
The application supports two languages:
- English (en) - Default
- Arabic (ar) - With RTL support
Translation files are located in src/i18n/locales/. All user-facing text should use translation keys - no hardcoded strings.
- Primary Color: Cyan (#5dcbf4)
- Navigation: Fixed top horizontal navigation bar with white background
- Components:
- Built with Radix UI primitives
- Styled with Tailwind CSS 4
- Custom icon components using SVG paths from
constants/svgIcons.json
- Responsive: Mobile-first design approach
- Form System: Dynamic form generation based on category with Zod validation
# Run unit tests
yarn test
# Run tests with UI
yarn test:ui
# Run tests with coverage
yarn test:coverageThe project uses:
- ESLint for linting
- Prettier for code formatting
- TypeScript in strict mode
- Husky for git hooks
- lint-staged for pre-commit checks
Code is automatically formatted and linted on commit.
- Follow SOLID principles
- Use feature-based organization
- Implement atomic design patterns
- All text must be internationalized
- Mobile-first responsive design
- Use TypeScript strict mode
- Write tests for critical functionality
- Follow conventional commit format
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to fork this repository and create a pull request with improvements or additional features. Feedback is always welcome!