Word Frequency Explorer is a simple web application that allows users to see the usage of a word and view the word count for each word in the text. The application is split into a microservice backend and a frontend, and uses Docker Compose to run both in a local development environment.
- React for the frontend
- Microservice backend using Node.js with Express and Redis for memory management
- WebSocket for real-time communication between the frontend and backend
- Docker Compose for running the application in a local development environment
To get started with Word Count Explorer, follow the steps below.
Before you can run the application, you must have the following installed:
- Docker
- Node.js
- Clone the repository:
git clone https://github.com/lukaskreibig/WordFrequencyExplorer.git- Navigate to the project directory:
cd WordFrequencyExplorerTo start the application, run the following command:
docker-compose upThis will start the frontend and backend containers, as well as a container running the WebSocket server.
Once the containers are running, you can access the application by navigating to http://localhost in your web browser.
To stop the application, press CTRL + C in the terminal where the docker-compose command is running. Then, run the following command to stop and remove the containers:
docker-compose downTo run the testing suites, navigate into the service you want to test and run the testing command:
cd frontend
- or -
cd blog-fetcher
- or -
cd web-socket
- and -
npm testThe microservices used are two separate components that work together to fetch, process, and display the word frequency data from blog posts. Here's an overview of their individual roles and how they interact with each other:
The purpose of this microservice is to periodically fetch blog posts from a specified API endpoint, count the word frequency in the blog posts, and then store the word frequency data in a Redis cache.
The purpose of this microservice is to serve as a WebSocket server that listens for incoming connections from clients (such as a frontend application). When a client connects, the server sends the latest word frequency data from the Redis cache to the client. The server also periodically checks for updates in the Redis cache and sends the updated data to the connected clients if the word frequency data has changed.