- Project Setup and Running Steps
- Developer Notes
- API Documentation
- Project Structure
- Technologies and Libraries Used
- Node.js (20) and npm installed on your machine
-
Clone the repository:
git clone https://github.com/zahidalidev/Random-User-Frontend.git
-
Navigate to the project directory:
cd Random-User-Frontend
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your web browser and visit
http://localhost:3000
to view the application.
-
Listing Page: The Listing page component fetches random user data from the provided API endpoint. It includes pagination, persisting filters by gender, and a search functionality. The page structure is organized into separate components for better maintainability and reusability.
-
Profile Page: The Profile page component displays detailed information about a specific user. It includes the user's profile picture, name, location, contact details, Nationality flag, and a Google Maps iframe showing the user's coordinates.
-
Components: Each UI component is designed to be reusable and modular. They are organized into separate folders based on their functionality.
The search functionality on the Listing page allows users to filter users based on their name or phone number. When the user types in the search input field, a debounce mechanism is applied to limit the frequency of API calls. The search term is used to filter the list of users fetched from the API, and the filtered results are displayed in real-time.
The project uses the following API to fetch random user data:
- Base URL:
https://randomuser.me/api/
The project structure is organized as follows:
frontend-coding-challenge/
│
├── src/
│ ├── components/
│ │ ├── filters/
│ │ ├── search/
│ │ ├── userCard/
│ │ ├── pagination/
│ │ ├── loadingIndicator/
│ │ ├── profile/
│ │ └── index.ts
│ ├── pages/
│ │ ├── listingPage/
│ │ └── profilePage.tsx
│ ├── services/
│ │ ├── userService/
│ │ └── index.ts
│ ├── types/
│ │ └── index.ts
│ ├── App.tsx
│ └── index.tsx
│
├── public/
│ ├── index.html
├── README.md
└── package.json
- React: Used as the frontend library for building UI components and managing state.
- React Router DOM: Used for client-side routing to navigate between different pages in the application.
- Axios: Used for making HTTP requests to fetch data from the API.
- Tailwind CSS: Used for styling the components with utility-first CSS classes for rapid development.
- React Icons: Used for including icons in the application for better user experience.
- React Country Flag: Used for displaying nationality flag icons based on user data.
- TypeScript: Used for adding static typing to JavaScript code, providing better code quality and developer experience.