Explore countries from around the globe, search for specific countries, view detailed information, and filter or sort the list as per your preference. The application also displays current weather information for each country's capital city.
The live demo of this application is available here: https://countries-explorer-pied.vercel.app
- Search for countries by name.
- Display a list of matching countries with key details:
- Country Name
- Capital
- Region
- Flag
- Click on a country to view detailed information, including:
- Languages spoken
- Currencies
- Population
- Neighbouring countries
- Time zones
- Weather Information:
- Current weather in the capital city.
- Details include:
- Temperature
- Weather conditions
- Icon representing the weather
- Filtering:
- Filter countries by region.
- Filter countries by language.
- Sorting:
- Sort the list by:
- Name
- Population
- Area
- Change sort order between ascending and descending.
- Sort the list by:
Follow these steps to set up and run the project locally.
Make sure you have the following installed on your machine:
- Node.js (v16+ recommended)
- npm (or yarn, depending on your preference)
-
Clone the repository:
git clone https://github.com/kostrubin/countries-explorer.git cd countries-explorer
-
Install dependencies:
npm install # or yarn install
-
Start the development server:
npm run dev # or yarn dev
- URL: https://graphql.country/
- Provides detailed information about countries, including:
- Name
- Capital
- Region
- Languages
- Currencies
- Population
- Borders
- Time zones
- URL: https://home.openweathermap.org
- Displays weather information for the capital city of selected countries.
- API Key is required to fetch weather data. See instructions below on how to set up your API key.
This project uses the OpenWeather API to fetch weather data for a selected country's capital.
Steps to Obtain an API Key Sign up at OpenWeather if you don't already have an account.
-
Log in and navigate to the API Keys section at https://home.openweathermap.org/api_keys.
-
Generate a new API key or copy an existing one.
-
Create a .env file in the root directory of the project:
touch .env
-
Add your API key to the
.env
file (you can copy the key from.env.example
file):VITE_OPENWEATHER_API_KEY=<your-api-key>
-
Restart the development server to apply the changes:
npm run dev # or yarn dev
- React
- TypeScript
- Vite
- Tailwind CSS
- Apollo Client
- Jest