Country Visit Tracker is a web application for tracking the number of visits to various countries. It consists of a REST API backend built with Node.js/Express, a frontend built with Next.js, and uses Redis for data storage. The application supports high-load scenarios and visualizes data using a Choropleth map and a bar chart.
Ensure you have the following installed:
- Docker (for running the application)
-
Clone the Repository:
git clone https://github.com/mbidnyj/country-visit-tracker cd country-visit-tracker
-
Build and Start the Containers:
Use Docker Compose to build and start the backend, frontend, and Redis services:
docker-compose up --build
This command builds the Docker images and starts the containers. The backend will automatically seed the Redis database after connecting.
-
Access the Application:
- Frontend:
http://localhost:3001
- Backend:
http://localhost:3000
- Frontend:
-
Stop the Application:
To stop the running containers, use:
docker-compose down
- /app: Frontend code (Next.js).
- /www: Backend code (Node.js/Express).
- /tests: Unit and integration tests.
- /performance-tests: Performance tests (run separately).
- /www/seed.js: Script for seeding the Redis database with initial data.
- Endpoint:
/statistics
- Method:
POST
- Request Body:
{ "countryCode": "us" }
- Response:
200 OK
- Endpoint:
/statistics
- Method:
GET
- Response:
200 OK
with a JSON object containing country codes and visit counts.
Tests are automatically run as part of the Docker Compose process.
-
Build and Start All Services:
docker-compose up --build
This command will automatically run all tests after the services are up.
-
View Test Results:
Monitor the Docker Compose logs to see the test results.
-
Clean Up:
docker-compose down