{"id":50400245,"url":"https://github.com/deypadma2020/calculatorapp","last_synced_at":"2026-05-30T23:02:38.488Z","repository":{"id":301485537,"uuid":"1009398640","full_name":"deypadma2020/CalculatorApp","owner":"deypadma2020","description":"✏️ Production-ready FastAPI-based calculator app with CLI \u0026 REST API support, custom logging, exceptions, Docker, and automated testing.","archived":false,"fork":false,"pushed_at":"2025-08-16T18:13:22.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-16T19:14:49.267Z","etag":null,"topics":["anthropic-claude","calculator-application","cli","clocker","fastapi","logging","pytest","python","rest-api","unittests"],"latest_commit_sha":null,"homepage":"https://calculatorapp-jkgf.onrender.com/","language":"Python","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/deypadma2020.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,"zenodo":null}},"created_at":"2025-06-27T04:23:42.000Z","updated_at":"2025-08-16T18:15:46.000Z","dependencies_parsed_at":"2025-06-27T05:36:06.817Z","dependency_job_id":"1054e08a-e69a-43bc-a820-9e1137156f24","html_url":"https://github.com/deypadma2020/CalculatorApp","commit_stats":null,"previous_names":["deypadma2020/calculatorapp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deypadma2020/CalculatorApp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deypadma2020%2FCalculatorApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deypadma2020%2FCalculatorApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deypadma2020%2FCalculatorApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deypadma2020%2FCalculatorApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deypadma2020","download_url":"https://codeload.github.com/deypadma2020/CalculatorApp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deypadma2020%2FCalculatorApp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33712580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["anthropic-claude","calculator-application","cli","clocker","fastapi","logging","pytest","python","rest-api","unittests"],"created_at":"2026-05-30T23:02:32.677Z","updated_at":"2026-05-30T23:02:38.031Z","avatar_url":"https://github.com/deypadma2020.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"```markdown\n# 🧮 Calculator API\n\nA production-ready, modular FastAPI-based calculator project that supports both command-line interface (CLI) and REST API operations. It includes logging, custom exceptions, test automation, and Docker deployment.\n\n---\n\n## 📌 Project Overview\n\nThis project is a robust calculator that:\n\n- Performs basic arithmetic operations (add, subtract, multiply, divide)\n- Exposes a REST API via FastAPI\n- Includes full logging and error handling\n- Can be run via CLI or HTTP\n- Is modular, scalable, and test-driven\n- Provides health check, Docker support, and full API documentation\n\n---\n\n## 📁 Project Structure\n\n```\n\ncalculator\\_project/\n│\n├── app/                      # Application code\n│   ├── api/                  # FastAPI routes\n│   ├── service/              # Business logic\n│   └── utils/                # Exceptions, logger\n│\n├── api\\_test/                 # API tests using pytest\n├── func\\_tests/               # Unit tests using unittest\n│\n├── main.py                   # FastAPI app entry point\n├── setup.py                  # Packaging config\n├── pyproject.toml            # Modern build config\n├── Makefile                  # Dev automation commands\n├── Dockerfile                # Image build config\n├── docker-compose.yaml       # Compose config\n├── requirements.txt\n└── README.md                 # You are here\n\n````\n\n---\n\n## 🚀 Functionality\n\n### ✅ API Endpoints\n\n| Operation    | Endpoint         | Method | Example Payload          |\n|--------------|------------------|--------|--------------------------|\n| Add          | `/api/v1/add`    | POST   | `{ \"a\": 10, \"b\": 5 }`    |\n| Subtract     | `/api/v1/sub`    | POST   | `{ \"a\": 10, \"b\": 5 }`    |\n| Multiply     | `/api/v1/mul`    | POST   | `{ \"a\": 10, \"b\": 5 }`    |\n| Divide       | `/api/v1/div`    | POST   | `{ \"a\": 10, \"b\": 2 }`    |\n| Health Check | `/api/v1/health` | GET    | —                        |\n\n### ✅ Sample Response\n\n```json\n{\n  \"result\": 15\n}\n````\n\n---\n\n## 🧰 How to Use\n\n### 📦 Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### ▶️ Run Locally\n\n```bash\nmake run\n```\n\nThen open:\n\n* Swagger UI: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)\n* ReDoc: [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc)\n\n---\n\n## ⚙️ CLI Usage (Optional)\n\nTo run calculator interactively from terminal:\n\n```bash\npython main.py\n```\n\nThis mode supports step-by-step number and operator inputs via CLI.\n\n---\n\n## 🐳 Docker Usage\n\n### 🔨 Build Docker Image\n\n```bash\nmake docker\n```\n\n### 🚀 Run via Docker Compose\n\n```bash\nmake docker-up\n```\n\nYour app will be available at: [http://localhost:8000](http://localhost:8000)\n\nTo stop:\n\n```bash\nmake docker-down\n```\n\n---\n\n## 🧪 Running Tests\n\n### ✅ Run All Tests\n\n```bash\nmake test\n```\n\n### 🧪 Run Unit (Function) Tests\n\n```bash\nmake unit-test\n```\n\n### 🌐 Run API (Endpoint) Tests\n\n```bash\nmake api-test\n```\n\n---\n\n## 📬 Postman Testing Example\n\n1. Open Postman or REST client.\n2. Send a `POST` request:\n\n```\nPOST http://127.0.0.1:8000/api/v1/add\nContent-Type: application/json\n\n{\n  \"a\": 5,\n  \"b\": 10\n}\n```\n\n3. Response:\n\n```json\n{\n  \"result\": 15\n}\n```\n\n4. Try `/sub`, `/mul`, `/div`, `/health` as well.\n\n---\n\n## 🛠️ Developer Shortcuts via Makefile\n\n```bash\nmake run          # Start API server locally\nmake test         # Run all tests with coverage\nmake unit-test    # Run function/unit tests only\nmake api-test     # Run API tests only\nmake lint         # Run flake8 linter\nmake format       # Format code with black\nmake clean        # Remove __pycache__ and logs\nmake docker       # Build Docker image\nmake docker-up    # Run with Docker Compose\nmake docker-down  # Stop Docker Compose\n```\n\n---\n\n## 📄 API Docs (via Swagger \u0026 ReDoc)\n\nAfter running the app:\n\n* 📘 Swagger UI: [http://localhost:8000/docs](http://localhost:8000/docs)\n* 📕 ReDoc UI: [http://localhost:8000/redoc](http://localhost:8000/redoc)\n\n---\n\n## 🔐 Error Handling\n\nHandled with custom exception logic for clarity.\n\n### Example: Division by zero\n\n```json\n{\n  \"detail\": \"Error occurred in python script name [core.py] line number [10] error message[Division by zero is not allowed]\"\n}\n```\n\n---\n\n## 🧱 Future Improvements\n\n* ✅ Add exponentiation/modulus support\n* 🔒 JWT authentication for API\n* 🚀 Auto-deploy to AWS/Render\n* 🔁 CI/CD pipeline via GitHub Actions\n* 📊 Add Prometheus `/metrics` endpoint\n\n---\n\n## 👨‍💻 Author\n\n**Padma Dey**\n📧 [deypadma2022@gmail.com](mailto:deypadma2022@gmail.com)\n🌐 [GitHub Profile](https://github.com/deypadma2020)\n\n---\n\n## 🪪 License\n\nThis project is licensed under the MIT License. See `LICENSE` file for details.\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeypadma2020%2Fcalculatorapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeypadma2020%2Fcalculatorapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeypadma2020%2Fcalculatorapp/lists"}