{"id":15365433,"url":"https://github.com/epiphone/serverless-url-shortener","last_synced_at":"2025-04-09T00:48:36.812Z","repository":{"id":151575106,"uuid":"230399360","full_name":"epiphone/serverless-url-shortener","owner":"epiphone","description":"NodeJS/TypeScript/AWS Lambda/Serverless Framework/DynamoDB","archived":false,"fork":false,"pushed_at":"2020-07-20T02:04:25.000Z","size":136,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T19:22:57.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/epiphone.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":"2019-12-27T07:58:38.000Z","updated_at":"2020-04-06T01:00:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b7cf1e9-31b0-4461-84fc-085d1c9fd349","html_url":"https://github.com/epiphone/serverless-url-shortener","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":0.05882352941176472,"last_synced_commit":"a93db0657afc77e4ac3b4a9539ee1fcf197c7ac2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiphone%2Fserverless-url-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiphone%2Fserverless-url-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiphone%2Fserverless-url-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiphone%2Fserverless-url-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epiphone","download_url":"https://codeload.github.com/epiphone/serverless-url-shortener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247953090,"owners_count":21023945,"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-10-01T13:14:45.619Z","updated_at":"2025-04-09T00:48:36.794Z","avatar_url":"https://github.com/epiphone.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URL shortener\n\nA simple URL shortener API running on NodeJS/Typescript/AWS Lambda/Serverless Framework/DynamoDB.\n\nOriginal version (see [branch](https://github.com/epiphone/serverless-url-shortener/tree/3hours)) completed in a mad 3-hour dash for a coding exercise, tidied up later. The basic features are\n- `POST /?url={longUrl}` endpoint for creating short URLS\n  - returns short URL if given URL is already shortened\n- `GET /{shortUrl}` endpoint that redirects to given target URL if found\n  - we're keeping track of successful redirects for statistics\n- `GET /{shortUrl}/stats` endpoint that returns hourly redirect counts per given `shortUrl`\n\n## Future work\n- [x] ~~Use an async DynamoDB client to get rid of nested callbacks~~\n- [ ] Write an OpenAPI schema and use API Gateway to validate requests\n- [ ] Integration tests: try running integration tests locally against `serverless-offline` and `serverless-dynamodb-local`\n- [x] ~~Smarter hourly time-series aggregation as opposed to the naive full-table scan~~\n- [ ] CI/CD: build, run tests and lint on GitHub actions + run `sls deploy` if on `master` branch\n- [x] ~~Set DynamoDB table names as Serverless Framework config variables and pass to Lambda handlers as env vars to avoid hardcoding table names to code~~\n- [ ] Tune the Lambda IAM policy to avoid overly wide permissions\n\n## Dependencies\n- `yarn`\n- Serverless framework\n- Java Runtime Engine (JRE) version 6.x or newer for [local DynamoDB](https://github.com/99xt/serverless-dynamodb-local)\n\n## Local development\n\nFirst install dependencies:\n\n```bash\nyarn install\nsls dynamodb install\n```\n\nThen start local development server with `sls offline start`.\n\n## Test\n\n`yarn test`\n\n## Deploy\n\n`sls deploy`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepiphone%2Fserverless-url-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepiphone%2Fserverless-url-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepiphone%2Fserverless-url-shortener/lists"}