{"id":13515119,"url":"https://github.com/Neoxelox/shortr","last_synced_at":"2025-03-31T04:36:32.429Z","repository":{"id":137193893,"uuid":"269730931","full_name":"neoxelox/shortr","owner":"neoxelox","description":"Simple, but blazingly fast, url shortener in various languages and frameworks","archived":false,"fork":false,"pushed_at":"2023-03-08T11:24:06.000Z","size":8053,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T19:51:32.116Z","etag":null,"topics":["css","docker","docker-compose","fast","go","golang","html","javascript","js","py","python","rs","rust","simple","ts","typescript","url-shortener","vue","vuejs"],"latest_commit_sha":null,"homepage":"","language":"Go","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/neoxelox.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}},"created_at":"2020-06-05T18:06:58.000Z","updated_at":"2023-03-08T11:24:11.000Z","dependencies_parsed_at":"2024-01-31T23:57:39.330Z","dependency_job_id":"e74cd69f-3332-4e0c-b222-1ae26afd0123","html_url":"https://github.com/neoxelox/shortr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fshortr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fshortr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fshortr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoxelox%2Fshortr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoxelox","download_url":"https://codeload.github.com/neoxelox/shortr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246418658,"owners_count":20773934,"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":["css","docker","docker-compose","fast","go","golang","html","javascript","js","py","python","rs","rust","simple","ts","typescript","url-shortener","vue","vuejs"],"created_at":"2024-08-01T05:01:06.490Z","updated_at":"2025-03-31T04:36:29.625Z","avatar_url":"https://github.com/neoxelox.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Shortr 🚀\n**`Simple, but blazingly fast, url shortener in various languages and frameworks`**\n\n![Banner](./static/images/bannermd.png \"Banner\")\n\n_**Note:** this is just a simple service to learn various languages and frameworks. Efficiency nor security or mantainabilty are the main intention in this project._\n\n## Languages\n- **`Golang`**\n    - **[Echo](go/echo)** ![Progress](https://img.shields.io/badge/progress-100%25-success \"Progress\")\n- **`JavaScript`**\n    - **[Express](js/express)** ![Progress](https://img.shields.io/badge/progress-0%25-inactive \"Progress\")\n- **`TypeScript`**\n    - **[Deno](ts/deno)** ![Progress](https://img.shields.io/badge/progress-0%25-inactive \"Progress\")\n- **`Python`**\n    - **[FastApi](py/fastapi)** ![Progress](https://img.shields.io/badge/progress-0%25-inactive \"Progress\")\n- **`Rust`**\n    - **[Actix-Web](rs/actix)** ![Progress](https://img.shields.io/badge/progress-0%25-inactive \"Progress\")\n\n## Screenshots\n![Home page](./static/images/home.png \"Home page\")\n![Stats page](./static/images/stats.gif \"Stats page\")\n![Error page](./static/images/404.gif \"Error page\")\n\n## Features\n\n- **🚀 `SIMPLE, FAST AND ROBUST`**\n- **✨ `CUSTOM OR RANDOM UNIQUE URLS (ACCEPTS UNICODE, SPACES... EVEN EMOJIS! 🔝)`**\n- **🌺 `BEAUTIFUL BY DEFAULT AND CUSTOMIZABLE`**\n- **🛡️ `AUTOMATIC-SSL READY`**\n- **🏗️ `CONTAINERIZED AND EASY TO DEPLOY`**\n- **📱 `RESPONSIVE`**\n- **🍃 `LIGHTWEIGHT, BUILT-IN CACHE AND HA`**\n- **😃 `SEO FRIENDLY AND CUSTOM LINK PREVIEWS`**\n\n## Setup\n- Install:\n    - [`docker 19.03.6 \u003e=`](https://docs.docker.com/get-docker/)\n    - [`docker-compose 1.21.0 \u003e=`](https://docs.docker.com/compose/install/)\n- Run `make $language/$framework` ( for example `go/echo` )\n\n**_Important_** as all WS containers map to port 80, in order to run another language/framework run `make stop` and then `make $language/$framework`.\nSee [`makefile`](makefile) for further commands.\n\n## Usage\nUse the frontend [`localhost`](http://localhost) or interact directly with the shorterner via API calls described below.\n\n## API\n### `GET` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/\u003cspan/\u003e\n#### Request\n```\nNothing\n```\n#### Response\n- **`default`**\n    ```\n    Serves /static\n    ```\n\n### `GET` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/:name\u003cspan/\u003e\n#### Request\n- **`path param`** _`name`_\n#### Response\n- **`default`**\n    ```\n    Redirects to url specified by name\n    HTTP code 307 in order not to get urls cached by browsers\n    ```\n- **`error default`**\n    ```\n    Serves 404.html page\n    ```\n- **`error application/json`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n### `POST` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/:name?url=:url\u003cspan/\u003e\n#### Request\n- **`path param`** _`name`_ **`nullable`**\n- **`query param`** _`url`_\n#### Response\n- **`default`**\n    ```javascript\n    {\n        \"id\": 33,\n        \"name\": \"shortr\",\n        \"url\": \"https://github.com/neoxelox/shortr\",\n        \"hits\": 1,\n        \"last_hit_at\": \"2020-07-27T00:50:42.027431Z\", // ( or null )\n        \"created_at\": \"2020-07-26T23:36:14.896767Z\",\n        \"modified_at\": \"2020-07-26T23:36:14.900672Z\"\n    }\n    ```\n- **`error default`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n\n### `DELETE` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/:name\u003cspan/\u003e\n#### Request\n- **`path param`** _`name`_\n#### Response\n- **`default`**\n    ```javascript\n    {\n        \"id\": 33,\n        \"name\": \"shortr\",\n        \"url\": \"https://github.com/neoxelox/shortr\",\n        \"hits\": 1,\n        \"last_hit_at\": \"2020-07-27T00:50:42.027431Z\", // ( or null )\n        \"created_at\": \"2020-07-26T23:36:14.896767Z\",\n        \"modified_at\": \"2020-07-26T23:36:14.900672Z\"\n    }\n    ```\n- **`error default`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n### `PUT` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/:name?url=:url\u003cspan/\u003e\n#### Request\n- **`path param`** _`name`_\n- **`query param`** _`url`_\n#### Response\n- **`default`**\n    ```javascript\n    {\n        \"id\": 33,\n        \"name\": \"shortr\",\n        \"url\": \"https://github.com/neoxelox/shortr\",\n        \"hits\": 1,\n        \"last_hit_at\": \"2020-07-27T00:50:42.027431Z\", // ( or null )\n        \"created_at\": \"2020-07-26T23:36:14.896767Z\",\n        \"modified_at\": \"2020-07-26T23:36:14.900672Z\"\n    }\n    ```\n- **`error default`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n### `GET` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/:name/stats\u003cspan/\u003e\n#### Request\n- **`path param`** _`name`_\n#### Response\n- **`default`**\n    ```\n    Serves stats.\u003crenderer\u003e.html page\n    ```\n- **`application/json`**\n    ```javascript\n    {\n        \"id\": 33,\n        \"name\": \"shortr\",\n        \"url\": \"https://github.com/neoxelox/shortr\",\n        \"hits\": 1,\n        \"last_hit_at\": \"2020-07-27T00:50:42.027431Z\", // ( or null )\n        \"created_at\": \"2020-07-26T23:36:14.896767Z\",\n        \"modified_at\": \"2020-07-26T23:36:14.900672Z\"\n    }\n    ```\n- **`error default`**\n    ```\n    Serves 404.html page\n    ```\n- **`error application/json`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n### `GET` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/health\u003cspan/\u003e\n#### Request\n```\nNothing\n```\n#### Response\n- **`default`**\n    ```\n    OK\n    ```\n- **`error default`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n### `ERROR` \u003cspan style=\"color: #607D8B; font-weight: normal; font-size: 0.8em;\"\u003e/*\u003cspan/\u003e\n#### Request\n```\nAny\n```\n#### Response\n- **`default if template`**\n    ```\n    Serves \u003ccode\u003e.html page\n    ```\n- **`application/json`**\n    ```javascript\n    {\n        \"message\": \"error message\"\n    }\n    ```\n\n## Database\nThe project uses the latest Postgres version available and automatically initializes a pgadmin4 instance [`localhost:5433`](http://localhost:5433) to navigate through the database. Default user is `admin@admin.com` and password `admin`. The server group is called `URLs` and the default database password is `postgres`.\n\n## Model\n```yaml\nURL:\n    id:          integer\n    name:        string\n    url:         string\n    hits:        integer\n    last_hit_at: datetime   nullable\n    created_at:  datetime\n    modified_at: datetime\n```\n\n## Benchmarks\nThe load testing tool is [Locust](https://github.com/locustio/locust) using 1 master and 4 worker containers, which are automatically created. All follow the [locustfile](locustfile.py) with `2500` users cap and a `25` spawn rate.\nThe benchmark must not be taken as _fully good_ comparison, but gives a quick overview at language and framework efficiency for this purpose.\n\nThe minimum number of simultaneous files open for Locust to work is `10000`. You can check your SO's default using `ulimit -Sn` and then increasing it with `ulimit -S -n 10000`.\n\nThe benchmark was run on (`sudo lshw -short`):\n```\nH/W path         Device           Class          Description\n============================================================\n                                  system         MS-7B29 (Default string)\n/0                                bus            H310M PRO-VDH (MS-7B29)\n/0/39/0                           memory         8GiB DIMM DDR4 Synchronous 2667 MHz (0,4 ns)\n/0/39/2                           memory         8GiB DIMM DDR4 Synchronous 2667 MHz (0,4 ns)\n/0/46                             processor      Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz\n/0/100/1/0                        display        GM206 [GeForce GTX 960]\n```\n\n### `Mixed API usage`\n| Language | Framework | Mean requests per second | Maximum requests per second | Slowest request |\n|:--------:|:---------:|:------------------------:|:---------------------------:|:---------------:|\n|    Go    |    Echo   |         6650 rps         |           7050 rps          |      810 ms     |\n\n## Contribute\nFeel free to contribute to this project by adding more languages/frameworks, the only requirement is that it has to provide the minimum endpoints described above : ) .\n\n## License\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - read the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNeoxelox%2Fshortr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNeoxelox%2Fshortr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNeoxelox%2Fshortr/lists"}