Rinha de Backend (.NET)

About the Project

The rinha2-back-end-dotnet project was developed during the Rinha de Backend competition. It showcases a fusion of modern technologies and robust coding.

Technologies used include:

  • JavaScript: Dynamic functionalities and server-side operations.
  • PLpgSQL: Advanced database procedures ensuring optimal performance.
  • C#: Performance-critical backend services.
  • Docker: Containerization for consistent deployments.
  • Shell: Automation and efficient scripting.

Technical Excellence

Built around clean code principles and a modular architecture, the project ensures:

  • Scalability and maintainability.
  • Robust error handling and comprehensive logging.
  • Optimized database interactions.
  • Consistent deployments via containerization.
  • Automated routine tasks using shell scripts.

User Experience

With a clean, minimalistic design inspired by GitHub, this page offers a straightforward interface to explore the project's technical strengths.

Competition Rules

The competition requires you to develop an HTTP API with specific endpoints and behaviors. Here are the key rules:

  • Transações Endpoint:
    • HTTP Method: POST /clientes/[id]/transacoes
    • Request Body must include:
      • valor: a positive integer in centavos (e.g., R$ 10 = 1000 centavos)
      • tipo: either c (credit) or d (debit)
      • descricao: a string between 1 and 10 characters
    • Validation rules:
      • All fields are mandatory.
      • A debit transaction must not drop the client’s balance below their limit. Transactions causing an inconsistency must return HTTP 422.
      • Requests with a non-existent client ID must return HTTP 404.
    • Response:
      • HTTP 200 OK for successful transactions
      • Response JSON contains the client's limite and updated saldo.
  • Extrato Endpoint:
    • HTTP Method: GET /clientes/[id]/extrato
    • Response:
      • HTTP 200 OK along with a JSON object containing:
        • saldo object with total, data_extrato, and limite
        • ultimas_transacoes: up to the 10 most recent transactions (including valor, tipo, descricao, and realizada_em[...]
      • Requests with a non-existent client ID must return HTTP 404.
  • Initial Client Data:
    • Only five clients exist with the following IDs and limits:
    • ID 1: Limit 100,000
    • ID 2: Limit 80,000
    • ID 3: Limit 1,000,000
    • ID 4: Limit 10,000,000
    • ID 5: Limit 500,000
    • Do not register a client with ID 6.
  • Additional Requirements:
    • Containerize your API using a docker-compose.yml file that respects the provided CPU and memory restrictions.
    • Ensure all services are publicly available; otherwise, tests will not be executed.
    • The source repository for your API must be publicly accessible and mentioned in your submission README.

For full details, please refer to the official competition README available here.

Load Test Reports

Below is a list of load test reports generated via Github Actions. These reports are hosted publicly via GitHub Pages.

Note: Previously, the load script for this project was developed for the Gatling load test framework using Scala. It has now been migrated to Grafana K6 using JavaScript to better integrate with our CI/CD environment since Grafana K6 supports CLI natively.

  • Loading reports...