evilfeeh / self-service-totem

Project about Tech Challenge from FIAP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SELF SERVICE TOTEM

Node Version GitHub Actions Workflow Status GitHub Actions Workflow Status

This Project about Tech Challenge from FIAP A monolith backend Developed with TypeScript, Docker, DDD and hexagonal architecture.

ABOUT

We're introducing an Software that aims to optimize the self-service process in fast-food restaurants. Through an interactive totem, customers can place their orders quickly, conveniently and autonomously, reducing queues and speeding up service.

Our Event Storming can be found here: https://miro.com/app/board/uXjVKVP2yDY=/

For more details about the project, access: https://github.com/evilfeeh/self-service-totem

FEATURES

  • Customer:
    • Register a new customer
    • identify a customer by their CPF
  • Product:
    • Create, update and delete a product
    • Find a product by category
  • Orders:
    • Register a new order
    • Simulate checkout process (fake checkout)
    • List orders

ubiquitous Language Dictionary

  • Cliente (Customer): Person who will consume the order
  • Pedido (Order): The order with all customer's Items
  • Cozinha (Kitchen): Team preparing the items of order
  • Pagamento (Payment): Process to pay the order
  • Lanche, Acompanhamento, Bebida, Sobremesa: Items avaiable into the menu

PREREQUISITES

Docker

HOW TO SETUP:

Clone the project repository:

git clone https://github.com/evilfeeh/self-service-totem.git

Access the project directory:

cd self-service-totem

Run the application with Docker Compose:

docker compose up

The apps runs into port 3000, it's possible to change the value port or other environments inside a .env file

To access the docs, access: http://localhost:3000/api/docs

HOW TO SETUP KUBERNETES:

In your local environment, you'll need to use Minikube and Kubectl to implement our application locally.

to see how it works, please follow these:

After following this steps, you'll need run the namespace creation in the terminal:

    cd k8s/
    kubectl apply -f namespace.yaml

After this, run the following commands to run the api and the database:

    kubectl apply -f api/
    kubectl apply -f mysql/

This commands will create:

  • API deployment - containg our solution
  • Database statefulset
  • Load Balancer Service for API and a ClusterIP none for database
  • ConfigMap with with environment variables
  • Secrets with database credentials
  • HPA to scale the pods automatically
  • PV, PVC and StorageClass to create disk for the application

Accessing the API

After running everything, you can use the Kubectl commands to ensure the pods are initialized. To access the Swagger aplication, you'll need to port fowarding the api.

Specify the API's pod name and run:

kubectl port-forward <api-pod-name> 3000:3000

Performance test:

To see the pods scaling, we create a k6 perfomance test that can be found on ./k6-escalabity-tests.js

Don't forget to install K6 before execute this

Run it and get the pods to se how its scale:

k6 run k6-escalabity-tests.js

PHASE 2 DIAGRAM

Diagrama Comunicação entre componentes K8s

PHASE 2 VIDEO

Watch explanatory video

About

Project about Tech Challenge from FIAP

License:GNU General Public License v3.0


Languages

Language:TypeScript 98.6%Language:JavaScript 0.7%Language:Shell 0.4%Language:Dockerfile 0.3%