{"id":15118598,"url":"https://github.com/mirzaim/url-shortner","last_synced_at":"2026-01-17T03:47:04.408Z","repository":{"id":257326670,"uuid":"857920991","full_name":"mirzaim/url-shortner","owner":"mirzaim","description":"A microservice-based URL shortener built with Flask, Docker, and Kubernetes for scalable deployment.","archived":false,"fork":false,"pushed_at":"2024-09-16T00:13:57.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T16:25:47.824Z","etag":null,"topics":["docker","docker-compose","falsk","kubernetes","microservice","url-shortener"],"latest_commit_sha":null,"homepage":"","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/mirzaim.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}},"created_at":"2024-09-16T00:13:55.000Z","updated_at":"2024-09-16T00:15:57.000Z","dependencies_parsed_at":"2024-09-16T02:43:30.124Z","dependency_job_id":"2262410f-f6d9-4d1c-80aa-3167c0f125e2","html_url":"https://github.com/mirzaim/url-shortner","commit_stats":null,"previous_names":["mirzaim/url-shortner"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirzaim%2Furl-shortner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirzaim%2Furl-shortner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirzaim%2Furl-shortner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirzaim%2Furl-shortner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirzaim","download_url":"https://codeload.github.com/mirzaim/url-shortner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247385703,"owners_count":20930600,"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":["docker","docker-compose","falsk","kubernetes","microservice","url-shortener"],"created_at":"2024-09-26T01:47:32.782Z","updated_at":"2026-01-17T03:47:04.379Z","avatar_url":"https://github.com/mirzaim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URL Shortner\r\n\r\nThis project is a microservice-based URL shortener application deployed using Docker and Kubernetes. The project contains multiple components, including a Python application, Helm charts for managing Kubernetes resources, and Docker configuration files.\r\n\r\n## Project Structure\r\n\r\n- **app/**: Contains the main application code.\r\n  - **app.py**: The main Python script for the application.\r\n  - **templates/**: HTML templates for rendering web pages.\r\n  \r\n- **Chart/**: Helm chart configuration for deploying the application on Kubernetes.\r\n  - **Chart.yaml**: Metadata about the Helm chart, including the name, version, and description.\r\n  - **values.yaml**: Default values for the Helm chart that can be customized during deployment.\r\n\r\n- **docker-compose.yml**: Configuration file for Docker Compose to manage multi-container Docker applications.\r\n\r\n- **Dockerfile**: Defines the environment and instructions for building the Docker image for the application.\r\n\r\n- **kubernetes/**: Kubernetes YAML configurations for deploying the application.\r\n  - **app-dep.yml**: Deployment file for the application.\r\n  - **configmap.yml**: Configuration file to store non-sensitive application settings.\r\n  - **db-dep.yml**: Deployment file for the database.\r\n  - **db-statefulset.yml**: StatefulSet configuration for ensuring the database runs in a stable and consistent environment.\r\n  - **hpa-dep.yml**: Configuration for the Horizontal Pod Autoscaler.\r\n  - **secret.yml**: Configuration for managing sensitive data such as passwords.\r\n  - **volume.yml**: Configuration file for managing persistent volumes.\r\n\r\n- **README.md**: This documentation file.\r\n\r\n- **requirements.txt**: Lists the dependencies for the Python application.\r\n\r\n## Installation\r\n\r\n1. Clone the repository:\r\n   ```bash\r\n   git clone https://github.com/mirzaim/url-shortner.git\r\n   cd url-shortner\r\n   ```\r\n\r\n2. Install Python dependencies:\r\n   ```bash\r\n   pip install -r requirements.txt\r\n   ```\r\n\r\n3. Build the Docker image:\r\n   ```bash\r\n   docker build -t url-shortner-image .\r\n   ```\r\n\r\n4. Deploy the application using Docker Compose:\r\n   ```bash\r\n   docker-compose up\r\n   ```\r\n\r\n## Kubernetes Deployment\r\n\r\n1. Create the ConfigMap, Secrets, and Persistent Volume:\r\n   ```bash\r\n   kubectl apply -f kubernetes/configmap.yml\r\n   kubectl apply -f kubernetes/secret.yml\r\n   kubectl apply -f kubernetes/volume.yml\r\n   ```\r\n\r\n2. Deploy the database and application:\r\n   ```bash\r\n   kubectl apply -f kubernetes/db-dep.yml\r\n   kubectl apply -f kubernetes/app-dep.yml\r\n   ```\r\n\r\n3. (Optional) Apply Horizontal Pod Autoscaler:\r\n   ```bash\r\n   kubectl apply -f kubernetes/hpa-dep.yml\r\n   ```\r\n\r\n## Usage\r\n\r\nOnce the application is deployed, you can use the `/shortit` endpoint to shorten URLs. Here's an example using `curl` to test the API:\r\n\r\n1. Shorten a URL:\r\n\r\n   ```bash\r\n   curl -X POST http://\u003cyour-server-ip\u003e:\u003cyour-port\u003e/shortit -H \"Content-Type: application/json\" -d '{\"path_to\": \"https://www.example.com\"}'\r\n   ```\r\n\r\n   Replace `\u003cyour-server-ip\u003e` and `\u003cyour-port\u003e` with the actual IP and port of your deployed application.\r\n\r\n2. Visit the shortened URL:\r\n\r\n   The response will contain a shortened URL. You can visit this URL, and the system will redirect you to the original URL.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirzaim%2Furl-shortner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirzaim%2Furl-shortner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirzaim%2Furl-shortner/lists"}