{"id":19371418,"url":"https://github.com/michael-ortiz/url-shortner-api","last_synced_at":"2026-06-02T16:03:35.491Z","repository":{"id":213428951,"uuid":"597897988","full_name":"michael-ortiz/url-shortner-api","owner":"michael-ortiz","description":"A Lambda API backend hosted in AWS using Terraform to generate short URL's from long ones. Easily connect this backend to any front end app. Happy coding! 😃","archived":false,"fork":false,"pushed_at":"2023-02-09T02:22:35.000Z","size":37,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-16T15:13:51.609Z","etag":null,"topics":["api","aws","dynamodb","lambda","serverless","shortener","terraform","url-shortener","url-shortener-api"],"latest_commit_sha":null,"homepage":"https://cutmyurl.com","language":"JavaScript","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/michael-ortiz.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}},"created_at":"2023-02-06T00:00:48.000Z","updated_at":"2024-05-20T12:23:46.000Z","dependencies_parsed_at":"2023-12-21T01:00:51.793Z","dependency_job_id":null,"html_url":"https://github.com/michael-ortiz/url-shortner-api","commit_stats":null,"previous_names":["michael-ortiz/url-shortner-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michael-ortiz/url-shortner-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-ortiz%2Furl-shortner-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-ortiz%2Furl-shortner-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-ortiz%2Furl-shortner-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-ortiz%2Furl-shortner-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michael-ortiz","download_url":"https://codeload.github.com/michael-ortiz/url-shortner-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-ortiz%2Furl-shortner-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33829346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","aws","dynamodb","lambda","serverless","shortener","terraform","url-shortener","url-shortener-api"],"created_at":"2024-11-10T08:18:24.167Z","updated_at":"2026-06-02T16:03:35.473Z","avatar_url":"https://github.com/michael-ortiz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# url-shortner-api\n\n`AWS Hosted Project`\n\nThis project contains the necessary infrastructure as code and lambda code to host a URL shortener API. Convert any long URL's to a short one. Easily connect this API to your front end application.\n\n**AWS Services Used**:\n\n* AWS Lambda: For the backend API.\n* AWS DynamoDB: For storing link references.\n\n# ⚙️ Installation\n\nTo deploy the application you must have [terraform cli](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) and [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) installed.\n\nYou must have a `aws profile` configured for terraform to use it and deploy it into your AWS account:\n\n```\naws configure --profile \u003cYOUR_PROFILE_NAME\u003e\n```\n\nTo begin, open the `provider.tf` file and under the aws provider change the profile used. Put your own profile name in `\u003cYOUR_AWS_CONFIGURE_PROFILE\u003e`. Then change the `\u003cYOUR_AWS_REGION\u003e` to `us-east-1`.\n\n```\nprovider \"aws\" {\n  region = \"us-east-1\"\n  profile = \"profile_name\"\n}\n```\n\nNext, go to `vars.tf` and change in `locals` the following values: `domain_name` and `domain_protocol`.\n\n# 🚀 Deployment\nExecute the following commands to deploy the infrastructure and lambdas:\n\n```sh\nnpm install --prefix ./functions/get-short-url\nterraform init\nterraform apply\n```\n\nOnce deployed, you should see in the outputs the URL's pointing to your lambdas.\n\n# 🔗 API Usage\n\nThe API contains 3 different lambdas. Below we explain how to use each:\n\n* `get_short_url`: Generates the `shortValue` from a long url and stores it in a DynamoDB table.\n* `get_original_url`: Fetches the original URL by passing a `shortValue` generated by the first API call.\n* `get_url_stats`: Fetches details about a URL without increasing the `viewsCount` property.\n\n## Get Short URL\n\nMethod: `POST`\n\nURL Example: (See Terraform output for `get_short_url_function_url` for actual URL)\n```\nhttps://\u003cID\u003e.lambda-url.us-east-1.on.aws/\n```\n\n### Request Body:\n\n```\n{\n    \"url\": \"https://google.com\",\n    \"alias\": \"custom-alias\"\n}\n```\n\n### Response Body:\n\n```\n{\n    \"lastViewedDate\": \"2023-02-06T00:15:05.319Z\",\n    \"createdDate\": \"2023-02-06T00:15:05.319Z\",\n    \"shortUrl\": \"https://\u003cYOUR_DOMIAN_NAME\u003e/oaIL23dz\",\n    \"viewsCount\": 0,\n    \"shortValue\": \"oaIL23dz\",\n    \"originalUrl\": \"https://google.com\"\n}\n```\n\n### Properties\n\n---\n`url`\n\n*Description:* A long url. Support https, http and non protocol URL's.\n\n*Required:* `Yes`  \n\n*Type:* `string`\n\n---\n\n`alias`\n\n*Description:* A custom alias (name) for the URL. If this is used, a random ID will not be returned and instead a custom alias will be used.\n\n*Required:* `No`  \n\n*Type:* `string`\n\n---\n\n## Get Original URL\n\nMethod: `GET`\n\nURL Example: (See Terraform output for `get_original_url_function_url` for actual URL)\n```\nhttps://\u003cID\u003e.lambda-url.us-east-1.on.aws\n```\n\n### Request Query:\n\n```\nhttps://\u003cID\u003e.lambda-url.us-east-1.on.aws?shortValue=\u003cSHORT_VALUE\u003e\n```\n\n### Response Body:\n\n```\n{\n    \"viewsCounter\": \"2\",\n    \"lastViewedDate\": \"2023-02-06T00:47:44.471Z\",\n    \"createdDate\": \"2023-02-06T00:44:01.242Z\",\n    \"shortUrl\": \"https://\u003cYOUR_DOMAIN_NAME\u003e/lgatGICp\",\n    \"shortValue\": \"lgatGICp\",\n    \"originalUrl\": \"https://google.com\"\n}\n```\n\n### Query Parameters\n---\n\n`shortValue`\n\n*Description:* A unique ID that will be used as the URL path. This value is returned when first creating a shortUrl.\n\n*Required:* `Yes`  \n\n*Type:* `string`\n\n---\n\n\n## Get URL Statistics\n  \nMethod: `GET`\n\nURL Example: (See Terraform output for `get_url_stats_function_url` for actual URL)\n```\nhttps://\u003cID\u003e.lambda-url.us-east-1.on.aws\n```\n\n### Request Query:\n\n```\nhttps://\u003cID\u003e.lambda-url.us-east-1.on.aws?shortValue=\u003cSHORT_VALUE\u003e\n```\n\n### Response Body:\n\n```\n{\n    \"viewsCounter\": \"2\",\n    \"lastViewedDate\": \"2023-02-06T00:47:44.471Z\",\n    \"createdDate\": \"2023-02-06T00:44:01.242Z\",\n    \"shortUrl\": \"https://\u003cYOUR_DOMAIN_NAME\u003e/lgatGICp\",\n    \"shortValue\": \"lgatGICp\",\n    \"originalUrl\": \"https://google.com\"\n}\n```\n\n### Query Parameters\n---\n\n`shortValue`\n\n*Description:* A unique ID that will be used as the URL path. This value is returned when first creating a shortUrl.\n\n*Required:* `Yes`  \n\n*Type:* `string`\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-ortiz%2Furl-shortner-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichael-ortiz%2Furl-shortner-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-ortiz%2Furl-shortner-api/lists"}