> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Example Voting Application

> Guide demonstrating a compact microservices voting application and its containerized deployment using Redis for queuing, a background worker, PostgreSQL persistence, and a results web UI.

Hello and welcome to this lesson.\
My name is Mumshad Mannambeth.

In this lesson/article we will explore microservices architecture by using a compact, multi-component sample web application and then deploy that application. This sample is commonly used to demonstrate Docker and microservice patterns (see the linked Docker training below) and is ideal for showing how small services interact via shared infrastructure.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/EeHAFJo7ohYv6ASi/images/OpenShift-3-for-the-Absolute-Beginners/Storage-Templates-and-Catalog/Example-Voting-Application/microservices-slide-loading-dots-presenter.jpg?fit=max&auto=format&n=EeHAFJo7ohYv6ASi&q=85&s=d1783ac8c9664e9077c441fa0767934c" alt="A blue presentation slide with the title &#x22;Microservices&#x22; on the left. On the right is a circular ring of blue dots like a loading icon, with a small footer showing a presenter's name." width="1920" height="1080" data-path="images/OpenShift-3-for-the-Absolute-Beginners/Storage-Templates-and-Catalog/Example-Voting-Application/microservices-slide-loading-dots-presenter.jpg" />
</Frame>

So let's get started.

Overview of the sample application

* The sample is a voting application that demonstrates a microservices-style stack built from several small components implemented in different languages and platforms.
* It is intentionally compact so you can focus on deployment, inter-service communication, and operational concerns instead of application complexity.
* Core features provided by the sample:
  * a web UI to submit votes,
  * a background worker to process votes,
  * a persistent database to store aggregated results, and
  * a web UI to display results.

We’ll use this application to show how an entire stack can be packaged, deployed, and run on container platforms.

Learn more: [Docker Training Course for the Absolute Beginner](https://learn.kodekloud.com/user/courses/docker-training-course-for-the-absolute-beginner)

Architecture and data flow (high level)

Component mapping and responsibilities:

| Component | Implementation | Responsibility |
| - | - | - |
| Voting app | Python | Presents two choices (cat vs. dog) and enqueues votes into Redis |
| Redis | In-memory datastore | Fast, ephemeral queue/store for incoming votes to keep frontend responsive |
| Worker | .NET | Consumes votes from Redis, processes them, and updates the persistent store |
| PostgreSQL | Relational DB | Stores aggregated vote counts (persisted state) |
| Results app | Node.js | Reads aggregated counts from PostgreSQL and displays current results |

How data flows through the system

1. A user chooses an option in the Voting app (e.g., "cats").
2. The Voting app writes the vote into Redis, allowing the front-end to respond quickly without waiting for a database transaction.
3. The Worker consumes the vote message from Redis, processes it, and increments the corresponding counters in PostgreSQL.
4. The Results app queries PostgreSQL and displays the updated aggregated totals to users.

This design shows common microservice patterns:

* Decoupled front-ends and background workers via a messaging/queue layer (Redis).
* Short-lived, in-memory buffering for responsiveness.
* A single durable datastore for aggregated state and queries.

Next steps in this lesson

* Package each component as a container image.
* Deploy the stack (Redis, PostgreSQL, voting app, worker, results app) to a container platform.
* Observe and verify end-to-end behavior by voting through the UI and seeing the results update.

<Callout icon="lightbulb" color="#1CB2FE">
  This lesson uses a multi-service sample to illustrate microservice patterns: decoupled front-ends, asynchronous processing via Redis, and a persistent datastore for aggregates. Use this stack to practice packaging, deployment, networking, and observability for microservices.
</Callout>

Links and references

* [Docker Training Course for the Absolute Beginner](https://learn.kodekloud.com/user/courses/docker-training-course-for-the-absolute-beginner)
* Redis: [https://redis.io/](https://redis.io/)
* PostgreSQL: [https://www.postgresql.org/](https://www.postgresql.org/)
* Python: [https://www.python.org/](https://www.python.org/)
* Node.js: [https://nodejs.org/](https://nodejs.org/)
* .NET: [https://dotnet.microsoft.com/](https://dotnet.microsoft.com/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/openshift-3-for-the-absolute-beginners/module/b01015b4-ff27-4531-8507-ffb64893375d/lesson/8a27c7c1-7b28-460a-8d1a-874a15bdac34" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.