{"id":19363317,"url":"https://github.com/mathisve/serverless-link-shortener","last_synced_at":"2025-04-13T11:24:33.585Z","repository":{"id":123975087,"uuid":"367389504","full_name":"mathisve/serverless-link-shortener","owner":"mathisve","description":"100% serverless link shortener built on AWS Lambda and Upstash","archived":false,"fork":false,"pushed_at":"2021-05-31T22:57:20.000Z","size":5139,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T22:35:07.771Z","etag":null,"topics":["aws","lambda","redis","serverless","upstash"],"latest_commit_sha":null,"homepage":"https://youtu.be/EJ6CJ0GC9lk","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathisve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-05-14T14:34:05.000Z","updated_at":"2023-12-05T09:37:49.000Z","dependencies_parsed_at":"2023-04-23T11:05:28.845Z","dependency_job_id":null,"html_url":"https://github.com/mathisve/serverless-link-shortener","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/mathisve%2Fserverless-link-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisve%2Fserverless-link-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisve%2Fserverless-link-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisve%2Fserverless-link-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathisve","download_url":"https://codeload.github.com/mathisve/serverless-link-shortener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248704297,"owners_count":21148343,"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":["aws","lambda","redis","serverless","upstash"],"created_at":"2024-11-10T07:33:43.287Z","updated_at":"2025-04-13T11:24:33.549Z","avatar_url":"https://github.com/mathisve.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serverless-link-shortener\n![build](https://github.com/mathisve/serverless-link-shortener//actions/workflows/go.yaml/badge.svg?branch=master)\n\n**A stateful serverless API built on top of AWS Lambda and Upstash Redis.**\n\n## Special thanks to [Upstash](https://upstash.com/) for making projects like this possible!\n\n## About:\n\nThe codebase consists of 2 functions:\n- `new` to add links to the database, returns the shortened hash/code\n- `get` to retrieve the links given the hash/code, returns HTML\n\n## Code snippet:\n```go\nfunc Handler(ctx context.Context, request events.APIGatewayProxyRequest) (Response, error) {\n    // extract hash from API Gateway headers\n    hash := request.Headers[\"hash\"]\n    \n    // get from Redis compatible Upstash database\n    val, err := client.Get(ctx, hash).Result()\n    \n    if err == redis.Nil {\n        // hash not found\n        return Response{\n            StatusCode: 404,\n            Body:       notFoundResponse,\n            Headers:    headers,\n        }, nil\n    }\n\n    // did find hash\n    return Response{\n        StatusCode: 200,\n        Body:       fmt.Sprintf(redirectResponse, val),\n        Headers:    headers,\n    }, nil\n}\n```\n\n## Video:\nIf you prefer to have me explain it to you, you're in luck!\nWatch the video [here](https://youtu.be/EJ6CJ0GC9lk)! (or click the thumbnail!)\n[![](https://raw.githubusercontent.com/mathisve/serverless-link-shortener/master/img/upstashthumb.png?token=ACUQMQPCQQROUJ3NS64FZE3AWVU6M)](https://youtu.be/EJ6CJ0GC9lk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathisve%2Fserverless-link-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathisve%2Fserverless-link-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathisve%2Fserverless-link-shortener/lists"}