{"id":20461265,"url":"https://github.com/infectedduck/scalable-hit-counter-api","last_synced_at":"2026-04-21T04:04:20.390Z","repository":{"id":256897300,"uuid":"850171018","full_name":"InfectedDuck/Scalable-Hit-Counter-API","owner":"InfectedDuck","description":"A Flask-based RESTful API for managing named hit counters with CRUD operations. Scalable, containerized with Docker, and ready for CI/CD integration. Supports automated testing and flexible deployments.","archived":false,"fork":false,"pushed_at":"2024-09-14T00:05:46.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T11:35:12.362Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InfectedDuck.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":"2024-08-31T03:48:38.000Z","updated_at":"2024-09-14T00:05:49.000Z","dependencies_parsed_at":"2024-09-14T03:09:23.819Z","dependency_job_id":null,"html_url":"https://github.com/InfectedDuck/Scalable-Hit-Counter-API","commit_stats":null,"previous_names":["infectedduck/ci-cd-final-project"],"tags_count":0,"template":false,"template_full_name":"ibm-developer-skills-network/vselh-ci-cd-final-project-template","purl":"pkg:github/InfectedDuck/Scalable-Hit-Counter-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FScalable-Hit-Counter-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FScalable-Hit-Counter-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FScalable-Hit-Counter-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FScalable-Hit-Counter-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InfectedDuck","download_url":"https://codeload.github.com/InfectedDuck/Scalable-Hit-Counter-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FScalable-Hit-Counter-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32076295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-11-15T12:24:33.640Z","updated_at":"2026-04-21T04:04:20.375Z","avatar_url":"https://github.com/InfectedDuck.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hit Counter Service API\n\nA **Flask-based RESTful API** designed to manage named hit counters. This service allows users to create, update, list, and delete counters efficiently. It’s designed with scalability and performance in mind, making it suitable for production-level use cases that require counting services such as analytics, click tracking, or any incremental counter-based system.\n\n## Key Features\n\n- **Robust REST API:** Supports CRUD operations for hit counters.\n- **Scalability:** Designed to handle multiple counters concurrently.\n- **Simple Architecture:** Lightweight and flexible service structure.\n- **Containerization:** Easily deployable via Docker.\n- **Health Monitoring:** Includes a health check endpoint to monitor service status.\n- **Automated Testing:** Unit test coverage with `unittest` for each key functionality.\n- **Extensible Design:** Can be easily integrated into larger microservice ecosystems.\n\n## Technology Stack\n\n- **Backend:** Flask (Python)\n- **Data Handling:** In-memory Python dictionary (can be extended to Redis or other databases)\n- **Testing:** `unittest` with `nose` for test discovery and `coverage` for test coverage.\n- **Containerization:** Docker for simplified deployment and portability.\n- **Version Control:** Git for managing source code.\n- **CI/CD Pipeline (Optional):** Configurable for integration into Jenkins, GitHub Actions, or other CI/CD systems.\n  \n## Architecture\n\nThe Hit Counter Service API follows a simple **Model-View-Controller (MVC)** architecture pattern, which makes it easy to extend, debug, and maintain.\n\n### Request Flow\n\n1. **HTTP Request:** The client sends an HTTP request (GET, POST, PUT, DELETE) to manage counters.\n2. **Controller:** Flask routes handle the request and pass it to the appropriate logic.\n3. **Business Logic:** The logic for handling counter operations (create, update, delete, list) is executed. \n4. **Response:** The service returns a JSON response with the result or error message.\n\nThis architecture allows for separation of concerns and makes the application modular, extensible, and easy to scale.\n\n## Installation and Setup\n\n1. **Clone the repository:**\n```bash\ngit clone \u003crepository_url\u003e\ncd \u003crepository_folder\u003e\n```\n\n2. **Create a virtual environment:**\n  ```bash\npython3 -m venv venv\n  ```\n\n3. **Activate the virtual environment:**\n  ```bash\nsource venv/bin/activate\n```\n4. **Install the dependencies from the requirements file:**\n```bash\npip install -r requirements.txt\n```\n5. **Run the Flask application:**\n```bash\nflask run\n```\n6. **The service will be available at:**\n```bash\nhttp://localhost:5000\n```\n\n## Scalability \u0026 Performance\n\nThis service can scale both horizontally and vertically:\n\n### Horizontal Scaling:\n* The application can be containerized and deployed in a Kubernetes cluster or Docker Swarm for auto-scaling based on traffic.\n* Using a Redis or Memcached backend instead of an in-memory dictionary allows the service to scale across multiple instances seamlessly.\n\n### Vertical Scaling:\n* Memory usage can be optimized by switching from in-memory data storage to a more efficient database system (e.g., Redis or MongoDB), allowing handling of millions of counters.\n* The service can be deployed on larger instances (e.g., AWS EC2, Google Cloud Compute Engine) to increase computational power for high-traffic environments.\n\n## Extensibility\n\nThe current version of the service uses in-memory storage for simplicity and rapid prototyping. However, it’s designed with flexibility in mind:\n\n* **Database Integration:** Easily switch from in-memory to a persistent database like Redis, MongoDB, MySQL, or PostgreSQL by modifying the data access layer.\n* **Custom Counter Logic:** If you need specialized counter behavior (e.g., time-based expiration, complex aggregation), the service logic can be extended.\n* **Authentication \u0026 Authorization:** Integrate OAuth2, JWT, or API key-based authentication for restricted access.\n* **Load Balancing:** When deployed in production, you can use Nginx or HAProxy to manage multiple instances of the service for load balancing.\n\n## Deployment\n\nThis project is designed to be deployable in various environments, from local testing to production.\n\n### Production Deployment Options:\n* **Docker + Kubernetes:** Use Kubernetes for orchestrating multiple containers, making it easy to scale the service based on traffic.\n* **AWS Elastic Beanstalk:** For simple, scalable cloud deployment with automatic load balancing and scaling.\n* **Heroku:** A quick and easy way to deploy Flask applications using Heroku’s Git-based deployment model.\n\n## CI/CD Integration\n\nThe application is CI/CD-ready, with the following features that can be integrated:\n\n* **Automated Testing:** `unittest` framework can be integrated into CI pipelines to run tests on each push.\n* **Docker Image Build:** Automatic builds and deployment through DockerHub.\n* **Code Quality Checks:** Integrate `flake8` for linting and `pytest` for advanced testing during the CI process.\n\n## License\nThis project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details. \u003cbr\u003e\nThis project is made as a part of IBM Course.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfectedduck%2Fscalable-hit-counter-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfectedduck%2Fscalable-hit-counter-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfectedduck%2Fscalable-hit-counter-api/lists"}