{"id":22680123,"url":"https://github.com/coderooz/flask-url-shortener","last_synced_at":"2025-07-26T08:38:35.208Z","repository":{"id":254652863,"uuid":"847167231","full_name":"coderooz/flask-url-shortener","owner":"coderooz","description":"This is a simple URL shortener application built with Flask and Python. It allows users to shorten long URLs and then redirect to the original URLs using a short key.","archived":false,"fork":false,"pushed_at":"2024-08-25T03:45:06.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T13:51:45.366Z","etag":null,"topics":["flask","python","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/coderooz.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-25T03:35:57.000Z","updated_at":"2024-08-25T03:50:56.000Z","dependencies_parsed_at":"2024-08-25T04:47:26.868Z","dependency_job_id":null,"html_url":"https://github.com/coderooz/flask-url-shortener","commit_stats":null,"previous_names":["coderooz/flask-url-shortener"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coderooz/flask-url-shortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fflask-url-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fflask-url-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fflask-url-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fflask-url-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderooz","download_url":"https://codeload.github.com/coderooz/flask-url-shortener/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fflask-url-shortener/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267141151,"owners_count":24041982,"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-26T02:00:08.937Z","response_time":62,"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":["flask","python","url-shortener"],"created_at":"2024-12-09T19:12:27.181Z","updated_at":"2025-07-26T08:38:35.182Z","avatar_url":"https://github.com/coderooz.png","language":"Python","readme":"# Flask URL Shortener\r\n\r\nThis is a simple URL shortener application built with Flask and Python. It allows users to shorten long URLs and then redirect to the original URLs using a short key.\r\n\r\n## Features\r\n\r\n- Shorten URLs and redirect to the original URL using a short key.\r\n- Display the shortened URL on the homepage.\r\n\r\n## Prerequisites\r\n\r\n- Python 3.x\r\n- Flask (installable via pip)\r\n\r\n## Setup\r\n\r\n1. **Clone the repository**\r\n\r\n   ```bash\r\n   git clone https://github.com/coderooz/flask-url-shortener.git\r\n   cd flask-url-shortener\r\n   ```\r\n\r\n2. **Create and activate a virtual environment**\r\n\r\n   ```bash\r\n   python -m venv venv\r\n   source venv/bin/activate  # On Windows use: venv\\Scripts\\Activate.ps1\r\n   ```\r\n\r\n3. **Install the required packages**\r\n\r\n   ```bash\r\n   pip install flask\r\n   ```\r\n\r\n4. **Create the template file**\r\n\r\n   Create a file named `index.html` in a folder named `templates` in the same directory as `app.py` with the following content:\r\n\r\n   ```html\r\n   \u003c!DOCTYPE html\u003e\r\n    \u003chtml lang=\"en\"\u003e\r\n    \u003chead\u003e\r\n        \u003cmeta charset=\"UTF-8\"\u003e\r\n        \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\r\n        \u003ctitle\u003eURL Shortener\u003c/title\u003e\r\n        \u003clink rel=\"stylesheet\" href=\"{{ url_for('static', filename='style.css') }}\"\u003e \r\n    \u003c/head\u003e\r\n    \u003cbody\u003e\r\n        \u003ch1\u003eURL Shortener\u003c/h1\u003e            \r\n        \u003cform action=\"/shorten\" method=\"post\"\u003e\r\n            \u003clabel for=\"url\"\u003eEnter URL:\u003c/label\u003e\r\n            \u003cinput type=\"text\" id=\"url\" name=\"url\" required\u003e\r\n            \u003cinput type=\"submit\" value=\"Shorten\"\u003e\r\n        \u003c/form\u003e\r\n\r\n        {% if short_url %}\r\n        \u003cp\u003eShort URL: \u003ca target=\"blank\" href=\"{{ short_url }}\"\u003e{{ short_url }}\u003c/a\u003e\u003c/p\u003e\r\n    {% endif %} \r\n    \u003c/body\u003e\r\n    \u003c/html\u003e\r\n   ```\r\n\r\n## Running the Application\r\n\r\n1. **Run the Flask application**\r\n\r\n   ```bash\r\n   python app.py\r\n   ```\r\n\r\n2. **Open your web browser and go to** `http://127.0.0.1:5000/` or `http://localhost:5000/`\r\n\r\n   You should see the URL shortener form. Enter a URL and click \"Shorten\" to get a shortened URL.\r\n\r\n## How It Works\r\n\r\n- **Homepage (`/`)**: Displays a form where users can enter a URL to shorten. The shortened URL will be displayed on the same page.\r\n- **Shorten URL (`/shorten`)**: Accepts a POST request with the original URL, generates a short key, and stores the mapping in memory.\r\n- **Redirect (`/\u003cshort_key\u003e`)**: Redirects to the original URL based on the short key.\r\n\r\n## Note\r\n\r\nThis application uses in-memory storage for URL mappings, which means that all URLs will be lost if the server is restarted. For production use, consider integrating a persistent database.\r\n\r\n## Future Integrations\r\n\r\n- **Database**\r\n- **Added UI Interface**\r\n- **User Login**\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Author\r\n\r\n**Ranit Saha**\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderooz%2Fflask-url-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderooz%2Fflask-url-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderooz%2Fflask-url-shortener/lists"}