Skip to content

The FIAP.TechChallenge.ByteMeBurger project is a comprehensive solution for managing a burger ordering system. It includes multiple modules for domain logic, application services, API endpoints, and infrastructure. The project is designed to be scalable, maintainable, and secure, leveraging modern .NET practices and AWS services.

License

Notifications You must be signed in to change notification settings

soat-fiap/FIAP.TechChallenge.ByteMeBurger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FIAP Tech Challenge - ByteMeBurger API

CI

Coverage Quality Gate Status

Description

This repository contains the source code for the ByteMeBurger API, part of the FIAP Tech Challenge. The API is designed to manage a burger restaurant's operations, including order placement, customer registration, and product management. The recent updates introduce a new endpoint for customer registration and enhance various aspects of the application, such as error handling, data models, and service configurations.

Endpoints are protected since JWT token is now required. Since this application will run on EKS Cluster inside a private VPC, Customers endpoint will be deprecated or splited into a different service. Customers information can be extracted from token, since it's generated and validated internally.

Masstransit

It uses Masstransit to manage communication between services. Masstransit automatically creates Topics, Queues and Subscriptions.

Getting Started

Dependencies

Prerequisites

  • Docker
  • .NET SDK
  • Optionally, an IDE such as Visual Studio or VSCode

Setup

  1. Clone the repository:

    git clone https://github.com/soat-fiap/FIAP.TechChallenge.ByteMeBurger.git
    cd FIAP.TechChallenge.ByteMeBurger
  2. Configure environment variables

    • Configure .env file. You can use the .env.sample
    • Remember to create the .env file
  3. Start the services using Docker:

     docker-compose up -d
  4. Service health (check if the service is healthy before testing)

    http://localhost:8080/healthz

  5. To verify the existing endpoints, go to

    http://localhost:8080/swagger/index.html

  6. If you want to quickly seed the database with fake data and test some of the endpoints use the FIAP_TechChallenge_ByteMeBurger-endpoints.http file

  7. Logs should (not guaranteed) be available here http://localhost:8081

  8. Stop the services using Docker:

     docker-compose down

Running with Kubernetes locally

Prerequisites

  • Docker with Minikube configured
Follow this if you want to build images locally

To Use local docker images in minikube, you can use the following commands to Push directly to the in-cluster Docker daemon (docker-env)

  minikube start
  minikube -p minikube docker-env --shell powershell | Invoke-Expression

Database

docker build -t techchallenge/db:latest -f .\database\Dockerfile .\database
docker image push techchallenge/db:latest
    image: techchallenge/db:latest

API

docker build -t techchallenge/api:latest -f .\src\FIAP.TechChallenge.ByteMeBurger.Api\Dockerfile .
docker image push techchallenge/api:latest
    image: techchallenge/api:latest

Setup kubernetes

Run deploy.ps1 script to deploy the application to minikube

Use tunnel and port-forward to access the application

To access Seq from host

kubectl port-forward service/svc-seq 30008:80

To access the API from host

minikube tunnel

Testing

You can use the postman collection for testing

To test mercado pago integration don't forget to add your credentials to the secret-mercadopago file and the notification url on configmap-api

Cleanup

Once you are done, you can stop the services running rollback.ps1 script

Authentication & Authorization

Since the application is running inside a private subnet and tokens are generated internally by API Gateway information on the token use used for some use cases where user information is required like Creating a new Order.

ProductsController

  • Endpoint: GET /api/products
    • Requires Admin role
  • Endpoint: DELETE /api/products/{id}
    • Requires Admin role

CustomersController

  • Endpoint: GET /api/customers
    • Requires Admin role
  • Endpoint: POST /api/customers
    • Requires Customer/Admin role

OrdersController

  • Endpoint: POST /api/orders
    • Requires Customer/Admin role
  • Endpoint: GET /api/orders/{id}
    • Requires Admin/Kitchen role

This repo on the infrastructure

Architecture Diagram

K8S

Architecture Diagram

About

The FIAP.TechChallenge.ByteMeBurger project is a comprehensive solution for managing a burger ordering system. It includes multiple modules for domain logic, application services, API endpoints, and infrastructure. The project is designed to be scalable, maintainable, and secure, leveraging modern .NET practices and AWS services.

Topics

Resources

License

Stars

Watchers

Forks

Packages