This is the frontend application for the Country Info App, built with Next.js and React. It allows users to view a list of countries and detailed information about each country, including bordering countries and population data.
- List of countries with flags
- Detailed country information page
- Interactive population chart
- Responsive design
- Server-side rendering with Next.js
Before you begin, ensure you have the following installed:
- Node.js (v14 or later)
- npm (v6 or later)
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy the
.env.example
file to a new file named.env.local
:cp .env.example .env.local
- Edit
.env.local
and set theNEXT_PUBLIC_API_URL
to your backend API URL.
- Copy the
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser to view the application.
In the project directory, you can run:
npm run dev
: Runs the app in development modenpm run build
: Builds the app for productionnpm start
: Runs the built app in production modenpm run lint
: Lints the codebasenpm run format
: Formats the codebase using Prettiernpm run format:check
: Checks if the codebase is formatted correctly
src/
├── app/ # Next.js app router pages
├── components/ # React components
├── lib/ # Utility functions and API calls
└── ...
public/ # Static assets
This project uses Tailwind CSS for styling. The main stylesheet is located at src/app/globals.css
.
The following environment variables are required:
NEXT_PUBLIC_API_URL
: The URL of the backend API
API calls are made using Axios. The API integration is handled in src/lib/api.ts
.
This project uses ESLint for linting and Prettier for code formatting. Configuration files for both tools are included in the root directory.
This project is licensed under the MIT License - see the LICENSE file for details.