{"id":18780420,"url":"https://github.com/karan/s","last_synced_at":"2025-04-13T11:30:54.231Z","repository":{"id":13961151,"uuid":"16661505","full_name":"karan/s","owner":"karan","description":":cactus: A high-performance, anonymous URL shortener built using Redis + Node.js with a API-backed design.","archived":false,"fork":false,"pushed_at":"2014-11-30T19:25:22.000Z","size":198,"stargazers_count":22,"open_issues_count":6,"forks_count":29,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T23:29:50.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://s.goel.im/","language":"JavaScript","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/karan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-09T06:33:49.000Z","updated_at":"2025-01-16T18:57:41.000Z","dependencies_parsed_at":"2022-09-01T15:31:52.378Z","dependency_job_id":null,"html_url":"https://github.com/karan/s","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/karan%2Fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2Fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2Fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2Fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karan","download_url":"https://codeload.github.com/karan/s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705515,"owners_count":21148549,"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":[],"created_at":"2024-11-07T20:26:20.797Z","updated_at":"2025-04-13T11:30:53.882Z","avatar_url":"https://github.com/karan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"*`s`*\n=\n\n**Release status: *alpha***\n\nA high-performance, anonymous URL shortener built using Redis + Node.js with a API-backed design.\n\n[Demo](http://s.goel.im)\n\n### Features\n\n- **High performance** - mean response time for `POST` methods is 40ms\n- **Anonymous** - No user data is stored, only timestamps of hits on links are stored for analtics\n- **Extendible** - The code is very simple and minimal to make it easier to extend it's features as needed.\n\n### Quickstart\n    $ brew install redis\n    $ npm install\n    $ redis-server\n    $ node app\n\n### Performance\n\n`s` uses Redis as the primary data store which provides excellent performance even at scale. Below are the benchmark results with 10,000 `POST` requests (10 concurrent connections).\n\n    This is ApacheBench, Version 2.3 \u003c$Revision: 655654 $\u003e\n    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n    Licensed to The Apache Software Foundation, http://www.apache.org/\n\n    Benchmarking s.goel.im (be patient)\n    Completed 1000 requests\n    Completed 2000 requests\n    Completed 3000 requests\n    Completed 4000 requests\n    Completed 5000 requests\n    Completed 6000 requests\n    Completed 7000 requests\n    Completed 8000 requests\n    Completed 9000 requests\n    Completed 10000 requests\n    Finished 10000 requests\n\n\n    Server Software:        MochiWeb/1.0\n    Server Hostname:        s.goel.im\n    Server Port:            80\n\n    Document Path:          /new\n    Document Length:        409 bytes\n\n\n    Concurrency Level:      10\n    Time taken for tests:   170.267 seconds\n    Complete requests:      10000\n    Failed requests:        12\n     (Connect: 0, Receive: 0, Length: 12, Exceptions: 0)\n    Write errors:           0\n    Non-2xx responses:      9993\n    Total transferred:      6163636 bytes\n    Total POSTed:           1810724\n    HTML transferred:       4085092 bytes\n    Requests per second:    58.73 [#/sec] (mean)\n    Time per request:       170.267 [ms] (mean)\n    Time per request:       17.027 [ms] (mean, across all concurrent requests)\n    Transfer rate:          35.35 [Kbytes/sec] received\n                          10.39 kb/s sent\n                          45.74 kb/s total\n\n    Connection Times (ms)\n                min  mean[+/-sd] median   max\n    Connect:       67   71  22.6     68    1070\n    Processing:    69  100  48.5     78     746\n    Waiting:        0   99  48.5     78     746\n    Total:        137  170  56.8    148    1277\n\n    Percentage of the requests served within a certain time (ms)\n    50%    148\n    66%    164\n    75%    179\n    80%    191\n    90%    223\n    95%    262\n    98%    331\n    99%    394\n    100%   1277 (longest request)\n\n### Dependencies\n\n- Node.js (the server)\n- Express.js (lightweight framework on top of node)\n- Redis (simple key-value data store)\n- Angular.js (for client side JS)\n- Jade (HTML rendering engine)\n\n### Develop locally\n\nStart the redis server\n\n    $ redis-server\n\nStart the node app\n\n    $ node app\n\n### Deploy on Heroku\n\n    $ heroku create                     // create a heroku app\n    $ heroku addons:add redistogo       // add the redistogo addon\n    $ foreman start                     // start the foreman server to test locally\n    $ git push heroku master            // to the moon\n\nIf you have any issues, please find help in the [Heroku Help](https://devcenter.heroku.com/) center first. If that doesn't help, [create an issue](https://github.com/karan/s/issues) and I'll see if there's something I can help with.\n\n### API end points\n\n#### Shorten a URL\n\n`POST /new`\n\nGenerates a new short URL for the given long url.\n\n**Parameters**\n\n| Name | Type | Description |\n| ---- | ---- | ----------- |\n| `long_url` | `string` | **Required.** The URL to be shortened.\n\n**Response**\n\n    {\n      \"status\": \"success\",\n      \"short_id\": \"dLC\",\n      \"short_url\": \"http://localhost:8000/dLC\",\n      \"long_url\": \"https://news.ycombinator.com/item?id=7202182\"\n    }\n\n#### Get the long URL\n\nRedirects to the long URL of the passed short URL, if exists. Also increases the hit counter and pushes the hit timestamp.\n\n`GET /:slug`\n\n### License\n\nMIT\n\nBasically, you can do whatever you want as long as you include the original copyright.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaran%2Fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaran%2Fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaran%2Fs/lists"}