{"id":28321224,"url":"https://github.com/uosyph/url-shortener","last_synced_at":"2026-04-28T12:03:28.107Z","repository":{"id":204225482,"uuid":"711350546","full_name":"uosyph/url-shortener","owner":"uosyph","description":"Shorten, manage, and track URLs. With features such as analytics, QR code generation, user management, a sleek UI, and an API.","archived":false,"fork":false,"pushed_at":"2024-05-06T20:44:35.000Z","size":655,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-04T15:10:36.104Z","etag":null,"topics":["analytics","api","css","flask","html","python","sqlalchemy","ui","url-shortener","user-management","web-app"],"latest_commit_sha":null,"homepage":"https://shorten-o4x8.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/uosyph.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":"2023-10-29T01:24:58.000Z","updated_at":"2024-06-04T02:13:57.000Z","dependencies_parsed_at":"2025-06-23T13:42:08.238Z","dependency_job_id":"ccd0bcba-ab21-42e5-aa25-14a17e7ac904","html_url":"https://github.com/uosyph/url-shortener","commit_stats":null,"previous_names":["yousafesaeed/url-shortener","uosyph/url-shortener"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uosyph/url-shortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Furl-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Furl-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Furl-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Furl-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uosyph","download_url":"https://codeload.github.com/uosyph/url-shortener/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Furl-shortener/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["analytics","api","css","flask","html","python","sqlalchemy","ui","url-shortener","user-management","web-app"],"created_at":"2025-05-25T12:13:25.335Z","updated_at":"2026-04-28T12:03:28.091Z","avatar_url":"https://github.com/uosyph.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n# Shorten\n\nIn a world cluttered with lengthy and cumbersome URLs, a lone developer,\ndriven by the frustration of sharing convoluted web addresses,\nembarked on a quest to simplify the digital landscape.\nThis is the tale of \"Shorten,\" a URL shortener born out of necessity.\n\nTry out [Shorten](https://shorten-o4x8.onrender.com) today!\n\n## Table of Contents\n\n- [Features](#features)\n- [Screenshots](#screenshots)\n- [API Usage](#api-usage)\n- [Environment Configuration](#environment-configuration)\n- [Local Development](#local-development)\n- [Production Deployment](#production-deployment)\n- [Contributing](#contributing)\n- [License](#license)\n- [Author](#author)\n\n## Features\n\nShorten isn't just a mere URL shortener;\nit's a comprehensive solution tailored for both casual users and those seeking advanced functionality.\nLet's delve into its features:\n\n### User Management\nUsers can create accounts, log in, and generate tokens for API access,\nunlocking a realm of possibilities like creating permanent or time-limited short URLs.\n\n### Limited Functionality for Non-Logged-In Users\nEven without an account, users can still benefit from URL shortening, but with a 7-day lifespan for their links.\n\n### Dashboard and Analytics\nLogged-in users are treated to a personalized dashboard, providing insights into URL analytics,\nclick-through rates, and referral sources.\n\n### API Integration\nShorten goes beyond the browser with a robust API, allowing programmatic URL management.\nTokens obtained by users enable secure API operations.\n\n### URL Management\nFine-tune control with the ability to delete URLs or adjust their expiration date.\n\n### QR Code Generation\nSimplify sharing further with QR codes generated effortlessly for shortened URLs.\n\n### User Interface\nAn aesthetically pleasing index page, a feature-rich dashboard,\nand a custom 404 page showcase Shorten's commitment to a seamless user experience.\n\nIn summary, the URL Shortener project provides a comprehensive solution for shortening, managing,\nand tracking URLs, with features to suit both logged-in and non-logged-in users.\n\n## Screenshots\n\n### Shortener\n![Shortener Page Preview](/screenshots/shortener.png)\n\n### Dashboard\n![Dashboard Page Preview](/screenshots/dashboard.png)\n\n### Account\n![Account Page Preview](/screenshots/account.png)\n\n## API Usage\n\n### Authentication\n\nAll API endpoints require authentication using JWT tokens.\nInclude the token in the header of your requests as follows:\n\n```\nHeader: x-access-token: YOUR_JWT_TOKEN\n```\n\n### Endpoints\n\n#### Shorten a URL\n\n- Endpoint: `/api/shorten`\n- Method: `POST`\n- Request Body:\n\n```json\n{\n  \"url\": \"YOUR_LONG_URL\",\n  \"is_permanent\": true,   // Optional\n  \"exp_date\": \"dd-mm-yyyy.HH:MM\"   // Optional\n}\n```\n\n#### Retrieve Orignal URL\n\n- Endpoint: `/api/get`\n- Method: `GET`\n- Request Body:\n\n```json\n{\n  \"url\": \"SHORTENED_URL\"   // Optional\n}\n```\n\n#### Retrieve URL Statistics\n\n- Endpoint: `/api/stats`\n- Method: `GET`\n- Request Body:\n\n```json\n{\n  \"url\": \"SHORTENED_URL\"   // Optional\n}\n```\n\n#### Update URL Settings\n\n- Endpoint: `/api/update`\n- Method: `PUT`\n- Request Body:\n\n```json\n{\n  \"url\": \"SHORTENED_URL\",\n  \"is_permanent\": true,   // Optional\n  \"exp_date\": \"dd-mm-yyyy.HH:MM\"   // Optional\n}\n```\n\n#### Delete a URL\n\n- Endpoint: `/api/delete`\n- Method: `DELETE`\n- Request Body:\n\n```json\n{\n  \"url\": \"SHORTENED_URL\"\n}\n```\n\n## Environment Configuration\n\nTo run this project, you need to set up your environment variables.\n\nCreate a file named `.env` in the root of the project and add the following configuration:\n\n```env\nDB=database_name\nTEST_DB=test_database_name\nENV=your_environment\nSECRET_KEY=your_secret_key\n```\n\n## Local Development\n\n**Clone the Repository:**\n\n```sh\ngit clone https://github.com/uosyph/url-shortener.git \u0026\u0026 cd url-shortener\n```\n\n**Install the Required Libraries:**\n\n```sh\npip install -r requirements.txt\n```\n\n**Build the Database:**\n\n```sh\npython database.py\n```\n\n**Run the App:**\n\n```sh\npython app.py\n```\n\n## Production Deployment\n\n### Prerequisites\n\nEnsure the following prerequisites are installed on the server:\n\n- `Nginx`, `Python`, and `pip`.\n- The `venv` module for Python.\n- A WSGI server like `Gunicorn`.\n- A terminal multiplexer like `tmux`.\n\n### Configure Nginx\n\n**Create a Configuration File:**\n\n```bash\nsudo vi /etc/nginx/sites-available/shorten\n```\n\n**Add the Following Configuration:**\n\n```nginx\nserver {\n    listen 80;\n    server_name 0.0.0.0;  # Use the actual domain or IP address\n\n    location / {\n        proxy_pass http://127.0.0.1:5000;  # Match the Gunicorn host and port\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n\n    location /static/ {\n        alias /home/ubuntu/shorten/static/;\n    }\n\n    location /favicon.ico {\n        alias /home/ubuntu/shorten/static/images/favicon.ico;\n    }\n\n    error_page 404 /404.html;\n    location /404.html {\n        root /home/ubuntu/shorten/templates/;\n    }\n}\n```\n\n**Create a Symbolic Link to Enable the Configuration:**\n\n```bash\nsudo ln -s /etc/nginx/sites-available/shorten /etc/nginx/sites-enabled/\n```\n\n**Test Nginx Configuration:**\n\n```bash\nsudo nginx -t\n```\n\n**Restart Nginx:**\n\n```bash\nsudo systemctl restart nginx\n```\n\n### Deploy the Application\n\n**Clone the Repository on the Server:**\n\n```bash\ngit clone https://github.com/uosyph/url-shortener.git shorten\n```\n\n**Create a Virtual Environment:**\n\n```bash\npython -m venv shorten \u0026\u0026 source shorten/bin/activate \u0026\u0026 cd shorten/\n```\n\n**Install Production Requirements:**\n\n```bash\npip install -r requirements.txt\n```\n\n**Deactivate the Virtual Environment:**\n\n```bash\ndeactivate\n```\n\n**Build the Database:**\n\n```sh\npython database.py\n```\n\n**Run the App with Gunicorn (Inside a tmux Session):**\n\n```bash\ntmux new-session -d 'gunicorn -b 127.0.0.1:5000 app:app'\n```\n\n## Contributing\n\n### Development\n\nTo fix a bug or enhance an existing feature, follow these steps:\n\n- [Fork the repo](https://github.com/uosyph/url-shortener/fork)\n- Create a new branch (`git checkout -b improve-feature`)\n- Make the necessary changes\n- Add changes to reflect updates\n- Commit your changes (`git commit -am 'Improve feature'`)\n- Push to the branch (`git push origin improve-feature`)\n- [Create a Pull Request](https://github.com/uosyph/url-shortener/compare)\n\n### Bug/Feature Request\n\nIf you find a bug or want to request a new feature:\n\n- For bugs, [open an issue](https://github.com/uosyph/url-shortener/issues/new/choose) with details about the problem.\n- For feature requests, [open an issue](https://github.com/uosyph/url-shortener/issues/new/choose) with your suggestions.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\n**Yousef Saeed**:\n[GitHub](https://github.com/uosyph)\n[LinkedIn](https://linkedin.com/in/uosyph)\n[X](https://twitter.com/uosyph)\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to Top\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuosyph%2Furl-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuosyph%2Furl-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuosyph%2Furl-shortener/lists"}