{"id":29663109,"url":"https://github.com/bulletdev/bullet-crystal","last_synced_at":"2025-07-22T11:08:14.808Z","repository":{"id":305386715,"uuid":"1021185125","full_name":"Bulletdev/bullet-crystal","owner":"Bulletdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-19T19:32:39.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-19T21:53:49.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bulletdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-07-17T03:02:29.000Z","updated_at":"2025-07-19T19:32:43.000Z","dependencies_parsed_at":"2025-07-19T21:54:00.143Z","dependency_job_id":"ea820790-f7ed-42ba-8c36-4c31890d5cb8","html_url":"https://github.com/Bulletdev/bullet-crystal","commit_stats":null,"previous_names":["bulletdev/bullet-crystal"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Bulletdev/bullet-crystal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bulletdev%2Fbullet-crystal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bulletdev%2Fbullet-crystal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bulletdev%2Fbullet-crystal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bulletdev%2Fbullet-crystal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bulletdev","download_url":"https://codeload.github.com/Bulletdev/bullet-crystal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bulletdev%2Fbullet-crystal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266481732,"owners_count":23935938,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-07-22T11:08:10.047Z","updated_at":"2025-07-22T11:08:14.798Z","avatar_url":"https://github.com/Bulletdev.png","language":"Crystal","readme":"#  🐓 Rinha de Backend 2025 - Crystal\n\n \u003cdiv\u003e\n\n                   ⢀⣴⣿⣿⣿⣿⣿⣶⣶⣶⣿⣿⣶⣶⣶⣶⣶⣿⡿⣿⣾⣷⣶⣶⣾⣿⠀                                                                                                                          \n                 ⣠⣿⣿⢿⣿⣯⠀⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⡇⣿⣿⣿⣿⣿⡇                                                                                                     \n             ⠀⣰⣿⣿⣷⡟⠤⠟⠁⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣿⣿⡇ \n             ⠀⣿⣿⣿⣿⣿⣷⣶⣿⣿⡟⠁⣮⡻⣿⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣿⣿⡇ \n             ⠘⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⣿⣿⣹⣿⣿⣿⣿⣿⣿⡿⢸⡇⣿⣿⣿⣿⣿⡇ \n             ⠀⠙⢿⣿⣿⣿⡿⠟⠁⣿⣿⣶⣿⠟⢻⣿⣿⣿⣿⣿⣿⡇⣼⡇⣿⣿⣿⣿⣿⠇\n             ⠀⠀⠈⠋⠉⠁⣶⣶⣶⣿⣿⣿⣿⢀⣿⣿⣿⣿⣿⣿⣿⣇⣿⢰⣿⣿⣿⣿⣿⠀ \n             ⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⡄⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣽⣿⣼⣿⣿⣿⣿⠇⠀ \n             ⠀⠀⠀⠀⠀⠀⠀⠈⠉⠒⠚⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠛⠿⠿⠿⠿⠿⠋⠀⠀ \n             ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \n             ⠀⠀⠀⣿⣙⡆⠀⠀⡇⠀⢸⠀⠀⢸⠀⠀ ⢸⡇⠀⠀⢸⣏⡉  ⠙⡏⠁⠀ \n             ⠀⠀⠀⣿⣉⡷⠀⠀⢧⣀⣼ ⠀⢸⣀  ⢸⣇⡀ ⢸⣏⣁⠀ ⠀⡇⠀ \n\n             \n  \u003c/div\u003e\n  \n\n## 📋 Stack Utilizada\n\n- **Crystal**: Linguagem de programação de alta performance\n- **PostgreSQL**: Armazenamento de dados de pagamentos\n- **Redis**: Cache para otimização de health checks\n- **Nginx**: Load balancer com round-robin\n- **Docker**: Containerização completa\n\n##  Como Executar\n\n### 1. Subir os Payment Processors\n```bash\n# Primeiro, suba os payment processors\ndocker-compose -f docker-compose.yml up -d\n```\n\n### 2. Subir o Backend\n```bash\n# Depois, suba o backend\ndocker-compose up -d\n```\n\n### 3. Acessar a API\nA API estará disponível em `http://localhost:9999`\n\n##  Endpoints da API\n\n \u003cdetails align=\"left\"\u003e\n\n### POST `/payments`\n\nIntermedia uma solicitação de pagamento para os Payment Processors.\n\n**Corpo da Requisição:**\n```json\n{\n  \"correlationId\": \"4a7901b8-7d26-4d9d-aa19-4dc1c7cf60b3\",\n  \"amount\": 19.90\n}\n```\n\n**Campos:**\n- `correlationId`: UUID único obrigatório\n- `amount`: Valor decimal obrigatório (maior que 0)\n\n**Respostas:**\n- `200 OK`: Pagamento processado com sucesso\n- `400 Bad Request`: Dados de entrada inválidos\n- `500 Internal Server Error`: Erro no processamento\n\n### GET `/payments-summary`\n\nRetorna resumo dos pagamentos processados, usado para auditoria.\n\n**Parâmetros de Query (opcionais):**\n- `from`: Timestamp ISO em UTC (ex: `2020-07-10T12:34:56.000Z`)\n- `to`: Timestamp ISO em UTC (ex: `2020-07-10T12:35:56.000Z`)\n\n**Exemplo de Uso:**\n```\nGET /payments-summary?from=2020-07-10T12:34:56.000Z\u0026to=2020-07-10T12:35:56.000Z\n```\n\n**Resposta (200 OK):**\n```json\n{\n  \"default\": {\n    \"totalRequests\": 43236,\n    \"totalAmount\": 415542345.98\n  },\n  \"fallback\": {\n    \"totalRequests\": 423545,\n    \"totalAmount\": 329347.34\n  }\n}\n```\n\n### POST `/purge-payments`  \n\nEndpoint secreto utilizado pelo script de teste da Rinha para limpar todos os pagamentos do banco. Não requer corpo na requisição.\n\n**Exemplo de Uso:**\n```\ncurl -X POST http://localhost:9999/purge-payments\n```\n\n**Resposta (200 OK):**\n```json\n{\"result\": \"ok\"}\n```\n\u003c/details\u003e\n\n### Limites de Memória\n\n- API 1: 70MB\n- API 2: 70MB\n- PostgreSQL: 180MB\n- Nginx: 20MB\n- **Total: 340MB** (dentro do limite de 350MB)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbulletdev%2Fbullet-crystal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbulletdev%2Fbullet-crystal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbulletdev%2Fbullet-crystal/lists"}