{"id":27024261,"url":"https://github.com/jonathanperis/rinha2-back-end-python","last_synced_at":"2026-04-02T21:04:37.652Z","repository":{"id":282320222,"uuid":"948172915","full_name":"jonathanperis/rinha2-back-end-python","owner":"jonathanperis","description":"Python, Postgresql, Nginx e ódio","archived":false,"fork":false,"pushed_at":"2025-03-19T17:07:21.000Z","size":1738,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T21:18:52.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jonathanperis.github.io/rinha2-back-end-python/","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanperis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T21:48:53.000Z","updated_at":"2025-03-19T17:07:25.000Z","dependencies_parsed_at":"2025-03-18T19:46:50.015Z","dependency_job_id":"dcf65d81-96a4-46b6-8271-6445c27829c0","html_url":"https://github.com/jonathanperis/rinha2-back-end-python","commit_stats":null,"previous_names":["jonathanperis/rinha2-back-end-bora-dale-xgh-python","jonathanperis/rinha2-back-end-python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonathanperis/rinha2-back-end-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperis%2Frinha2-back-end-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperis%2Frinha2-back-end-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperis%2Frinha2-back-end-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperis%2Frinha2-back-end-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanperis","download_url":"https://codeload.github.com/jonathanperis/rinha2-back-end-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperis%2Frinha2-back-end-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263980180,"owners_count":23538922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-04T21:18:55.884Z","updated_at":"2026-04-02T21:04:37.643Z","avatar_url":"https://github.com/jonathanperis.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rinha2-back-end-python\n\n\u003e Python implementation for the Rinha de Backend 2024/Q1 challenge with PostgreSQL stored procedures and Nginx load balancing\n\n[![CI](https://github.com/jonathanperis/rinha2-back-end-python/actions/workflows/build-check-webapi.yml/badge.svg)](https://github.com/jonathanperis/rinha2-back-end-python/actions/workflows/build-check-webapi.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n---\n\n## About\n\nA Python implementation of the Brazilian backend challenge Rinha de Backend 2024/Q1, where a fictional bank API must handle concurrent transactions under strict resource constraints (1.5 CPU, 550MB RAM total). Uses PostgreSQL stored procedures for business logic and Nginx for load balancing across two API instances. Built for learning purposes.\n\n## Tech Stack\n\n| Technology | Version | Purpose |\n|-----------|---------|---------|\n| Python | - | API implementation |\n| PostgreSQL | - | Database with stored procedures |\n| Nginx | - | Reverse proxy and load balancer (least-conn) |\n| Docker | - | Containerization and orchestration |\n| k6 | - | Stress testing |\n\n## Features\n\n- PostgreSQL stored procedures for server-side business logic\n- PostgreSQL tuned with synchronous_commit=0, fsync=0, full_page_writes=0\n- Nginx least-conn load balancing across two API instances\n- All requests under 800ms at 250MB RAM usage (60% below limit)\n\n## Getting Started\n\n### Prerequisites\n\n- Docker with Docker Compose\n\n### Quick Start\n\n```bash\ngit clone https://github.com/jonathanperis/rinha2-back-end-python.git\ncd rinha2-back-end-python\ndocker compose up nginx -d --build\n```\n\nAPI available at `http://localhost:9999`\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/clientes/{id}/transacoes` | POST | Submit debit or credit transaction |\n| `/clientes/{id}/extrato` | GET | Get account balance statement |\n\n## Project Structure\n\n```\nrinha2-back-end-python/\n├── src/WebApi/         — API implementation\n├── docker-compose.yml  — Full stack: API x2, Nginx, PostgreSQL, k6, observability\n└── .github/workflows/  — CI/CD pipelines\n```\n\n## CI/CD\n\nTwo GitHub Actions workflows: `build-check-webapi.yml` runs on pull requests to build and health-check the API, and `main-release-webapi.yml` runs on the main branch to build a multi-platform Docker image and push it to GHCR.\n\n## License\n\nMIT — see [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanperis%2Frinha2-back-end-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanperis%2Frinha2-back-end-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanperis%2Frinha2-back-end-python/lists"}